Séparé les classes dans des fichiers
This commit is contained in:
1 parent
df544cdd49
commit
8a1e56e85e
7 files changed
+212
-202
No files matched your search
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env 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
|
||||
|
||||
Reference in new issue
Block a user