Skip to content

Instantly share code, notes, and snippets.

@steveklabnik
Created December 5, 2011 04:17
Embed
What would you like to do?
Anti-if abuse, haha!
def frames
Enumerator.new do |yielder|
position = 0
10.times do
yielder << rolls[position,3].map(&:to_i)
position += next_position(rolls[position])
end
end
end
def next_position(index)
n = Hash.new(2)
n[10] = 1
n[index]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment