Beispiel #1
0
        public static void Main(string[] args)
        {
            var turn = 0;

            var board = new[]
            {
                0, 0, 0,
                0, 0, 0,
                0, 0, 0
            };

            while (true)
            {
                PrintBoard(board);

                if (Opponent.IsBoardInTerminalState(board))
                {
                    break;
                }

                Console.Write("Enter the square you'd like to play:");
                var playerMove = Console.ReadLine();
                var i          = int.Parse(playerMove);
                board[i] = Opponent.PLAYER;

                if (Opponent.IsBoardInTerminalState(board))
                {
                    break;
                }

                var opponentMove = Opponent.NextMove(board, true);
                board[opponentMove] = Opponent.OPPONENT;
            }

            PrintBoard(board);

            /*var repository = new BoardRepository("board.txt");
             * var controller = new GameController(repository);
             *
             * Console.WriteLine(GameView.PrintBoard(controller.Reset()));
             * Console.ReadLine();
             * var board = GameView.PrintBoard(controller.Move(1, 1));
             * Console.WriteLine(board);*/
        }