Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment