Beispiel #1
0
        static void Main(string[] args)
        {
            IConsole console = new GameConsole();

            IPlayer playerReal       = new PlayerReal(Marker.X, console);
            IPlayer playerUnbeatable = new PlayerUnbeatable(Marker.O);

            const int boardSize = 3;

            Game game = new Game(boardSize, playerReal, playerUnbeatable, console);

            game.GameLoop();
        }
        public void PlayerMakeMove()
        {
            IConsole     console = Substitute.For <IConsole>();
            const Marker marker  = Marker.X;

            PlayerReal player = new PlayerReal(marker, console);

            const int boardSize = 3;
            Board     board     = new Board(boardSize);

            console.ReadInput().Returns("1");

            Play play = player.Play(board);

            board.MarkBoard(play);

            Marker boardMarked = board.GetMarkAtPosition(0, 0);

            Assert.AreEqual(marker, boardMarked);
        }