Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require_relative 'scrabble'
- require 'pry'
- class Player
- attr_reader :name
- attr_accessor :plays, :total_score
- def initialize(name)
- @name = name
- @plays = []
- @total_score = 0
- end
- def play(word)
- plays << word
- score = word_score(word)
- @total_score += score
- score
- end
- def word_score(word)
- Scrabble.new.score(word)
- end
- def won?
- total_score >= 100
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement