home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
507.lha
/
Spades_v1.20
/
Spades.readme
< prev
next >
Wrap
Text File
|
1991-05-02
|
9KB
|
155 lines
Spades Version 1.20, by Greg Stelmack, April 5, 1991
"Spades" is a program written to play the card game Spades. It may be
run from the CLI or the Workbench. The files required to play are "Spades"
and "Spades.images", and both must be in the same directory.
This is a one player version of Spades -- you play one hand, and the
computer plays your partner and two opponents. The program plays by the
following rules adopted by my friends and I here at the University of South
Florida:
1) Four players are found, divided into two partnerships of two
players each. Partners sit opposite each other.
2) A dealer is randomly picked. Each player receives 13 cards from a
standard 52-card deck dealt clockwise starting with the player on the
dealer's left. On successive hands, the deal passes to the left.
3) Starting to the left of the dealer, each player bids the number of
tricks he feels his hand can take. Bidding passes clockwise. A
partnership's bid is the total of the two partners' bids. A partnership
must take this total number of tricks.
4) Play starts with the player to the left of the dealer and passes
clockwise. The only rule about leading is that spades may not be lead until
spades have been broken (i.e., played during a hand), unless a player holds
only spades.
5) Players must follow suit -- if you have a card of the suit lead,
you must play it. Otherwise, any suit may be played. Play ends with the
player to the right of the leader. In other words, each player plays one
card.
6) Highest card of the suit lead, or highest spade if a spade has been
played, wins the trick. Cards rank 2 lowest through Ace highest. The trick
winner scores one trick for his partnership and then leads for the next
trick.
7) After all 13 tricks in a hand have been taken, scores are totaled.
If a partnership takes at least as many tricks as they bid, they get 10
points for each trick they bid and one point for each trick they took over
their bid. If a partnership fails to take the number of tricks they bid,
they lose 10 points for each trick they bid. Negative scores are possible.
8) Deal passes to the left for another hand. First team to 500, or the
team with the highest score if both cross 500, wins.
When the program is first started, the computer will randomly deal out
cards to each player until the Ace of Spades is dealt. This player becomes
the dealer. The computer will then deal the cards. You will see your hand
at the bottom of the screen. Your partner sits across from you (at the top
of the screen), and your opponents are to either side of you. The computer
players will bid automatically. Their bids will appear as numbers in front
of the positions at which they are sitting.
When it is your turn to bid, a black bid box will appear in the lower
right-hand corner of the screen. Use the left mouse button to select your
bid. Clicking on the plus sign will raise your bid one trick. Clicking on
the minus sign will lower your bid one trick. Clicking on OK will accept
your bid. Clicking the right mouse button will cause the computer to
suggest a bid for you.
After all bids have been entered, the computer will pause for you to
examine the bids. When you are ready to play, click any mouse button.
Cards will then be played. Cards played by a computer player will
appear in the appropriate position on the screen. When it is your turn to
play, the computer will prompt you. Simply point at the card you want to
play and click the left mouse button. Again, clicking the right mouse
button will cause the computer to suggest a card for you to play (it will
mark it with an asterisk).
Note that the computer will not let you play an illegal card. If
nothing happens when you click, you are either trying to lead spades before
they have been broken or you are not following the lead suit when you can.
After all cards in the trick have been played, the computer will place
an asterisk in front of the winning card and update the trick count. If
this was also the last trick in the hand, it will update the scores. It
will then pause for you to look at all the cards that were played. When you
are ready to continue, click any mouse button.
This cycle will continue until a winner is found. The program will
then display a final score screen and ask whether or not you would like to
play again. Clicking YES will cause the game to start over. Clicking NO
will bring you back to the environment you started the game from. Note that
the game may be quit at any time by clicking the window close box at the
upper left of all game windows.
There is also a HIDE gadget in the Window TitleBar. If you click this,
the Spades screen and window are moved to the background, allowing you to
do something else without exiting Spades. It can be brought to the front
by normal Intuition means (cycling screens to the background) or by your
favorite screen management utility. No busy-waits, so it shouldn't slow
your multi-tasking down...
For Programmers:
The source code should be included with the program. The game is
written in C and compiled using SAS/C 5.10. I hope that anyone out there
interested in designing their own card games will find this code useful.
Note that the "Spades.images" file contains all the data necessary to draw
the cards. The reader routine is in the procedure "main". Feel free to use
any or all of the code or images in your own programs. The current version
was compiled with the following command:
LC -ma -rr -O -cf -cs -E -q10e -q10w -ms -PSpades Spades.c
(Well, actually I now use the workbench interface, but this is the
equivalent command line...)
Copyright Notice:
This program is copyright 1990 by Gregory M. Stelmack. However, I give
permission for anyone to freely distribute this program as long as this
file and the by-line in the title bar of the game remains, and they make no
profit from its distribution. Also, you may use any of the code for your
own programs, but please remember to give credit where credit is due. I
cannot be held responsible for damage that occurs as a result of the
use/misuse of this program, but note that I have made every effort to make
sure it will work properly.
If you find problems, useful enhancements, new rules I may want to
include, or if you would like to send a donation (say $5) to cover my costs
(computer, compiler, tools, etc.), my address is:
Gregory M. Stelmack
USF Box 1510
Tampa, FL 33620-1510
Feel free to send any comments or suggestions to the above address.
E-mail to: stelmack@sol.csee.usf.edu
BBS: Simply Amazing! (813)977-3940 in Tampa: GREG STELMACK
TBAG I (813)977-0941 in Tampa: GREG STELMACK
VERSION CHANGES:
Changes 1.0 to 1.1:
Removed need for Spades.font. Card data is now stored in
Spades.images, and this file is read in at run-time.
Added title graphics.
Added routine for choosing dealer.
First release version.
Changes 1.1 to 1.11:
Corrected a memory allocation and fragmentation bug. The program was
only freeing a portion of its allocated memory. It now frees all of it.
Thanks to Juan Orlandini for catching this.
Added a few prompts for mouse clicks where the program used to just
pause.
Changes 1.11 to 1.12:
Changed the LIBRARY_VERSION in the OpenLibrary() calls to zero. This
is an attempt to let the program run under pre-1.3 Workbench, but I make no
guarantees.
Changes 1.12 to 1.20:
Some of the strategy and bidding routines have been slightly modified.
Hopefully the computer plays a little better now, but there is room for a
little more improvement. Maybe I'll have some time this Summer...
Added a HIDE gadget in the Window TitleBar. Allows Spades to move to
the background so you can do something else if you get bored :-).
FUTURE ENHANCEMENTS PLANNED (time permitting, of course):
Zero-Point rule: I don't like it, but others do. Allows you to bid
zero, and get 100 points if you do (and lose 100 if you don't). And you get
to exchange three cards with your partner. If you bid zero before looking
at your cards, you get (or lose) 200.
Ten-Point rule: If you get 10 points or more in Overtricks, you lose
100 points.
Strategy: Computer still occasionally does something dumb, mostly
because it has difficulty looking into the future and predicting who is out
of what. I need to make it smarter. And, if I add the above rules, I need
to teach it how not to take tricks, and how to know when to take a trick
and when to throw it. Also, it bids poorly (too low) with lots of Spades in
its hand.