83938 packages online


No screenshot available
Short:a card game
Author:stelmack at (Greg Stelmack)
Uploader:sgberg charon bloomington in us (Stefan G Berg)
Download: - View contents

Spades Version 2.12, by Greg Stelmack, April 2, 1992.

*** NOTE: Address change near bottom from version 1.2 documentation ***
*** ALSO NOTE: System Software 2.xx is now REQUIRED to run Spades   ***

     "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. NOTE: Spades
now requires AmigaDOS 2.xx to run. This is because Spades is essentially
a tool for me to learn Amiga programming (I have made only $5 off of it),
and I am trying out some of the 2.xx stuff as I modify it.
     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
     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
     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
     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. If NIL bids are in effect, and
a player bid zero tricks and took zero, his side scores 100 points. If a
player bid zero and took at least one trick, his side loses 100 points. If
Bags are in effect, and a team has accumulated 10 or more overtricks, they
lose 100 points. 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. Selecting the Suggest option from the Game menu (or typing Right-
Amiga-s on the keyboard) 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 the left 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, selecting Suggest from the
Game menu 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 the left 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 selecting Quit from the Project menu.

     There are now several menus with the game. Under the Project menu,
there are New Game (start a new game), Save Hand (more in a minute),
Print Hand (not yet implemented), About (shows some information about
myself), and Quit (exit the game). Under the Game menu, there are NIL Bids
(toggles the NIL rule on and off -- the rule is in effect when checked),
Bags (toggles the Bags rule on and off -- the rule is in effect when
checked), and Suggest (suggest a bid or play as listed above). New options
may be added here later.
     The Save Hand menu option is a toggle. As long as it is checked, each
hand will be appended to the file "" in the current directory.
This option has been added for two reasons: so you can review hands later,
and so that you can send me this file with a hand you think the computer
goofed up on. If you see a mistake, turn this option on, and then mail or
E-Mail me a copy of that file, along with the play you feel the computer
should have made and why. I will use this to help enhance the computer
players. NOTE: If you leave this option on, the file can get
quite large. Remember to clean it up from time to time. Spades creates this
file if it doesn't exist, so don't worry about keeping a copy around.

For Programmers:
     The source code should be included with the program. The game is
written in C and compiled using SAS/C 5.10b. 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 "OpenAll". 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 for each source file:
     LC -ma -rr -O -cf -cs -E -Li -q10e -q10w -ms -N SourceFile.c
and then all were linked together into the Spades executable (Well,
actually I now use the Workbench interface, but this is the equivalent
command line for the options I used...)
     The program (as of version 2.10) has been broken up into several
source files. Since I use the Workbench interface for SAS/C, I do not have
a Makefile for it, but I have included the SASCOPTS file that I use for

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 (cost of media may be charged -- this is an
implicit OK for Fred Fish to put Spades in his collection). 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 or 10 dollars) to
cover my costs (computer, compiler, tools, education, etc.), my address is:
                   Gregory M. Stelmack
                   8723 Del Rey Ct. #11-A
                   Tampa, FL 33617
Feel free to send any comments or suggestions to the above address.
E-mail to: stelmack at
BBS: Simply Amazing! (813)977-3940 in Tampa: GREG STELMACK


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

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

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 :).

Changes 1.20 to 2.00:
     New images! Now the face cards and aces look like real face cards and
aces :).
     New user-interface. Menus have been added to support the optional
rules (see below). Errors now bring up requestors, which allowed the
removal of stdio. Unfortunately, I use EasyRequest() from V36 of the
Intuition library, so you now need AmigaDOS 2.xx to use Spades :(. Window
is now a backdrop window, and the screen's titlebar is visible, meaning
the screen may be shoved to the back or dragged like any other Intuition
     The rules for NIL bids and Bags have been added. Brief explanation:
bids allow you to bid zero, and if you take no tricks gain 100 points. If
you take at least one trick, you lose 100 points. Bags refer to overtricks --
if your team accumulates 10 overtricks over a series of hands, you lose 100
points. Unfortunately, the computer players do not yet know about these
new rules. They are, however, optional, so they may be turned on and off at
will (the default is OFF).
     Removed the title graphics (no real added value, and the executable is
now MUCH smaller).

Changes 2.00 to 2.10:
     Broke the source code up into several files to make room for future
enhancements. Implemented the Save Hand menu option. More extensive use
of System 2.0 features, including use of GadTools for Menu creation and
layout. Improved the computer players to now take the optional rules into

Changes 2.10 to 2.11:
     I stupidly called EasyRequest() to display every error message,
including the one when Intuition can't be opened! I can't come up with a
good way of doing this short of going back to standard I/O, or including
lots of code for this one case, so for right now the program will just
quietly closed if Intuition cannot be opened. This generally happens when
Spades is run under 1.3, which it no longer will.

Changes 2.11 to 2.12:
     If a game was started by selecting "New Game" from the menu, it was
impossible to exit the game from the final screen. Selecting the "NO"
button would just restart Spades. I still don't know why this happened
(tracing seemed to show a random jump into my ReadMouse() routine), but
I redid the logic (FinishRoutine() now directly calls WrapUp(), and the
AllDone flag has been eliminated) and it works properly now.

FUTURE ENHANCEMENTS PLANNED (time permitting, of course):
     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. Also, it bids poorly (too low) with
lots of Spades in its hand.
     Options: Implement the Print Hand option (although you could just
print the file.
     1.3 version: If enough people ask for it...

Contents of game/board/Spades.lha
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic]                  344     900  38.2% -lh5- f4e3 Jul 21  1992
[generic]                   37      37 100.0% -lh0- cd09 Dec  9  1991 Spades/.info
[generic]                  297     722  41.1% -lh5- 12d2 Feb  3  1992 Spades/IFF/2c.iff
[generic]                  292     800  36.5% -lh5- 1725 Feb  3  1992 Spades/IFF/2d.iff
[generic]                  308     788  39.1% -lh5- 6482 Feb  3  1992 Spades/IFF/2h.iff
[generic]                  305     730  41.8% -lh5- 5f63 Feb  3  1992 Spades/IFF/2s.iff
[generic]                  321     750  42.8% -lh5- f4f0 Feb  3  1992 Spades/IFF/3c.iff
[generic]                  309     850  36.4% -lh5- 8ee3 Feb  3  1992 Spades/IFF/3d.iff
[generic]                  323     834  38.7% -lh5- b625 Feb  3  1992 Spades/IFF/3h.iff
[generic]                  341     758  45.0% -lh5- a084 Feb  3  1992 Spades/IFF/3s.iff
[generic]                  314     714  44.0% -lh5- 04ce Feb  3  1992 Spades/IFF/4c.iff
[generic]                  315     800  39.4% -lh5- bb11 Feb  3  1992 Spades/IFF/4d.iff
[generic]                  339     788  43.0% -lh5- 50c1 Feb  3  1992 Spades/IFF/4h.iff
[generic]                  330     716  46.1% -lh5- c3d3 Feb  3  1992 Spades/IFF/4s.iff
[generic]                  334     736  45.4% -lh5- 5d5c Feb  3  1992 Spades/IFF/5c.iff
[generic]                  330     842  39.2% -lh5- 6dad Feb  3  1992 Spades/IFF/5d.iff
[generic]                  361     824  43.8% -lh5- 236a Feb  3  1992 Spades/IFF/5h.iff
[generic]                  358     744  48.1% -lh5- 89fc Feb  3  1992 Spades/IFF/5s.iff
[generic]                  334     730  45.8% -lh5- f332 Feb  3  1992 Spades/IFF/6c.iff
[generic]                  317     852  37.2% -lh5- d13d Feb  3  1992 Spades/IFF/6d.iff
[generic]                  353     834  42.3% -lh5- ee17 Feb  3  1992 Spades/IFF/6h.iff
[generic]                  353     732  48.2% -lh5- 965b Feb  3  1992 Spades/IFF/6s.iff
[generic]                  356     740  48.1% -lh5- 24ee Feb  3  1992 Spades/IFF/7c.iff
[generic]                  346     872  39.7% -lh5- 9b46 Feb  3  1992 Spades/IFF/7d.iff
[generic]                  384     858  44.8% -lh5- 53d5 Feb  3  1992 Spades/IFF/7h.iff
[generic]                  386     744  51.9% -lh5- 5dc0 Feb  3  1992 Spades/IFF/7s.iff
[generic]                  356     744  47.8% -lh5- 810b Feb  3  1992 Spades/IFF/8c.iff
[generic]                  334     880  38.0% -lh5- 7e80 Feb  3  1992 Spades/IFF/8d.iff
[generic]                  367     872  42.1% -lh5- 66e4 Feb  3  1992 Spades/IFF/8h.iff
[generic]                  377     744  50.7% -lh5- 2a0a Feb  3  1992 Spades/IFF/8s.iff
[generic]                  365     744  49.1% -lh5- eb70 Feb  3  1992 Spades/IFF/9c.iff
[generic]                  366     882  41.5% -lh5- aa56 Feb  3  1992 Spades/IFF/9d.iff
[generic]                  371     874  42.4% -lh5- 48e3 Feb  3  1992 Spades/IFF/9h.iff
[generic]                  400     746  53.6% -lh5- b5ad Feb  3  1992 Spades/IFF/9s.iff
[generic]                  343     956  35.9% -lh5- f275 Feb  3  1992 Spades/IFF/ac.iff
[generic]                  335     956  35.0% -lh5- 74d2 Feb  3  1992 Spades/IFF/ad.iff
[generic]                  348     956  36.4% -lh5- e957 Feb  3  1992 Spades/IFF/ah.iff
[generic]                  346     956  36.2% -lh5- c704 Feb  3  1992 Spades/IFF/as.iff
[generic]                  567     956  59.3% -lh5- eb8c Feb  3  1992 Spades/IFF/jc.iff
[generic]                  574     956  60.0% -lh5- 6c90 Feb  3  1992 Spades/IFF/jd.iff
[generic]                  593     956  62.0% -lh5- a835 Feb  3  1992 Spades/IFF/jh.iff
[generic]                  586     956  61.3% -lh5- 5fe5 Feb  3  1992 Spades/IFF/js.iff
[generic]                  539     956  56.4% -lh5- a1b6 Feb  3  1992 Spades/IFF/kc.iff
[generic]                  562     956  58.8% -lh5- e52f Feb  3  1992 Spades/IFF/kd.iff
[generic]                  569     956  59.5% -lh5- 6826 Feb  3  1992 Spades/IFF/kh.iff
[generic]                  565     956  59.1% -lh5- 5868 Feb  3  1992 Spades/IFF/ks.iff
[generic]                  577     956  60.4% -lh5- eae6 Feb  3  1992 Spades/IFF/qc.iff
[generic]                  584     956  61.1% -lh5- 4913 Feb  3  1992 Spades/IFF/qd.iff
[generic]                  592     956  61.9% -lh5- 9a67 Feb  3  1992 Spades/IFF/qh.iff
[generic]                  585     956  61.2% -lh5- 4106 Feb  3  1992 Spades/IFF/qs.iff
[generic]                  382     744  51.3% -lh5- a8c0 Feb  3  1992 Spades/IFF/tc.iff
[generic]                  390     882  44.2% -lh5- 6287 Feb  3  1992 Spades/IFF/td.iff
[generic]                  411     874  47.0% -lh5- f5e8 Feb  3  1992 Spades/IFF/th.iff
[generic]                  422     748  56.4% -lh5- 116f Feb  3  1992 Spades/IFF/ts.iff
[generic]                 1387    4258  32.6% -lh5- 706a Feb  1  1992 Spades/Source/Bidding.c
[generic]                 1397    7028  19.9% -lh5- c6f7 Feb  2  1992 Spades/Source/Files.c
[generic]                 1361    4103  33.2% -lh5- 476a Feb  2  1992 Spades/Source/Globals.h
[generic]                 1014    4600  22.0% -lh5- dcfa Jan 30  1992 Spades/Source/Graphics.c
[generic]                  534    1539  34.7% -lh5- 73c5 Apr  2  1992 Spades/Source/Graphics.h
[generic]                  521    1263  41.3% -lh5- a177 Apr  2  1992 Spades/Source/Include.h
[generic]                 3271   12232  26.7% -lh5- 3dbb Apr  2  1992 Spades/Source/Input.c
[generic]                 3905   16737  23.3% -lh5- 66d8 Feb  3  1992 Spades/Source/Play.c
[generic]                   54      54 100.0% -lh0- e2a0 Apr  2  1992 Spades/Source/SASCOPTS
[generic]                 4310   14538  29.6% -lh5- f81f Apr  2  1992 Spades/Source/Spades.c
[generic]                  402     993  40.5% -lh5- ada1 Feb  2  1992 Spades/Source/Spades.proto
[generic]                 8811   16844  52.3% -lh5- 4cd9 Apr  2  1992 Spades/Spades
[generic]                10050   39312  25.6% -lh5- c244 Feb  3  1992 Spades/Spades.images
[generic]                  225    1306  17.2% -lh5- e23d Apr  7  1991 Spades/
[generic]                 5401   12618  42.8% -lh5- 079c Apr  2  1992 Spades/Spades.readme
[generic]                  331     849  39.0% -lh5- dac9 Mar 17  1992 Spades/
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total        70 files   64167  182999  35.1%            Dec  9  1992

Aminet © 1992-2022 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>