Reseting and restarting a game.
This commit is contained in:
parent
5feee250e4
commit
7772524569
3
RoloLudo.package/DeckOfCards.class/instance/cards..st
Normal file
3
RoloLudo.package/DeckOfCards.class/instance/cards..st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
cards: aCollection
|
||||||
|
cards := aCollection
|
3
RoloLudo.package/DeckOfCards.class/instance/draw..st
Normal file
3
RoloLudo.package/DeckOfCards.class/instance/draw..st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
draw: aCollection
|
||||||
|
drawn := aCollection
|
@ -1,9 +1,12 @@
|
|||||||
accessing
|
accessing
|
||||||
printOn: aStream
|
printOn: aStream
|
||||||
super initialize.
|
super initialize.
|
||||||
|
aStream nextPutAll: 'Stock: ', String cr.
|
||||||
self class suits keysDo: [ :suit |
|
self class suits keysDo: [ :suit |
|
||||||
aStream
|
aStream
|
||||||
nextPutAll: (self stockCardsInSuit: suit);
|
nextPutAll: (self stockCardsInSuit: suit);
|
||||||
nextPutAll: String cr.
|
nextPutAll: String cr.
|
||||||
].
|
].
|
||||||
|
aStream nextPutAll: 'Drawn: ', String cr.
|
||||||
|
self drawn do: [:card | aStream nextPutAll: card, ' ' ].
|
||||||
^ aStream contents.
|
^ aStream contents.
|
5
RoloLudo.package/DeckOfCards.class/instance/reset.st
Normal file
5
RoloLudo.package/DeckOfCards.class/instance/reset.st
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
accessing
|
||||||
|
reset
|
||||||
|
self draw: OrderedCollection new.
|
||||||
|
self cards: self class initialize cards.
|
||||||
|
^ self
|
Loading…
Reference in New Issue
Block a user