Beispiel #1
0
        public void WhenObstacleDownAIDoesNotChooseToMoveDownTest()
        {
            // arrange
            var map       = new Map(10, 10);
            var snakeBody = new List <SnakeElement>
            {
                new SnakeElement(2, map.Height - 1, DirectionOfMove.Right)
            };
            var snake    = new IntelligentSnake(snakeBody, new Display());
            var snakeBot = new SnakeBot(new SnakeAIModel(), new ModelInputHelper());

            // act
            var actual = snakeBot.ChooseDirection(snake, new Reward(new Display()), map);

            // assert
            Assert.AreNotEqual(actual, DirectionOfMove.Down);
        }
Beispiel #2
0
        public void WhenObstacleRightAndUpAIDoesNotChooseToMoveRightOrUpTest()
        {
            // arrange
            var map       = new Map(10, 10);
            var snakeBody = new List <SnakeElement>
            {
                new SnakeElement(map.Width - 1, 1, DirectionOfMove.Right)
            };
            var snake    = new IntelligentSnake(snakeBody, new Display());
            var snakeBot = new SnakeBot(new SnakeAIModel(), new ModelInputHelper());

            // act
            var actual = snakeBot.ChooseDirection(snake, new Reward(new Display()), map);

            // assert
            Assert.Multiple(() =>
            {
                Assert.AreNotEqual(actual, DirectionOfMove.Right);
                Assert.AreNotEqual(actual, DirectionOfMove.Up);
            });
        }