// public int GetBoardSize() // { // throw new System.NotImplementedException(); // } public void RenderGameBoard(ITicTacToeBoard board) { for (var depth = 0; depth < board.GetBoardSize(); depth++) { RenderOneLayerOfBoard(board, depth); } }
private static void RenderOneLayerOfBoard(ITicTacToeBoard board, int depth) { for (var row = 0; row < board.GetBoardSize(); row++) { for (var col = 0; col < board.GetBoardSize(); col++) { var symbolOfCurrentPosition = board.GetPlayedCells() .Where(cell => cell.Coordinates.Row == row && cell.Coordinates.Column == col && cell.Coordinates.Depth == depth) .Select(move => move.State); if (symbolOfCurrentPosition.Any()) { Console.Write(" " + symbolOfCurrentPosition.First() + " "); } else { Console.Write(" . "); } } Console.WriteLine(Environment.NewLine); } Console.Write(Environment.NewLine); }
private bool IsDrawGame() { return(_ticTacToeBoard.GetPlayedCells().Count == _ticTacToeBoard.GetBoardSize() * _ticTacToeBoard.GetBoardSize() * _ticTacToeBoard.GetBoardSize()); }