Created
September 28, 2019 01:00
-
-
Save colinjfw/da7041be7eeb98e2c851e2951ebed3af 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
def move(state) | |
head = state[:you][:body][0] | |
moves = ['up', 'down', 'left', 'right'] | |
moves.each do |move| | |
coord = move_as_coord(move, head) | |
unless off_board(state, coord) | |
return { move: move } | |
end | |
end | |
{ move: 'up' } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment