Sha256: 231f50b51889b599de42e7ffd90c390f2cf1f1e16145e3846bd5f2de2e7279d4
Contents?: true
Size: 553 Bytes
Versions: 1
Compression:
Stored size: 553 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 File.open("lib/codebreaker/score/#{@player.name}_score.txt", '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.1 | lib/codebreaker/modules/score.rb |