示例#1
0
        public static void Main(string[] args)
        {
            var naughts = new ConsolePlayer(new ConsoleInput());
            var crosses = new MiniMaxPlayer(naughts);
            var game = new TicTacToeGame(naughts, crosses);

            var printer = new GameBoardPrinter(game);
            Console.WriteLine("Welcome to Helen's TicTacToe game!");
            Console.WriteLine(printer.Board());

            while (!game.IsFinished)
            {
                Console.WriteLine("It's " + printer.NameForPlayer(game.CurrentPlayer) + "'s turn!");
                game.PlayTurn();

                Console.WriteLine(printer.Board());
            }

            Console.WriteLine("Game over!");
            Console.WriteLine(printer.WinnerMessage());
            Console.ReadLine();
        }
        public void ReadsValidTurnFromConsoleInput()
        {
            var player = new ConsolePlayer(new ConsoleInputStub("3,2"));

            Assert.That(player.PlayTurn(null), Is.EqualTo(new BoardPosition(3, 2)));
        }