Anonymous user
Playing cards: Difference between revisions
→{{header|Smalltalk}}
(Pari/GP) |
|||
Line 1,634:
!Card class methods!
initialize
suits ifNil: [ suits :=
pips ifNil: [ pips :=
!
new
Line 1,661:
!Card methods!
initWithPip: aPip andSuit: aSuit
( (pips includes:
(suits includes:
ifTrue: [
thePip :=
theSuit :=
] ifFalse: [ 'Unknown pip or suit' displayOn: stderr .
Character nl displayOn: stderr ].
Line 1,674:
!
display
!
displayNl
Line 1,699:
init
deck := OrderedCollection new.
deck add: (Card new: { pip . suit })
]
Line 1,709:
!
shuffle
1 to:
|r2 o|
r2 :=
o :=
].
^self
|