public void ObstacleRightReturnsFalseTest() { // arrange var snakeBody = new List <SnakeElement> { new SnakeElement(3, 2, 0), new SnakeElement(2, 2, 0), }; var snake = new IntelligentSnake(snakeBody, new Display()); // act var actual = snake.ObstacleRight(); // assert Assert.False(actual); }
private IEnumerable <SnakeData> PrepareInputData(IntelligentSnake snake, Map map) { IEnumerable <SnakeData> data = new[] { new SnakeData { SuggestedDirection = 0, ObstacleUp = Convert.ToSingle(_modelInputHelper.ObstacleUp(snake, map) || snake.ObstacleUp()), ObstacleRight = Convert.ToSingle(_modelInputHelper.ObstacleRight(snake, map) || snake.ObstacleRight()), ObstacleDown = Convert.ToSingle(_modelInputHelper.ObstacleDown(snake, map) || snake.ObstacleDown()), ObstacleLeft = Convert.ToSingle(_modelInputHelper.ObstacleLeft(snake, map) || snake.ObstacleLeft()) }, new SnakeData { SuggestedDirection = 1, ObstacleUp = Convert.ToSingle(_modelInputHelper.ObstacleUp(snake, map) || snake.ObstacleUp()), ObstacleRight = Convert.ToSingle(_modelInputHelper.ObstacleRight(snake, map) || snake.ObstacleRight()), ObstacleDown = Convert.ToSingle(_modelInputHelper.ObstacleDown(snake, map) || snake.ObstacleDown()), ObstacleLeft = Convert.ToSingle(_modelInputHelper.ObstacleLeft(snake, map) || snake.ObstacleLeft()) }, new SnakeData { SuggestedDirection = 2, ObstacleUp = Convert.ToSingle(_modelInputHelper.ObstacleUp(snake, map) || snake.ObstacleUp()), ObstacleRight = Convert.ToSingle(_modelInputHelper.ObstacleRight(snake, map) || snake.ObstacleRight()), ObstacleDown = Convert.ToSingle(_modelInputHelper.ObstacleDown(snake, map) || snake.ObstacleDown()), ObstacleLeft = Convert.ToSingle(_modelInputHelper.ObstacleLeft(snake, map) || snake.ObstacleLeft()) }, new SnakeData { SuggestedDirection = 3, ObstacleUp = Convert.ToSingle(_modelInputHelper.ObstacleUp(snake, map) || snake.ObstacleUp()), ObstacleRight = Convert.ToSingle(_modelInputHelper.ObstacleRight(snake, map) || snake.ObstacleRight()), ObstacleDown = Convert.ToSingle(_modelInputHelper.ObstacleDown(snake, map) || snake.ObstacleDown()), ObstacleLeft = Convert.ToSingle(_modelInputHelper.ObstacleLeft(snake, map) || snake.ObstacleLeft()) } }; return(data); }