Sha256: d120d9f6d70abaa0181fc067c305a1e47e871bc552b3f8ca6fc3f5d489422e73
Contents?: true
Size: 589 Bytes
Versions: 1
Compression:
Stored size: 589 Bytes
Contents
module Codebreaker module Score def score @player.score += 250 if win? @player.score += @hint * 100 + @attempts * 50 puts "#{player.name}, your score: #{@player.score}!" end def save_score? puts 'Do you want to save your score in score file?(y/n)' save_score_file if @player.agree? exit end private def save_score_file path = File.expand_path("../../score/#{@player.name}_score.txt", __FILE__) File.open(path, 'a') do |file| file.puts "#{@player.score} - #{Time.now.asctime}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Codebreaker_RG2016-0.1.2 | lib/codebreaker/modules/score.rb |