forums

TNT Basic Forums > Games In Progress
Now working on crazy eights
< Last Thread     Next Thread >
Author
Thread        Post A Reply

10-25-2010 00:04

Posted by:
JHVipond

Location:
South Dakota

Find more posts by JHVipond

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:

Variables
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

Initialization
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.

Control loop
Repeat
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

Termination
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?

11-10-2010 21:10

Posted by:
Yakkers

Find more posts by Yakkers

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.

11-11-2010 02:05

Posted by:
JHVipond

Location:
South Dakota

Find more posts by JHVipond

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:

0-3: deuces
4-7: threes
8-11: fours
12-15: fives
16-19: sixes
20-23: sevens
24-27: eights (the wild cards)
28-31: nines
32-35: tens
36-39: jacks
40-43: queens
44-47: kings
48-51: aces

I would then use TNT Basic's "mod" function to determine the suit: say, 0=clubs, 1=diamonds, 2=hearts, 3=spades.

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.