diff --git a/RoloLudo.package/DeckOfCards.class/README.md b/RoloLudo.package/DeckOfCards.class/README.md index e69de29..09049b0 100644 --- a/RoloLudo.package/DeckOfCards.class/README.md +++ b/RoloLudo.package/DeckOfCards.class/README.md @@ -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. diff --git a/RoloLudo.package/DeckOfCards.class/instance/draw.st b/RoloLudo.package/DeckOfCards.class/instance/draw.st new file mode 100644 index 0000000..279f882 --- /dev/null +++ b/RoloLudo.package/DeckOfCards.class/instance/draw.st @@ -0,0 +1,6 @@ +accessing +draw + | taken | + taken := self stock atRandom. + self drawn add: taken. + ^ taken \ No newline at end of file diff --git a/RoloLudo.package/DeckOfCards.class/instance/drawn.st b/RoloLudo.package/DeckOfCards.class/instance/drawn.st new file mode 100644 index 0000000..085f89d --- /dev/null +++ b/RoloLudo.package/DeckOfCards.class/instance/drawn.st @@ -0,0 +1,3 @@ +accessing +drawn + ^ drawn ifNil: [drawn := OrderedCollection new] \ No newline at end of file diff --git a/RoloLudo.package/DeckOfCards.class/instance/stock.st b/RoloLudo.package/DeckOfCards.class/instance/stock.st new file mode 100644 index 0000000..af992f2 --- /dev/null +++ b/RoloLudo.package/DeckOfCards.class/instance/stock.st @@ -0,0 +1,3 @@ +accessing +stock + ^ stock := self cards copyWithoutAll: self drawn \ No newline at end of file diff --git a/RoloLudo.package/DeckOfCards.class/properties.json b/RoloLudo.package/DeckOfCards.class/properties.json index c3f19aa..4b8fce1 100644 --- a/RoloLudo.package/DeckOfCards.class/properties.json +++ b/RoloLudo.package/DeckOfCards.class/properties.json @@ -1,12 +1,14 @@ { - "commentStamp" : "", + "commentStamp" : "", "super" : "Object", "category" : "RoloLudo", "classinstvars" : [ ], "pools" : [ ], "classvars" : [ ], "instvars" : [ - "cards" + "cards", + "drawn", + "stock" ], "name" : "DeckOfCards", "type" : "normal"