From 979741d5889e7a23a7ef8bc2a28f57d23eb93826 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 22 Jan 2024 15:11:24 +0100 Subject: [PATCH] Add(Tp3): Comments Rules --- Model/Sources/Model/Interface/Rules.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Model/Sources/Model/Interface/Rules.swift b/Model/Sources/Model/Interface/Rules.swift index 33db95b..d687172 100644 --- a/Model/Sources/Model/Interface/Rules.swift +++ b/Model/Sources/Model/Interface/Rules.swift @@ -9,14 +9,24 @@ import Foundation protocol Rules { var occurences: [Board: Int] { get set } + + // pas forcément utile si j'utilise pas playedMove var historic: [Move] { get set } - func createBoard() -> Board - func checkBoard( b: Board) throws + func static createBoard() -> Board + func static checkBoard( b: Board) throws func getNextPlayer() -> Owner + + // Donne tout les coups autoriser func getMoves( board: Board, owner: Owner) -> [Move] + + // Donne tout les coups autoriser à partir d'une cellule func getMoves( board: Board, owner: Owner, row: Int, column: Int) -> [Move] + + func isMoveValid( board: Board, row: Int, column: Int, rowArrived: Int, columnArrived: Int) -> Bool func isMoveValid( board: Board, move: Move) -> Bool func isGameOver( board: Board, lastMove: Move) -> (Bool, Result) + + // permet de stocker le coût qui a été fait. (playedMove) func playedMove( move: Move, oldBoard: Board, newBoard: Board) }