Patience - Am Grant (Your Spectrum-Issue 14-Page 59) Playing the latest Jet Set Willy clone or the next Sabre Wulf spin-off is all very well, but there comes a time when the old grey matter needs a good stoking. AM Grant's version of the popular card game Patience will probably provide just the sort of brain-teasing fuel that you're after - it even rivals some of our 100 per cent machine code games (Well ... nearly! Ed.). Here at the YS Towerblock, we're pretty confident that you've all played Patience at one time or another - there are plenty of variants to choose from! This particular version, though, is the most common. The object of the game is to turn every card face-up. The computer deals out seven columns of cards face down - the first column containing just one card, the second column two cards and so on; the top card from each column is then turned face-up. You play the game by maneuvering the cards around on-screen so that they end up in descending order. However, you also have to make sure you place a red card on a black card and vice versa. For example, you can put the nine of clubs on the ten of diamonds, but the program won't allow you to put it on the ten of spades! When you've done as much as you can with the cards you can see, have a look at the bottom of the screen. Yes, you've guessed - with only 28 cards on-screen, the rest of the pack can be used ... but you can only get at every third card. However, if you get stuck, don't panic - just press the 'C' key and the deck will be shuffled automatically. There's an eighth column on-screen that's used to build up aces; obviously, once you've got an ace in the 'ace stack' you can start building the suits up, just as the other columns descend. There are eight control keys to get to know if you're going to master this game ... so pay attention! The keys are: '5' to move the cursor left; '8' to move the cursor right; '6' to put the 'held' card or block of cards onto a column; '7' to pick up a card or block of cards from a column; '4' to pick up a card from the pack; '9' to turn over the next batch of three cards in the pack; 'C' to shuffle the pack; and lastly, 'Q' to quit the game. All illegal moves are caught by the program, except that it does allow you to put any card in the empty columns, and not just a King. If you don't consider this to be the 'proper' way to play Patience, don't get angry with us ... have a little patience, and write yourself a routine to 'fix' it so that this becomes an illegal move. And then, write to Forum and tell us how its done! [A patch to allow only Kings on empty files was provided by J Sneideris] [and printed in issue 16 (Jul.1985). This is on the end of PATIENCE.TAP] [as "patch" and can be MERGEd into the main program if desired. ] Lines 980-998 Carry out the initialisation required for the program. The function in line 984 is used to test the requested move, to see if it's valid. The routine then goes on to set the screen attributes and display the title screen. Lines 999-1014 Set up a pack of 52 different playing cards in the array, p$. Lines 1046-1058 Work out the INK and PAPER colours for a card and print it. Lines 1098-1188 Set up the user-defined graphics and declare the arrays. Lines 1152-1188 copy characters from the ROM into the user-defined graphics area so the UDGs contain. 'A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q' and 'K'; note that '10' is contained in just one byte. This makes calculations and printing of the cards much easier. Lines 1196-1293 This rather long routine deals out the cards in the standard Patience format. Lines 1300-1308 Set up the game flags that tell the Spectrum if you've cheated, finished, are holding a card, and so on. Lines 1398-1448 Shuffle the entire pack. Line 1402 increases the randomness of the shuffle by POKEing the random seed, making the 'RND' command that bit more random! Lines 1498-1508 Wait for a keypress and return with it in i$. Lines 1514-1536 Sort out which key was pressed and then send program flow to the required routine. Lines 1599-1726 Contain the cursor control routines. Lines 1600-1606 move the cursor right, and lines 1611-1618 move the cursor left. Lines 1620-1639 allow you to pick up a card. Lines 1640- 1726 allow you to place a card; this routine also checks to see if the card has been placed in a valid position - if it hasn't, it's returned to its original position on-screen. Lines 1730-1776 Put the card held on its ace stack, after checking that the move is legal. If it's invalid, the card is returned to its original position. Lines 1780-1804 An invalid move causes this routine to be called, returning the card to its original position. Lines 1850-1884 Pick up the top card from the deck and display it as the 'held' card. Note that you can't see any of the cards below it until you've decided where you want to put it. Lines 1890-1894 Remove the 'under cards' of the deck, once a card has been selected ... just like a real deck of cards! Lines 1898-1908 Turn over the next batch of three cards. Lines 1918-1927 Quit the current game and ask if you'd like to play another. Lines 1930-1956 This routine allows you to cheat and shuffle the cards you've got left in the pack. This means you often find that mischievous card that never seems to come up! Lines 2000-2022 Call all the subroutines required to play the game. Lines 2010-2018 draw the deck and ace stacks. Lines 2100-2221 This is the 'end of game' routine, announcing to all and sundry whether you have won or not, and how often you cheated! Lines 2999-3100 Play the tune that accompanies a winning game. Lines 3999-4100 Play the tune that accompanies a losing game. This routine also upturns all the undisplayed cards in the deck. Lines 5000-5005 Comprise the 'SAVE' routine. This can be easily modified to work with Microdrives, using 'SAVE *"m";1;"Patience" and so on. Lines 6000-6020 Print up the details of the control keys needed to play the game. ------------------------------------------------------------------------------ TYPE: Cardgame COMMENT: This info file was typed by Jim Grimwood Downloaded from: Desert Island Disks -- http://www.image.dk/~frankie/ Maintained by: Michael Bruhn -- frankie@image.dk