Card suits and initialization finished.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-11-14 11:21:21 -05:00
parent 63c68c7232
commit edfe4740b8
4 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,3 @@
accessing
faceCards
^ #( $J $Q $K)
^ #( 'J' 'Q' 'K')

View File

@ -2,8 +2,9 @@ accessing
initialize
| response |
response := self new.
self suits do: [:suit |
self numeralCards do: [:number|
self suits keysDo: [:suit |
(self numeralCards, self faceCards) do: [:number|
response cards add: number asString, suit.
]
].
].
].
^ response

View File

@ -1,3 +1,3 @@
accessing
cards
^ cards
^ cards ifNil: [ cards := OrderedCollection new]

View File

@ -0,0 +1,4 @@
accessing
printOn: aStream
super initialize.
^ aStream nextPutAll: self cards printString