Horse Racing
By Tim Ruscheinsky
Anxious faces of spectators line the track waiting for their horses to break through the gate. The horn sounds and they are off. This is not a day at the races, but an exciting simulation called `Horse Racing'. Complete with weather conditions, odds, and winnings, the action at the track can be duplicated without any sobering losses.
In the race, you must bet on at least one of the five horses. Each horse has its own odds and characteristics that can vary with every running. Changing weather and track conditions offer a further obstacle in the choosing of a winner. Wet and Muddy tracks tend to slow the horses, while drier conditions produce faster times.
As soon as all bets have been made, a green track will appear with picket fences on either side. Racing begins instantly after this. The horses will progress from left to right towards the finish line. The lead may change a number of times before the first horse crosses the finish line. After every race the winning horse will immediately be announced. Bets are settled and then the entire process is repeated.
`Horse Racing' is not a complex game, but does recreate some of the of the more enjoyable aspects of the track. Characters are used to draw the horses and background features. A machine language subroutine is used to move the ROM character set. The odds are generated randomly with some die modifications. Despite its simplicity, the program will hopefully bring hours of enjoyment.
10 REM * HORSE RACING *
20 GRAPHICS 1+16:SETCOLOR 2,16,1
30 POSITION 4,6:? #6;"HORSE RACING"
100 FOR DAT=1 TO 25:READ PE
110 FOR TI=1 TO 3:FOR SP=1 TO 5:SOUND 0,PE,10,10:NEXT SP:NEXT TI
120 FOR YY=1 TO 10:NEXT YY:SOUND 0,0,0,0:NEXT DAT
130 DATA 81,60,40,40,40,47,47,47,60,47,60,81,0,81,60,40,40,40,47,47,47,81,81,81,60
140 M=10000
150 DIM WB$(20),WC$(20),WD$(20),WE$(20):WA=1
160 WB$="Dry & Fast":WC$="Dry & Rough":WD$="Wet & Slick":WE$="Muddy & Slow"
170 A=1:B=2:C=3:D=4:E=5
180 P=50:J=0:F=0:G=0:H=0:I=0
190 GRAPHICS 1+16:SETCOLOR 2,16,1:COLOR 1:POSITION 1,8:? #6;"count down to post "
200 L=INT(RND(0)*5)+1
210 IF A=L THEN J=J+1:P=P-1
220 IF B=L THEN F=F+1:P=P-1
230 IF C=L THEN G=G+1:P=P-1
240 IF D=L THEN H=H+1:P=P-1
250 IF E=L THEN I=I+1:P=P-1
260 POSITION 9,12:? #6;P;" "
270 IF P=0 THEN GOTO 290
280 GOTO 200
290 GRAPHICS O:SETCOLOR 1,0,0:SET COLOR 4,0,0
300 Z=50
310 N=Z/J:A=INT(N+1):POSITION 2,3:? A;":1 Happy Jack"
320 POSITION 29,7:? "Welcome"
330 N=Z/F:B=INT(N+1):POSITION 2,5:? B;":1 Blazing Bob"
340 POSITION 27,9:? "to the track
350 N=Z/G:C=INT(N+1):POSITION 2,7:? C;":1 Hop Along "
360 N=Z/H:D=INT(N+1):POSITION 2,9:? D;":1 Tippy Tim "
370 N=Z/I:E=INT(N+1):POSITION 2,11:? E;":1 Mustard Seed"
380 M=M
390 POSITION 2,1:? "ODDS HORSES"
400 POSITION 10,20:? "PLACE YOU BET"
410 POSITION 30,1:? "TRACK":POSITION 28,2:? "CONDITIONS"
420 POSITION 13,14:? "CASH: ";M
430 WA=INT(RND(0)*4)+1
440 POSITION 27,4:IF WA=1 THEN ? WB$
450 IF WA=2 THEN ? WC$
460 IF WA=3 THEN ? WD$
470 IF WA=4 THEN ? WE$
480 POKE 752,1
490 POSITION 3,17:? "#1":POSITION 11,17:? "#2":POSITION 19,17:? "#3":POSITION 27,17:? "#4":POSITION 35,17:? "#5"
500 IF M<0 THEN GOTO 1190
510 POSITION 1,18:? " of :POSITION 0,18:TRAP 510:INPUT BET1:IF M<BET1 THEN GOTO 510
520 M=M-BET1:POSITION 18,14:? " ":POSITION 18,14:? M
530 POSITION 9,18:? " of :POSITION 8,18:TRAP 530:INPUT BET2:IF M<BET2 THEN GOTO 530
540 M=M-BET2:POSITION 18,14:? " ":POSITION 18,14:? M
550 POSITION 17,18:? " ":POSITION 16,18:TRAP 550:INPUT BET3:IF M<BET3 THEN GOTO 550
560 M=M-BET3:POSITION 18,14:? " ":POSITION 18,14:? M
570 POSITION 25,18:? " ":POSITION 24,18:TRAP 570:INPUT BET4:IF M<BET4 THEN GOTO 570
580 M=M-BET4:POSITION 18,14:? " ":POSITION 18,14:? M
590 POSITION 33,18:? " ":POSITION 32,18:TRAP 590:INPUT BET5:IF M<BET5 THEN GOTO 590
600 M=M-BET5:POSITION 18,14:? " ":POSITION 18,14:? M
610 RAMTOP=106:CHBAS=756:CHORG=57344
620 GRAPHICS 0:POKE 752,1:SETCOLOR 1,0,8:SETCOLOR 2,14,5
640 RAMNEW=PEEK(RAMTOP)-8
650 START=RAMNEW*256
660 IF X4=10 THEN POKE CHBAS,RAMNEW:GOTO 750
670 FOR X=1 TO 20:READ BB:POKE 1535+X,BB:NEXT X
680 DATA 104,162,4,160,0,177,205,145,203,200,208,249,230,206,230,204,202,208,242,96
690 Q=USR(1536):? "£"
700 POKE CHBAS,RAMNEW
710 X4=10
720 FOR I=0 TO 79:READ AA
730 POKE (START+(97*8)+I),AA
740 NEXT I
750 U=1:V=2:W=3:X=4:Y=5:P=0:Q=0:R=0:S=0:T=0
760 FOR LINE=2 TO 21:POSITION 39,LINE:? "j":NEXT LINE
770 POSITION 0,1:? "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"
780 POSITION 0,22:? "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"
790 POSITION P,3:? "abcd"
800 POSITION P,4:? "efgh"
810 POSITION Q,7:? "abcd"
820 POSITION Q,8:? "efgh"
830 POSITION R,11:? "abcd"
840 POSITION R,12:? "efgh"
850 POSITION S,15:? "abcd"
860 POSITION S,16:? "efgh"
870 POSITION T,19:? "abcd"
880 POSITION T,20:? "efgh"
890 Z=INT(RND(0)*(5+WA-1))+1
900 IF Z=U THEN P=P+1
910 IF Z=V THEN Q=Q+1
920 IF Z=W THEN R=R+1
930 IF Z=X THEN S=S+1
940 IF Z=Y THEN T=T+1
950 IF P=36 OR Q=36 OR R=36 OR S=36 OR T=36 THEN 970
960 GOTO 790
970 ? "4":GRAPHICS 0
980 IF P=36 THEN WIN=BET1*A:NUM=1
990 IF Q=36 THEN WIN=BET2*B:NUM=2
1000 IF R=36 THEN WIN=BET3*C:NUM=3
1010 IF S=36 THEN WIN=BET4*D:NUM=4
1020 IF T=36 THEN WIN=BET5*E:NUM=5
1030 M=M+WIN
1040 IF M<0 THEN END
1050 GRAPHICS 1+16:POSITION 6,10:? #6;"horse #";NUM
1060 FOR J=1 TO 200:NEXT J
1070 GOTO 170
1080 DATA 0,0,0,0,0,0,0,0
1090 DATA 0,0,0,0,0,0,31,0
1100 DATA 3,3,12,31,48,207,239,247
1110 DATA 96,112,95,255,240,224,128,128
1120 DATA 0,0,0,0,0,0,0,0
1130 DATA 1,1,3,3,6,12,12,24
1140 DATA 239,222,227,97,96,33,35,224
1150 DATA 224,96,48,144,176,160,0,0
1160 DATA 0,0,85,85,68,68,68,68
1170 DATA 192,192,0,0,192,192,0,0
DATA
CHECK
0 REM * CHECK DATA: HORSE.RA *
10 DATA 8576,545,104,319,775,159,229,242,715,517,461,466,777,689,330,752,746,750
240 DATA 10429,754,758,772,571,832,902,586,786,140,883,571,728,774,76,557,390,349
410 DATA 9070,685,977,410,347,430,433,436,929,620,611,366,479,390,482,492,485,498
580 DATA 9526,488,504,482,404,607,802,458,932,39,285,372,528,637,628,779,766,815
760 DATA 11905,539,463,515,798,807,796,814,842,860,849,867,856,865,729,431,435,439
930 DATA 7605,443,447,187,851,39,218,223,258,263,268,879,358,399,689,884,394,447
1100 DATA 6111,880,141,389,560,51,937,763,826,927,637