home *** CD-ROM | disk | FTP | other *** search
- FILE: RUMMY.DOC
- Rummy v1.00
-
- By Simon Preene
-
- Copyright Amiga Computing, 1990
-
- Contents
- Introduction
- Requirements
- Rules
- Scoring
- Screen Layout
- Use Of The Program (short tutorial)
- Modes Of Play
- Reference
- Description Of Source Code
-
-
- Introduction.
-
- This text file contains the instructions for and some notes on the
- operation of Rummy. The program is designed to play the card game of
- Rummy. I have played a number of variations of this game (variously
- called Rummy, Gin-Rummy, or Sets), but they all have the same basic
- objective: the collection of sets of cards which share some property. A
- more detailed description of the game rules is included in the Rules
- section below.
- To start the program either double-click on the rummy icon, or type
- rummy at the shell prompt.
-
- Requirements.
-
- The program consists of a single file on disk of about 80k in size,
- and this contains all graphics and data needed by the program. Once
- loaded the program appears to require about 160k. This is mainly used by
- the three plane 640*200 screen. Consequently there should be no problem
- running the game on an unexpanded A500.
-
- Rules.
-
- This section explains how to play the card game; using the program is
- explained below.
- The game is for either two or three players. A game consists of a
- number of rounds (or hands), the overall objective being to achieve a
- score lower than that of the other competitors (see scoring). The defualt
- number of rounds is seven, but this can be easily changed.
- At the start of each round, seven cards are dealt to each player
- taking part. The players take turns to go first (round 1 player 1,round
- player 2...). After dealing the top card of the pack is turned over to
- form what will be referred to as the face up pile of cards, and the
- remaining cards are placed to the left of this, face down, to form the
- face down pile.
- The objective in each round is for the players to get rid of
- all their cards by forming sets of three or more cards and submitting them,
- or by adding cards to sets which have already been submitted. Sets for
- submission must consist of 3,4,5,6, or 7 cards which share some common
- property, for example they may have the same number (such as 3diamonds,
- 3clubs, 3spades) (these are referred to as numsets in the coding), or
- they may be a run of cards of the same suit (e.g. 5clubs, 6clubs, 7clubs)
- (these are referred to as suitsets in the coding). For sets of the same
- suit the ace can come before the two or after the king.
- Cards to be added to an existing set must continue the progression of
- cards already in the set. For example 3c (c means clubs, etc for d,s,h)
- could be added to a set of 3d-3h-3s or 4c-5c-6c, but not to 5d-5s-5h
- or 4d-5d-6d. The following lists some other examples
-
- SET POSSIBLE ADDITIONS
-
- 1. jd-qd-kd 10d,ad
- 2. ad-ac-as ah
- 3. 2h-3h-4h-5h ah,6h
-
- It is possible to add more than one card at a time, so if a player
- had the 9d and 10d, then both could be added to the set 1 above. For sets
- of the same suit, cards can be added to either end. Any number of valid
- additions can be made to any number of sets while it is a players turn.
- However a player can only add or submit cards when it is his turn, and
- not when it is that of another player.
- If a player cannot get rid of all his cards when it is his turn then
- he has the option to exchange one of them for another card in one of the
- following ways :
-
- 1. Take the card on the current face up pile, and replace it with one of
- his own cards which is of no use;
- 2. Take the card on the current face down pile, and place one of
- his own cards which is of no use on the face up pile;
- 3. If after seeing the face down card it is thought to be of no use, he
- may place this on the face up pile.
-
- Any one of the above can be chosen, but after seeing the face down
- card it is only possible to take it in exchange for another, or put it
- directly on the face up pile: i.e. the face up card is no longer
- available.
- After one of these actions has been taken the player has a second
- opportunity to add or submit cards if this is possible.
- If the player still has cards left at the end of his turn, the next
- player then takes a turn and so on until one player has no cards left.
- When this happens, the players' scores are updated based on how many
- cards they have left and the round is over.
-
- Scoring.
-
- The scores are updated at the end of each round by adding the value
- of the cards held by the player together and adding that to his current
- score. For this purpose the cards are valued as one to thirteen for the
- cards ace,2,3,...,10,jack,queen,king. The player with the lowest score
- after all rounds have been played is the winner.
-
- Screen Layout
-
- In the top left corner of the screen are two piles of cards, the left
- of which is referred to as the face down pile, and the right the face up
- pile. When the program starts both are face down (showing the reverse of
- a card). During a game the right will show a card face. Just to the
- right of this is an area in which messages are displayed explaining what
- is happening, e.g. the next players name, what that player has done,
- whether operations completed successfully or not etc. There is also a
- gadget controlling the number of rounds in a game (see below for how to
- change this). The continue gadget also appears here.
- Below the two packs are the status areas for each of the three
- players. These consist of the cards the player is holding, which may be
- face up or down during a game, but are blank initially since no game is
- in progress. To the right of these are five pieces of information about
- each player. The player's name is in a red box; this is a gadget allowing
- the player's name to be changed. Other information is the value of the
- player's hand (not displayed if the player's cards are not on
- view), which is the amount which will be added to the score should that
- player lose before getting another turn. The number of wins that player
- has had, and the current score are also shown. The number of turns taken
- appear last. Player one's data is at the top, then player two, and
- finally player three.
- On the far right of the screen are the face up sets which have been
- submitted by the players. This area of the display is managed so that the
- display of sets does not overflow into the rest of the display. For this
- reason when new sets are submitted or additions made to existing sets,
- the order in which the sets appear may change.
-
- Use of the Program.
-
- This section describes an example game using the default settings.
- The program can be started from either the Workbench or the shell.
- From the shell, typing rummy executes the program.
- When the program starts it opens its own screen and displays some
- initial information together with a message inviting the user to "use menus
- to play". The menus are described in detail below, but for now use the
- project menu to select the play submenu, and then the Three player game.
- Seven cards will then be dealt to each of the three players. Those of
- player one (user) will be visible to you, those of Lisa and Mike will be
- face down. The face up pile will now have its top card overturned.
- It is initially your turn (user appears on line two, and the pointer has
- a 1 under it, signifying player one).
- The cards of your hand will be sorted into ascending order, by number
- within suit (see Reorder option below to change the display order). At
- this point, if you can identify a set of three or more cards in your
- hand, you may submit it now. To do this select each member of the
- set (it will then be complemented to grey). If you select a card
- which is not in the set, deselect it by clicking on it again with the
- mouse. Once each member of the set is selected, click on the "submit new
- set" gadget. At this point, if the selected cards form a valid set they
- will be removed from your hand and displayed as a "face up set" on the
- right side of the screen; if on the other hand they do not form a valid
- set the selected cards will remain your hand of cards, still selected. At
- this point you should check that
-
- 1. All selected cards form a SINGLE valid set
- 2. At least three cards are selected
-
- You may have selected a card which is not part of the set; if so deselect
- it and try again. As yet there will be no existing sets, so addition is
- not possible.
- After submitting any sets (or before if you like) if you have any
- cards left in your hand you must make an exchange, which is one of the
- three action detailed in the Rules section above. The methods are as
- follows:
-
- 1. To take the face up card: select it with the mouse so that it has a
- box around it; then select the card from your hand which you want to
- drop. The exchange then takes place.
- 2. To take the face down card or take no card: select facedown card and it will
- be turned face up. Then to take this card select the card you want to drop
- and the exchange occurs; or to take no card select the face up pile (the
- right hand one) and the card from the face down pack (which is now face
- up) will be copied to the face up pack, and the face down pack is once
- again displayed as the reverse of a card.
-
- Whichever of these actions is taken, a message appears asking the
- player to click on the continue gadget to go on. At this point, either do
- this for the next player to have his turn, or you may submit further
- sets, as described before.
- Pressing continue before an exchange has been made will display a
- message telling you that no exchange has been made; so make one before
- selecting the gadget again.
- When you legitimately press continue, the pointer becomes a 2, and
- the player name on line two becomes Lisa. You may at
- this point see a message "... is thinking", depending on the complexity
- of the situtation. When a move has been decided upon a message appears
- informing you of which pile the card was taken from, and the number of
- cards submitted. When you have read this hit continue again, and it will
- become Mike's turn. After he has made a move a short description is again
- displayed, and pressing continue again means it is your turn again.
- See reference section for details of how to add cards to existing sets.
- This cycle continues until one player has no cards left, at which
- point the end of round requester appears to announce the winner. This
- lists how many points each player has, the number of rounds in the game
- and the number of the round just completed, and then waits for you to select
- its 'proceed' gadget, when the next round will begin as before, if any
- remain in the current game. If not the end of game requester appears to
- announce which player has won the overall game. Selecting proceed from
- here will return the program to its initial state, from where another
- game can be started.
-
- --------------------------------------------------------------------------
-
- Modes Of Play
-
- The program has been designed to allow various combinations of human and
- AutoPlayers to compete, of which the following is a list
-
- 3 human players
- 2 human players
- 3 AutoPlayers
- 2 AutoPlayers
- 2 human players with one AutoPlayer
- 1 human player with two AutoPlayers
- 1 human with 1 AutoPlayer
-
- These various combinations are achieved using the SPECIAL->MANUAL CONTROL
- submenu explained in the reference section below. When there is more than
- one human player competing at the start of a round, in order that the
- players have time to change places without cheating occuring, the program
- will automatically wait for the continue gadget to be pressed before
- showing the human players cards, by which time the previous player will
- have turned away. As a further security measure, if when the player comes
- to take his turn, the turn number shown is his status area is not the
- same as it was at the end of his last turn, then the previous player must
- have cheated by going around each player and looking at their cards. When
- continue is selected the turn number is increased by 1.
- The continuous play option (see below) is included for games with no
- human players; although it can be used when there are some, doing so
- means that the players will not be able to read the descriptions of what
- the AutoPlayers are doing, and the round winners will not be announced.
- Note that when games are played with more than one human player, all
- of the viewcards menu items should be unchecked; the cards of each of the
- human players are then automatically displayed at the start of their turn,
- and then hidden again at the end.
-
- --------------------------------------------------------------------------
-
- Reference.
-
- This section gives details on how to perform actions in the game, and
- on what the menus do.
-
- actions: Making an exchange
- When it is your turn, to take the face up card, click on it so that a box
- appears around it, and then click on the card you want to drop.
- When it is your turn, to take the face down card, click on it so that a box
- appears around it, and then click on the card you want to drop.
- When it is your turn, to take no card, click on the face down card, and
- then on the face up card to make the exchange. (Look at it first to see
- if you want it.)
-
- Changing player names
- At any time, click on a player name gadget (the name with the box
- around it) and edit it to the new name.
-
- Changing the number of rounds in a game. DEFAULT:7
- During a game click on the number of rounds gadget on line four and
- edit it to a new number. Entering a number less than the current round
- number will cause the game to end after the completion of the current
- round.
-
- Submitting a set
- When it is your turn, select the cards which form a set (according to the
- rules described above) and then click on the "submit new set" gadget on
- the right of the screen. If the cards selected form a valid set they will
- be removed from your hand and displayed on the right of the screen. If
- they do not form a valid set, you will know this because the cards will
- remain selected in your hand and will not appear in the sets area. This
- means that either there were less than three cards selected (at least
- this many are needed for submission) or one or more of the selected cards
- does not fit in with the rest. You should then check which cards are
- selected, and try again after making any changes. YOU CAN ONLY SUBMIT ONE
- SET AT A TIME. If you have the cards 3d-4d-5d-9d-9h-9s-9c, selecting them
- all at once for submission will not work. You must select the 3-4-5,
- press submit gadget, then select 9-9-9-9 and press the submit gadget
- again to win.
- ***** The program has now been updated to display a message telling the
- player whether or not the submission was accepted.
-
- Adding to a set
- When it is your turn, select the cards you want to add to a single set,
- in any order, and to add to a set of cards of the same suit you can select
- cards to add at both ends all in one go. After this select the set you want to
- add them to by clicking on one of the cards in the set. Now any selected cards
- which can be added to that set will be removed from your hand and added to
- the set; any highlighted cards in your hand will return to normal. If no
- highlighted cards could be added to the set the will remain highlighted
- in the hand of the player. Any number of cards can be added to a set.
- ***** The program has now been updated to display a message to tell the
- player whether or not any of the selected cards were added to the
- selected set.
-
- All other actions are carried out through menu options described below.
-
- PROJECT->PLAY->
- This submenu allows either a two or a three player game to be started
- or ended. The end game option is active only during a game, and the start
- game options are active only when no game is in progress.
- When the exit game option is selected, a message appears in the title
- bar asking you to verify your choice with the verification menu. Either
- select the verify menu item to confirm, or reselect the exit game item on
- this menu to cancel. Normal play can continue throughout.
-
- PROJECT->REORDER
- This item allows the cards of the current player's hand to be
- reordered. When selected, you are asked to select the players's cards in
- the order they should appear from left to right. As the last card is
- selected the cards are redisplayed in the new order.
-
- PROJECT->ABOUT
- Description of program.
-
- PROJECT->QUIT
- Exit program. This causes a message to appear in the title bar asking
- you to select VERIFY->VERIFYQUITPROGRAM to confirm. Doing this will end
- the current game (if in progress) and display the result, and then end
- the program. Note: the request can be cancelled by reselecting the
- PROJECT->QUIT option. Normal play can continue while the message is
- present in the title bar.
-
- INTELLIGENCE-> DEFAULT:4 for each player
- This menu controls the characteristics of the AutoPlayers. There is
- an intelligence setting for each player: level 1 is the easiest,
- and level 10 is the hardest. The level has no effect for players under
- manual control.
-
- SPECIAL->VIEWCARDS
- This submenu controls whether the cards of each player are always
- visible; there is a subitem for each player which, if checked, means that
- player's cards are always visible.
- NB: Changing these items only takes effect when the player concerned has
- their next turn.
- NB: If a player is under manual control their cards are automatically
- displayed when it is their turn, and only hidden if their viewcards
- item is unchecked.
-
- SPECIAL->MANUAL DEAL
- This item allows the player to select the cards for each player at
- the start of the round. When selected, at the start of the round a
- requester is displayed with every card in it. The number of the player
- for whom the cards are currently being selected appears under the
- pointer. Click on a card and it appears in that players hand. Click on it
- again and it is removed. Once seven cards are selected no more can be
- added. When you have selected all the cards for a player select ACCEPT to
- select cards for the next player. After the cards for each player have
- been selected, ACCEPT begins the game.
- NB: any number of cards upto seven may be dealt to a player.
- NB: the AUTODEAL gadget can be selected at any time to automatically deal
- seven cards per player from a shuffled pack.
-
- SPECIAL->MANUAL CONTROL
- This submenu has items to determine whether each player is under
- manual control or AutoPlayer control (checked means manual). Changes here
- take effect at the begining of that player's next turn. Changes may be
- made here at any time.
-
- SPECIAL->MODIFYMEMORY
- Each player has their own memory describing where they think that each
- card is. There is an entry for each card containing the following flags
-
- CURRPLRHOLDS Current player holds
- NEXTPLRHOLDS Next player holds
- PREVPLRHOLDS Previous player holds
- CURRPLRDROPD Current player dropped
- NEXTPLRDROPD Next player dropped
- PREVPLRDROPD Previous player dropped
- INFUPSET In face up set on right of screen
- GONEPAST In face up Pack
-
- The flags are used in the score function to decide which cards are likely
- to still be available. The modify memory option allows you to change and
- inspect the contents of each player's memory. Selecting card displays the
- flags currently set for that card. At this point the gadgets can be used
- to change the flags set for that card in the memory. When the changes
- have been made use SAVE to store the changes before selecting another
- card. After making all the changes you want to use ACCEPT exit the
- requester and store the changes in the player's memory, or CANCEL to exit
- and discard the changes.
- NB: Intelligence levels are partially implemented by randomly corrupting
- player memory.
-
- SPECIAL->OPENNEWPACK->
- This submenu allows you to determine when the a new pack is opened,
- after each hand is played or after each game, or not at all. This does
- not have very much effect.
- NB: So far as I am aware there is no possibility of cards "disappearing",
- but if you think that they are, then select AFTEREACHHAND from this menu.
-
- SPECIAL->SHUFFLE->
- This is similar to the previous option but controls when cards are
- shuffled instead. Again it has little effect.
-
- SPECIAL->CONTINUOUSPLAY
- This option means that there is no delay after an AutoPlayer takes a
- turn while continue is pressed, and the the round winner requester is not
- displayed. I.e. if left playing with all players in AutoPlayer mode the
- game will progress to completion on its own and the final result will be
- displayed.
- ***** There appears to be an intermittent bug which causes players to
- change themselves to manual control. It only appears rarely - I have only
- seen it once.
-
- VERIFY->
- This contains the verification items for exiting a game and quitting
- the program.
-
- --------------------------------------------------------------------------
-
- Description of source code
-
- The source code is contained in a number of modules so that changes
- are easier to make. There are seven C modules and two header files:
-
- C source
- CARDDECL.C graphics for cards
- DECL.C data declarations
- MENUS.C menu declaraions
- GAME.C main program, exception handler, open libraries etc.
- PLAYGAME.C main game loop and associated functions
- TURN.C functions to allow the user to take a turn
- AUTOTURN.C functions to allow the AutoPlayers to take a turn
-
- C headers
- DEFNS.H structure templates, #DEFINE constants and macros
- EXTERNS.H externally visible objects (including function
- prototypes)
-
- The code was developed and compiled using Lattice Cv5.05, with the
- following compiler options: -cfist -v -y -oram: -L. The last of which
- invokes the linker automatically.
- Most of the code is (or was) fairly well structured, apart from the
- AUTOTURN.C functions which underwent many ammendments during development.
- So far as I am aware there are not any bugs left in the code which
- cause a system crash. Most (see below) of the quirks in the machine's
- gameplay appear to have been removed.
-
- * One bug appears to remain, which means there is a chance that when three
- AutoPlayers play together with each of them being on level 10 and each of
- them has a single card left, a situation may arrise where each player
- takes the faceup card each time, and drops the card they selected last
- time (since it is the only one they hold). As a result the same cards
- keep going around each player. If this happens simply take manual control
- of any one player, when it is their turn select the face down card; then
- return control to AutoPlayer. This cannot happen when a human is
- playing, neither can it happen when any one player is on less than level
- 10 since in that case a random decision is bound to be used eventually.
- As mentioned, this does not affect games with any human competitors .
-
- ****** When the program first starts running you may see a window open
- and then close on the WorkBench screen. This window seems to open
- automatically when the program is run from the icon, and does not happen
- when the shell is used. Using Iconx only creates further problems. The
- only way I have found to remove the problem is to fclose() both stdin and
- stdout, which is what the program now does.
-
- Note that when viewing the source code, tab stops should not be larger
- than four characters, otherwise much of the code disappears off the right
- of the screen.
-
-
- Coding and Graphics by Simon Preene, July - October 1990
-