Skip to content

Instantly share code, notes, and snippets.

@AJFaraday
Last active April 8, 2020 13:39
Show Gist options
  • Save AJFaraday/d319b140f0c946bdc2913ed5799cf58b to your computer and use it in GitHub Desktop.
Save AJFaraday/d319b140f0c946bdc2913ed5799cf58b to your computer and use it in GitHub Desktop.
Easter Bunny challenge
Easter Bunny Hunting:
setup
A square grid 99 x 99
4 egg hunters, one at each corner.
Easter bunny in the middle (it has 100 eggs)
Hunters:
They are run by an array of functions
[
# NW
function(api, my_storage, shared_storage) {
},
# NE
function(api, my_storage, shared_storage) {
},
# SE
function(api, my_storage, shared_storage) {
},
# SW
function(api, my_storage, shared_storage) {
}
]
api.north()
api.east()
api.south()
api.west()
# Most recently called moves
# If not called, no move
api.turn()
api.hunters = [
{
x: int,
y: int,
me: boolean
},
...
]
api.bunny = {
x: int,
y: int,
eggs_left: 100
}
api.eggs = [
{
x: int, y: int
},
...
]
my_storage = {}
shared_storage = {}
Turn structure:
* run the 4 functions in turn, if NESW called take one step
* If stepped on to egg, gain point.
* If caught the bunny, gain 10 points.
Bunny movement rules:
* x_target is x + (hunters_above - hunters_below)
* y_target is y + (hunters_left - hunters_right)
* if x_target/y_target is not current location...
* * leave egg on current position (if current position doesn't already have an egg)
* * reduce eggs remaining
* * Bunny hop to target
* If out of bounds, end game
* If 0 eggs left, end game
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment