Пример #1
0
        private static void Main(string[] args)
        {
            var gameStateEngine = new GameStateEngine(new ConsoleDisplay());
            var gameState       = gameStateEngine.Start();

            while (!gameState.Quit)
            {
                var command = gameStateEngine.RequestCommand();
                gameStateEngine.Instruct(gameState, command);
            }
            Console.WriteLine("Goodbye!");
            Thread.Sleep(3000);
        }
Пример #2
0
        public void Given_ValidMoves_GameStateProgresses()
        {
            var gameState = _gameStateEngine.Start();

            Assert.IsTrue(gameState.Player1Turn);
            _gameStateEngine.Instruct(gameState, "4");
            Assert.IsFalse(gameState.Player1Turn);
            _gameStateEngine.Instruct(gameState, "7");

            Assert.IsTrue(gameState.GameNotation == "0123X56O8");

            Assert.IsTrue(gameState.Player1Turn);
            _gameStateEngine.Instruct(gameState, "0");
            Assert.IsFalse(gameState.Player1Turn);
            _gameStateEngine.Instruct(gameState, "8");

            Assert.IsTrue(gameState.GameNotation == "X123X56OO");
        }