Sinclair owners will probably spend a fair amount of time converting programs from other Basics. This can be a rewarding and educational practice or an exercise in frustration, depending on how you go about it. To pass on a few tips and tricks for translating, I’ll explain the techniques used in getting Acey Deucy running on the ZX 80.

The first step in any translation is to get a good idea of the functions being performed by the program, and of the logic flow behind these functions. Let’s go through the original listing, examine what each part does, and see how the functions can be duplicated on the Sinclair. Basically, the program does the following; it deals two cards, accepts a bet, deals a third card, checks for a win or loss, adjusts the player’s total, and checks to see if he is broke. The first portion of the program prints the instructions. In the interest of saving memory, these lines were not included in the translation. If there is room, they can always be added later.
In lines 100 and 110, variables are defined. “N” is not used later in the program, so it isn’t included in the translation. The original programmer probably had plans to use it in some later version of the game and didn’t bother to remove it from the listing. “Q” holds the amount of money the player has. The next section, lines 120 and 130, print the player’s total and then print a blank line. While the extra PRINT statement adds readability, it also uses memory. Like the instructions, it can always be added later. The program then jumps to the section from 260 to 650 where the cards are selected and displayed. This is where the real changes begin to occur.
10 PRINT TAB(26);"ACEY DUCEY CARD GAME"
20 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
21 PRINT
22 PRINT
23 PRINT
30 PRINT"ACEY-DUCEY IS PLAYED IN THE FOLLOWING MANNER "
40 PRINT"THE DEALER (COMPUTER) DEALS TWO CARDS FACE UP"
50 PRINT"YOU HAVE AN OPTION TO BET OR NOT BET DEPENDING"
60 PRINT"ON WHETHER OR NOR YOU FEEL THE CARD WILL HAVE"
70 PRINT"A VALUE BETWEEN THE FIRST TWO."
80 PRINT"IF YOU DO NOT WANT TO BET, INPUT A 0"
100 N=100
110 Q=100
120 PRINT"YOU NOW HAVE ";Q;" DOLLARS"
130 PRINT
140 GOTO 260
210 Q=Q+M
220 GOTO 120
240 Q=Q-M
250 GOTO 120
260 PRINT"HERE ARE YOUR NEXT TWO CARDS "
270 A=INT(14*RND(1))+2
280 IF A<2 THEN 270
290 IF A>14 THEN 270
300 B=INT(14*RND(1))+2
310 IF B<2 THEN 300
320 IF B>14 THEN 300
330 IF A>=B THEN 270
350 IF A<11 THEN 400
360 IF A=11 THEN 420
370 IF A=12 THEN 440
380 IF A=13 THEN 460
390 IF A=14 THEN 480
400 PRINT A
410 GOTO 500
420 PRINT"JACK"
430 GOTO 500
440 PRINT"QUEEN"
450 GOTO 500
460 PRINT"KING"
470 GOTO 500
480 PRINT"ACE"
500 IF B<11 THEN 550
510 IF B=11 THEN 570
520 IF B=12 THEN 590
530 IF B=13 THEN 610
540 IF B=14 THEN 630
550 PRINT B
560 GOTO 650
570 PRINT"JACK"
580 GOTO 650
590 PRINT"QUEEN"
600 GOTO 650
610 PRINT"KING"
620 GOTO 650
630 PRINT"ACE"
640 PRINT
650 PRINT
660 INPUT"WHAT IS YOUR BET";M
670 IF M<>0 THEN 680
675 PRINT"CHICKEN!!"
676 PRINT
677 GOTO 260
680 IF M<=Q THEN 730
690 PRINT"SORRY, MY FRIEND BUT YOU BET TOO MUCH"
700 PRINT"YOU HAVE ONLY ";Q;" DOLLARS TO BET"
710 GOTO 650
730 C=INT(14*RND(1))+2
740 IF C<2 THEN 730
750 IF C>14 THEN 730
760 IF C<11 THEN 810
770 IF C=11 THEN 830
780 IF C=12 THEN 850
790 IF C=13 THEN 870
800 IF C=14 THEN 890
810 PRINT C
820 GOTO 910
830 PRINT"JACK"
840 GOTO 910
850 PRINT"QUEEN"
860 GOTO 910
870 PRINT"KING"
880 GOTO 910
890 PRINT "ACE"
900 PRINT
910 IF C>A THEN 930
920 GOTO 970
930 IF C>=B THEN 970
950 PRINT"YOU WIN!!!"
960 GOTO 210
970 PRINT"SORRY, YOU LOSE"
980 IF M<Q THEN 240
990 PRINT
1000 PRINT
1010 PRINT"SORRY, FRIEND BUT YOU BLEW YOUR WAD"
1020 INPUT"TRY AGAIN (YES OR NO)";A$
1030 IF A$="YES" THEN 110
1040 PRINT"OK HOPE YOU HAD FUN"
1050 END
Listing of Acey Ducey from Basic Computer Games. Copyright 1976 by Creative Computing. Reprinted with permission.
ACEY DUCEY CARD GAME CREATIVE COMPUTING MORRISTOWN, NEW JERSEY ACEY-DUCEY IS PLAYED IN THE FOLLOWING MANNER THE DEALER (COMPUTER) DEALS TWO CARDS FACE UP YOU HAVE AN OPTION TO BET OR NOT BET DEPENDING ON WHETHER OR NOR YOU FEEL THE CARD WILL HAVE A VALUE BETWEEN THE FIRST TWO. IF YOU DO NOT WANT TO BET, INPUT A 0 YOU NOW HAVE 100 DOLLARS HERE ARE YOUR NEXT TWO CARDS 2 9 WHAT IS YOUR BET? 25 QUEEN SORRY, YOU LOSE YOU NOW HAVE 75 DOLLARS HERE ARE YOUR NEXT TWO CARDS 4 10 WHAT IS YOUR BET? 25 10 SORRY, YOU LOSE YOU NOW HAVE 50 DOLLARS HERE ARE YOUR NEXT TWO CARDS 8 QUEEN WHAT IS YOUR BET? 0 CHICKEN!! HERE ARE YOUR NEXT TWO CARDS 6 10 WHAT IS YOUR BET? 20 10 SORRY, YOU LOSE YOU NOW HAVE 30 DOLLARS
Sample run from original Acey Ducey game in Basic Computer Games.
Several things are happening here. First, a value from two to fourteen is chosen. By using fourteen as the value of an ace (aces are high), the cards can be compared easily. In the original program, the first card (variable A) had to be lower in value than the second card (variable B). If this wasn’t the case, new values had to be used. In the conversion, it doesn’t matter which of the two is higher. The program only checks to see if they are the same. In this case, since the player can’t win, new values are selected (see line 300 of the translation). Next, the values are printed. If the value is below eleven, a number is used. For a higher value, the name of the card is needed. In the original, this is done separately for each card. To save space in the conversion, this function was put into a subroutine which could be used for all three cards. The subroutine uses the variable “C”. In line 320 of the conversion, C is made equal to A. Thus the subroutine prints the name of the card if A is greater than ten.
At line 660 of the original, the bet is taken. Line 670 shows a common operation used in many programs: an inequality where more than one operator is used. The symbols =, <, and > are often used in pairs. In this case, the symbols “< >” mean “not equal to.” This can be translated using the NOT operator. Whenever a program has two symbols (such as >=, which means “greater than or equal to,”) the line can be translated using NOT and the unused symbol of the trio <, >, and =. So a line such as
10 IF X >= 10 THEN GO TO 50
can be translated as
10 IF NOT X < 10 THEN GO TO 50
Getting back to the program, line 680 checks to see if the player bet more than he has in his winnings. This line could have been translated using the trick just mentioned. For variety, another method was used. In this instance, the two symbols were used, separated by a logical OR (see line 410 of the translation). Lines 730 through 890 select and print the third card. In the translation, this is replaced with 450 through 465. Note that the lines in the original, such as 740, that check for values less than two or greater than fourteen aren’t needed. The RND function won’t return a value outside the desired range.
After the third card is displayed, the values must be compared to see whether there is a win or a loss. In the original, since A was always less than B, the program only had to determine whether D was greater than A and less than B. This is done in the series of lines from 910 to 970. In the translation, we have to see whether D is between A and B, regardless of whether A or B is the higher of the original pair. This is done in line 600. D must either be greater than A and less than B or greater than B and less than A. Otherwise, the player loses.
Once a win or loss has been determined, the program must adjust the player’s total. In the original, different routines were used for win and loss. This is the section from 210 to 240. To save space, just one routine was used in the translation. This is done in line 215. If the player lost, M will have a negative value (see line 630) and the bet will actually be subtracted from the total.
Line 620 of the translation checks to see if the player is broke. If he is, the program goes on to line 900 where the player is offered another chance.
That about covers the translation. Note that on each pass through the game, the player must hit NEWLINE to continue (line 210). This serves two purposes. The input stops the program temporarily, allowing the printout to appear, and it also gives the player a chance to read everything before the CLS is encountered. Also, commas are used in the print routines so the cards will be printed on one line.
Those who are interested might try adding some improvements to the game. For example, in some versions of Acey Deucy, the player loses $5 whenever a pair is dealt. Also, in the real version, the player has a choice of letting an ace be either high or low if it is the first card of the two dealt on any hand. These features could probably be added to the existing program with little difficulty.
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.