Reseting and restarting a game.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-11-26 13:06:04 -05:00
parent 5feee250e4
commit 7772524569
4 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,3 @@
accessing
cards: aCollection
cards := aCollection

View File

@ -0,0 +1,3 @@
accessing
draw: aCollection
drawn := aCollection

View File

@ -1,9 +1,12 @@
accessing
printOn: aStream
super initialize.
aStream nextPutAll: 'Stock: ', String cr.
self class suits keysDo: [ :suit |
aStream
nextPutAll: (self stockCardsInSuit: suit);
nextPutAll: String cr.
].
aStream nextPutAll: 'Drawn: ', String cr.
self drawn do: [:card | aStream nextPutAll: card, ' ' ].
^ aStream contents.

View File

@ -0,0 +1,5 @@
accessing
reset
self draw: OrderedCollection new.
self cards: self class initialize cards.
^ self