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