-
-
Save mukeshsolanki/a36287efdfed5223ce1e5bd8fd3bc20b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it.copy( | |
food = if (newPosition == it.food) Pair( | |
Random().nextInt(BOARD_SIZE), | |
Random().nextInt(BOARD_SIZE) | |
) else it.food, | |
snake = listOf(newPosition) + it.snake.take(snakeLength - 1), | |
currentDirection = currentDirection.value, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment