Sha256: bd7f52a134873f81e422a5e52adf922101f5fe11924a0474fe7174f3ef01be92
Contents?: true
Size: 1.07 KB
Versions: 5
Compression:
Stored size: 1.07 KB
Contents
module Githug class Game attr_accessor :profile def initialize @profile = Profile.load end def play_level solve = true if profile.level.nil? UI.puts("Welcome to Githug") solve = false level_bump else level = Level.load(profile.level) if solve && level if level.solve UI.success "Congratulations, you have solved the level" level_bump else UI.error "Sorry, this solution is not quite right!" profile.current_attempts += 1 profile.save if (profile.current_attempts > 2 && profile.current_attempts % 3 == 0) UI.error "Don't forget you can type `githug hint` for a hint and `githug reset` to reset the current level" end UI.puts level.full_description end end end end def level_bump profile.level_bump if level = Level.load(profile.level) UI.puts(level.full_description) level.setup_level end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
githug-0.1.4 | lib/githug/game.rb |
githug-0.1.3 | lib/githug/game.rb |
githug-0.1.2 | lib/githug/game.rb |
githug-0.1.1 | lib/githug/game.rb |
githug-0.1.0 | lib/githug/game.rb |