27 lines
301 B
Ruby
27 lines
301 B
Ruby
class Player
|
|
attr_reader :name, :hand, :score
|
|
|
|
def initialize(name)
|
|
@name = name
|
|
@hand = []
|
|
@score = 0
|
|
end
|
|
|
|
def receive(card)
|
|
@hand << card
|
|
end
|
|
|
|
def clear_hand
|
|
@hand.clear
|
|
end
|
|
|
|
def play(card)
|
|
@hand.delete(card)
|
|
end
|
|
|
|
def add_point
|
|
@score += 1
|
|
end
|
|
end
|
|
|