Sha256: a85c1548149e9ac09e6c06f656e394160573326ecb9c2a4e635ae0fa3776ac0f

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

module Gitscrub
  class Game

    attr_accessor :profile

    def initialize
      @profile = Profile.load
    end

    def play_level
      solve = true
      if profile.level == 0
        UI.puts("Welcome to Gitscrub")
        solve = false
        level_bump
      else
        level = Level.load(profile.level)
        if solve && level
          if level.solve  
            UI.puts "Congratulations, you have solved the level"
            level_bump
          else
            UI.puts "Sorry, this solution is not quite right!"
            UI.puts
            UI.puts level.ldescription
            UI.puts
          end
        end
      end
    end

    def level_bump
      profile.level += 1
      profile.save
      if level = Level.load(profile.level)
        UI.puts
        UI.puts(level.ldescription)
        UI.puts
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gitscrub-0.0.3 lib/gitscrub/game.rb