Last active
August 29, 2015 06:28
-
-
Save iannguyen/07b0336a79ddc9d1fc22 to your computer and use it in GitHub Desktop.
Recursive goodness
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 reveal(pos) | |
tile = self[*pos] | |
return if tile.revealed | |
tile.revealed = true | |
if tile.value == 0 | |
adjacent_squares(pos).each do |square| | |
neighbor_tile = self[*square] | |
reveal(square) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment