-
-
Save bakineggs/36338 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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