Since my Mac mini crashed earlier this month, and I never got very far on my port of Super Pay Cards!, I've decided to try coding a crazy eights game in TNT Basic. I got the idea while playing an Atari BASIC crazy eights game on my old Atari 130XE. I intend to do a simple version of the game, for one player against the computer. Here's my preliminary pseudo-code:
global int stock ' number of cards in stock
global int discard ' number of cards in discard pile
global int humanhand ' number of cards in human player's hand
global int comphand ' number of cards in computer player's hand
Shuffle a standard 52-card deck.
Give the human player and the computer player seven cards each.
Display the human's cards but not those held by the computer.
After the deal, turn up the first card from the stock (initially 37 cards) to start the discard pile.
On his turn, the human player clicks on a card to discard it. The discard must match the top card of the discard pile in either rank or suit. Eights are wild and may be played on any card.
When a card is discarded, check its rank and suit.
When the human discards an eight, ask him to click on the icon for the desired suit.
When the computer discards an eight, display the icon for the next suit.
If a player cannot play, he must draw cards until he gets a playable card.
After one player has played a card, the other player takes control.
Keep track of the number of cards held by both the human and the computer.
When a card is drawn, subtract 1 from the number of cards in the stock. If the stock contains 0 cards, shuffle the discards into a new stock and turn up its top card for a new discard pile.
Until human's hand has 0 cards or computer's hand has 0 cards
The game ends when either player has no cards left.
If the computer has played all of its cards, the human has lost.
If the human has played all of his cards, he has won.
Offer to play another game.
Do I have this right? How difficult would this be to program in TNT Basic?
That seems like it would work from what I can piece together now, are you going to have a sort of ID number system for each card? Like 1-52 for each card in the deck, use that in arrays for the deck and hands, etc.
Yes, but since the program would have to identify each card by rank and suit, I plan to arrange the card face sprites in groups of the same rank, like this:
24-27: eights (the wild cards)
I would then use TNT Basic's "mod" function to determine the suit: say, 0=clubs, 1=diamonds, 2=hearts, 3=spades.