main |
WarGame |
Player |
Deck |
Pile |
Card
Player
secret information
upon creation[need to know: a pile of cards]
- remember given pile as "supplyPile"
- make empty pile for "winningsPile"
playCard[answer is: a card]
- ask supplyPile to "countCards"
- if answer is 0 then tell winningsPile to "shuffle" and exchange piles
- ask supplyPile "getTopCard"
- answer with that card
countCards[answer is: a number]
- ask supplyPile to "countCards"
- ask winningsPile to "countCards"
- answer with sum of previous two answers
winCards[need to know: a pile]
- tell winningPile to "merge with given pile"
doVictoryDance
- climb up on desk, jump and spin around while shouting "I am the champion
of the world!"