Module: Codebreaker::Score

Included in:
Game
Defined in:
lib/codebreaker/modules/score.rb

Instance Method Summary collapse

Instance Method Details

#save_score?Boolean

Returns:

  • (Boolean)


9
10
11
12
13
# File 'lib/codebreaker/modules/score.rb', line 9

def save_score?
  puts 'Do you want to save your score in score file?(y/n)'
  save_score_file if @player.agree?
  exit
end

#scoreObject



3
4
5
6
7
# File 'lib/codebreaker/modules/score.rb', line 3

def score
  @player.score += 250 if win?
  @player.score += @hint * 100 + @attempts * 50
  puts "#{player.name}, your score: #{@player.score}!"
end