class SciolyFF::Interpreter::Placing::Raw

Models the raw score representation for a Placing

Public Class Methods

new(rep, low_score_wins) click to toggle source
# File lib/sciolyff/interpreter/raw.rb, line 6
def initialize(rep, low_score_wins)
  @rep = rep
  @low_score_wins = low_score_wins
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/sciolyff/interpreter/raw.rb, line 37
def <=>(other)
  [
    tier,
    @low_score_wins ? score : -score,
    tiebreaker_rank
  ] <=>
    [
      other.tier,
      @low_score_wins ? other.score : -other.score,
      other.tiebreaker_rank
    ]
end
==(other) click to toggle source
# File lib/sciolyff/interpreter/raw.rb, line 31
def ==(other)
  score == other.score &&
    tier == other.tier &&
    tiebreaker_rank == other.tiebreaker_rank
end
lost_tiebreaker?() click to toggle source
# File lib/sciolyff/interpreter/raw.rb, line 23
def lost_tiebreaker?
  tiebreaker_rank > 1
end
score() click to toggle source
# File lib/sciolyff/interpreter/raw.rb, line 11
def score
  @rep[:score]
end
tiebreaker_rank() click to toggle source
# File lib/sciolyff/interpreter/raw.rb, line 27
def tiebreaker_rank
  @rep[:'tiebreaker rank'] || 1
end
tier() click to toggle source
# File lib/sciolyff/interpreter/raw.rb, line 19
def tier
  @rep[:tier] || 1
end
tiered?() click to toggle source
# File lib/sciolyff/interpreter/raw.rb, line 15
def tiered?
  tier > 1
end