Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. class Card
  2.  
  3. attr_reader :suit, :value
  4. def initialize(suit, value)
  5. @suit = suit
  6. @value = value
  7. #the value here is what the card should return-facevalue
  8. end
  9.  
  10. def value
  11. return 10 if ["J", "Q", "K"].include?(@value)
  12. return 11 if @value == "A"
  13. return @value
  14. end
  15.  
  16. def to_s
  17. "A-diamonds"
  18. "#{@value}-#{suit}"
  19. end
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement