Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. require_relative 'scrabble'
  2. require 'pry'
  3. class Player
  4. attr_reader :name
  5. attr_accessor :plays, :total_score
  6.  
  7. def initialize(name)
  8. @name = name
  9. @plays = []
  10. @total_score = 0
  11. end
  12.  
  13. def play(word)
  14. plays << word
  15. score = word_score(word)
  16. @total_score += score
  17. score
  18. end
  19.  
  20. def word_score(word)
  21. Scrabble.new.score(word)
  22. end
  23.  
  24. def won?
  25. total_score >= 100
  26. end
  27.  
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement