Sha256: 566f80e162222419869791a91d3bd9f589e640fb371db6b3d9e70d823e24df8e

Contents?: true

Size: 704 Bytes

Versions: 7

Compression:

Stored size: 704 Bytes

Contents

module JustGo
  # = PlayerStat
  # 
  # Place to store a players statistics
  class PlayerStat
    def initialize(player_number: , prisoner_count: 0, passed: false)
      @player_number = player_number
      @prisoner_count = prisoner_count
      @passed = passed
    end

    attr_reader :player_number
    attr_reader :prisoner_count
    attr_reader :passed

    def as_json
      {
        player_number: player_number,
        prisoner_count: prisoner_count,
        passed: passed
      }
    end

    def mark_as_passed 
      @passed = true
    end

    def mark_as_continuing 
      @passed = false
    end

    def add_to_prisoner_count(number)
      @prisoner_count += number
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
just_go-0.1.10 lib/just_go/player_stat.rb
just_go-0.1.9 lib/just_go/player_stat.rb
just_go-0.1.8 lib/just_go/player_stat.rb
just_go-0.1.7 lib/just_go/player_stat.rb
just_go-0.1.6 lib/just_go/player_stat.rb
just_go-0.1.5 lib/just_go/player_stat.rb
just_go-0.1.4 lib/just_go/player_stat.rb