Drawing cards.
This commit is contained in:
parent
edfe4740b8
commit
1be8c6ba58
@ -0,0 +1 @@
|
||||
I represent a deck of cards. The terminology was taken from [Glossary of card game terms](https://en.wikipedia.org/wiki/Glossary_of_card_game_terms) in Wikipedia.
|
6
RoloLudo.package/DeckOfCards.class/instance/draw.st
Normal file
6
RoloLudo.package/DeckOfCards.class/instance/draw.st
Normal file
@ -0,0 +1,6 @@
|
||||
accessing
|
||||
draw
|
||||
| taken |
|
||||
taken := self stock atRandom.
|
||||
self drawn add: taken.
|
||||
^ taken
|
3
RoloLudo.package/DeckOfCards.class/instance/drawn.st
Normal file
3
RoloLudo.package/DeckOfCards.class/instance/drawn.st
Normal file
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
drawn
|
||||
^ drawn ifNil: [drawn := OrderedCollection new]
|
3
RoloLudo.package/DeckOfCards.class/instance/stock.st
Normal file
3
RoloLudo.package/DeckOfCards.class/instance/stock.st
Normal file
@ -0,0 +1,3 @@
|
||||
accessing
|
||||
stock
|
||||
^ stock := self cards copyWithoutAll: self drawn
|
@ -1,12 +1,14 @@
|
||||
{
|
||||
"commentStamp" : "",
|
||||
"commentStamp" : "<historical>",
|
||||
"super" : "Object",
|
||||
"category" : "RoloLudo",
|
||||
"classinstvars" : [ ],
|
||||
"pools" : [ ],
|
||||
"classvars" : [ ],
|
||||
"instvars" : [
|
||||
"cards"
|
||||
"cards",
|
||||
"drawn",
|
||||
"stock"
|
||||
],
|
||||
"name" : "DeckOfCards",
|
||||
"type" : "normal"
|
||||
|
Loading…
Reference in New Issue
Block a user