Skip to content

Instantly share code, notes, and snippets.

@Raagh
Created April 14, 2020 18:27
Show Gist options
  • Save Raagh/6b30c080c4644404bc8edc2cc25acea4 to your computer and use it in GitHub Desktop.
Save Raagh/6b30c080c4644404bc8edc2cc25acea4 to your computer and use it in GitHub Desktop.
Functional Snake Game - Part 2 - nextApple
const nextApple = r.curry((cols, rows, state) =>
willEat(r.head(state.snake), state.apple)
? { ...state, apple: point(randomPos(cols), randomPos(rows)) }
: state
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment