Skip to content

Instantly share code, notes, and snippets.

@bakineggs
Forked from imownbey/hand.rb
Created December 16, 2008 05:46
Show Gist options
  • Select an option

  • Save bakineggs/36338 to your computer and use it in GitHub Desktop.

Select an option

Save bakineggs/36338 to your computer and use it in GitHub Desktop.
class Hand
def straight?
values = @cards.map{|card| card.value}.uniq.sort
values.unshift 1 if values.include?(14) # ace can be low
0.upto(values.length - 5) do |i|
return true if values[i] + 4 == values[i + 4]
end
false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment