diff --git a/RoloLudo.package/DeckOfCards.class/instance/printOn..st b/RoloLudo.package/DeckOfCards.class/instance/printOn..st index 79e0aec..df41ea2 100644 --- a/RoloLudo.package/DeckOfCards.class/instance/printOn..st +++ b/RoloLudo.package/DeckOfCards.class/instance/printOn..st @@ -1,4 +1,9 @@ accessing printOn: aStream super initialize. - ^ aStream nextPutAll: self cards printString \ No newline at end of file + self class suits keysDo: [ :suit | + aStream + nextPutAll: (self stockCardsInSuit: suit); + nextPutAll: String cr. + ]. + ^ aStream contents. \ No newline at end of file diff --git a/RoloLudo.package/DeckOfCards.class/instance/stockCardsInSuit..st b/RoloLudo.package/DeckOfCards.class/instance/stockCardsInSuit..st new file mode 100644 index 0000000..628eabd --- /dev/null +++ b/RoloLudo.package/DeckOfCards.class/instance/stockCardsInSuit..st @@ -0,0 +1,7 @@ +accessing +stockCardsInSuit: aString + | response suitCards | + response := '' writeStream. + suitCards := self stock select: [ :card | card endsWith: aString ]. + suitCards do: [ :card | response nextPutAll: card ]. + ^ response contents \ No newline at end of file diff --git a/RoloLudo.package/DeckOfCards.class/instance/uiCardsFor..st b/RoloLudo.package/DeckOfCards.class/instance/uiCardsFor..st new file mode 100644 index 0000000..7f452cc --- /dev/null +++ b/RoloLudo.package/DeckOfCards.class/instance/uiCardsFor..st @@ -0,0 +1,6 @@ +accessing +uiCardsFor: aView + + ^ aView text + title: 'Cards'; + text: [ self printString ] \ No newline at end of file