1
0
mirror of https://github.com/danbee/scoreboard synced 2025-03-04 08:59:11 +00:00
scoreboard/lib/player.rb
2015-05-08 18:02:45 +01:00

33 lines
395 B
Ruby

class Player
attr_reader :score, :games
def initialize
@score = 0
@games = 0
end
def has_beaten(player)
@score > 10 && @score > player.score + 1
end
def add_point
@score += 1
end
def add_game
@games += 1
end
def undo_point
@score -= 1
end
def reset_score
@score = 0
end
def attributes
{ score: @score, games: @games }
end
end