You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sae201_qwirkle/Qwirkle/cm6(suite).cs

35 lines
975 B

public interface IDisplayer
{
void OnGameStart(Board board);
void OnPlayerNotified(Player player);
void OnMoveChosen(Player player, int row, int col);
void OnValidMove(Player player, Board board, int row, int col, bool isValid);
void OnBoardChanged(Board board);
}
public class ConsoleDisplayer : IDisplayer
{
public void OnGameStarted(Board board)
{
Console.WriteLine("Game has started !");
DisplayBoard(board);
}
public void DisplayBoard(Board board)
{
for(int row = 0; row < board.NbRows; row++)
{
for(int col = 0; col < board.NbCols; col++)
{
var playerSymbol = board[row, col] ?.Player == 1 ? "X" : "O";
Console.Write($"{playerSymbol} ")
}
Console.WriteLine();
}
}
}
// program.cs
OnGameStarted += _ => Console.WriteLine("Game has started !"); // j'ai pas compris mais ça à l'air complètement fumé