100 REM CONVERTED FROM FOCAL BY M.R. BROWN
110 DIM H(12),M(9),O(9),T(9),U(9),V(9),B(9),A(9)
120 PRINT "HORSE RACE""ANY NUMBER OF PLAYERS CAN BET ON THE RESULTS"
130 PRINT "DEC DERBY   1 MILE FOR 3 YEAR OLDS   POST TIME 2:35"
140 PRINT "      THE HORSES FOR THE RACE TODAY ARE"
145 LET S1=0
150 GOSUB 780
160 FOR S=1 TO 30
170    GOSUB 2750
175 NEXT S
180 PRINT "ALL BETS ARE RECORDED,          SUCKERS"
190 LET S=S1
200 PRINT "       THEY'RE OFF AND RUNNING"
210 FOR N=1 TO 9
220     LET H(N)=0
225 NEXT N
230 LET M(1)=62.25
240 LET M(2)=60
250 LET M(3)=350/6
260 LET M(4)=500/9
270 LET M(5)=55
280 LET M(6)=650/12
290 LET M(7)=1100/21
300 LET M(8)=1600/31
310 LET O(1)=6
320 LET O(2)=8
330 LET O(3)=10
340 LET O(4)=16
350 LET O(5)=18
360 LET O(6)=22
370 LET O(7)=40
380 LET O(8)=60
390 LET K=0
410 FOR J=1 TO 9
420    LET H(J)=H(J)+2*(RND(5)-.5)*M(J)
425 NEXT J
430 LET K=K+1
440 PRINT " "
450 IF 0+(8-K) < 0 GO TO 540
460 GOSUB 1880
480 GOSUB 940
490 LET D=H(B(1))
500 IF 0+(K-8)=> 0 THEN 410
510 FOR I=1 TO 9
520    GOSUB 2080
525 NEXT I
530 GO TO 410
540 PRINT "           FINISH"
550 PRINT "$2 MUTUALS PAID WERE THESE:"
560 PRINT "               WIN        PLACE         SHOW"
570 LET K=0
580 FOR I=1 TO 3
590    GOSUB 2360
595 NEXT I
600 FOR I=1 TO 3
610    GOSUB 1280
620    GOSUB 1510
625 NEXT I
630 PRINT " "
640 LET Q=0
650 PRINT "READY FOR RESULTS OF BETTING"
660 FOR J=1 TO S
670    PRINT "BET NO. ",J,":"
680    GOSUB 1590
685 NEXT J
700 IF Q > 0 THEN PRINT "AS A GROUP,YOUR WINNINGS ",Q
710 GO TO 750
720 IF Q=0 PRINT "AS A GROUP,YOU'RE EVEN"
730 GO TO 750
740 IF Q < 0 THEN  PRINT "AS A GROUP,YOUR LOSSES ",ABS(Q)
750 PRINT "TO RACE AGAIN,TYPE G"
760 INPUT G$
770 IF G$="G" GO TO 140
773 STOP
776 END
780 PRINT "1=MAN O'WAR  (3:1)  2=CITATION     (4:1)"
800 PRINT "3=WHIRLAWAY  (5:1)  4=ASSAULT      (8:1)"
820 PRINT "5=SEABISCUIT (9:1)  6=GALLANT FOX (10:1)"
840 PRINT "7=STYMIE    (20:1)  8=COALTOWN    (30:1)"
860 PRINT "9=OLD PAINT (5,000,000:1)  [SENTIMENTAL FAVORITE]"
870 PRINT "FOR EACH BET ENTER"
880 PRINT "HORSE(1-9)"
890 PRINT "TO WIN,PLACE, OR SHOW(1-3)"
900 PRINT "THE WAGER(2-300[DOLLARS])"
910 PRINT "AND YES FOR MORE BETTING OR NO IF ALL BETS ARE PLACED"
920 RETURN
940 LET Q=1
950 FOR L1=1 TO 8
960    LET B(L1)=L1
970    LET A(L1)=1
975 NEXT L1
980 FOR L1=1 TO 8
990    GOSUB 1040
995 NEXT L1
1000 FOR L3=1 TO 8
1010    GOSUB 1170
1015    NEXTL3
1020 RETURN
1040 FOR L2=1 TO 8
1050   GOSUB 1090
1055 NEXT L2
1060 LET A(L1)=A(L1)-1
1070 RETURN
1090 IF 0+(L1-L2) => 0 THEN 1130
1100 IF 0+(H(L1)-H(L2)) <> 0 GO TO 1130
1110 PRINT "RERUN PLEASE"
1120 STOP
1130 IF 0+(H(L1)-H(L2)) < 0 GO TO 1150
1140 LET A(L1)=A(L1)+1
1150 RETURN
1170 LET L1=9-L3
1180 FOR L2=1 TO 8
1190    GOSUB 1220
1195 NEXT L2
1200 RETURN
1220 IF 0+(A(L2)-L1) <> 0 GO TO 1260
1230 LET B(Q)=L2
1240 LET Q=Q+1
1250 LET L2=9
1260 RETURN
1280 LET A=B(I)
1290 PRINT 
1300 REM
1310 REM
1320 REM
1330 REM
1340 IF A=1 THEN PRINT "MAN O'WAR   ";
1360 IF A=2 THEN PRINT "CITATION    ";
1380 IF A=3 THEN PRINT "WHIRLAWAY   ";
1400 IF A=4 THEN PRINT "ASSAULT     ";
1420 IF A=5 THEN PRINT "SEABISCUIT  ";
1440 IF A=6 THEN PRINT "GALLANT FOX ";
1460 IF A=7 THEN PRINT "STYMIE      ";
1480 IF A=8 THEN PRINT "COALTOWN    ";
1490 RETURN
1510 REM 17.01 IF (I-2)17.05,17.1,17.2
1520 IF I < 2 THEN PRINT H(3),H(4),H(5)
1540 IF I = 2 THEN PRINT "               ",H(6),H(7)
1560 IF I > 2 THEN PRINT "                         ",H(8),H(9)
1570 RETURN
1590 LET P=0
1600 FOR I1=1 TO 3
1610    GOSUB 1740
1615 NEXT I1
1620 IF 0+(I1-8) > 0 THEN 1670
1630 LET I=T(J)
1640 PRINT "   TEAR UP YOUR TICKET ON HORSE NO. ";,T(J)
1650 GOSUB 1690
1660 LET Q=Q+P-V(J)
1670 RETURN
1690 LET A=T(J)
1700 PRINT "  "
1710 GOSUB 1300
1720 RETURN
1740 LET I=I1
1750 IF 0+(B(I)-T(J)) = 0 THEN 1770
1760 RETURN
1770 IF 0+(U(J)-I) < 0 THEN 1840
1780 LET P=V(J)*H(2*I+U(J))
1790 PRINT "   YOUR WINNINGS ",P," ON HORSE NO.";T(J)
1800 GOSUB 1690
1810 LET Q=Q+P-V(J)
1820 LET I1=10
1830 RETURN
1840 PRINT "   NEXT TIME BUY A SHOW TICKET ON HORSE NO. ";,T(J)
1850 GOSUB 1690
1860 GO TO 1810
1880 REM 22.01 IF (K-2)22.5,22.55
1890 REM IF (K-4)22.6,22.65
1900 REM IF (K-6)22.7,22.75
1910 REM 22.03 IF (K-8)22.8
1930 IF K = 1 THEN PRINT "   AS THEY BREAK FROM THE GATE -"
1950 IF K = 2 THEN PRINT "   AT THE 1/4 MILE POLE -"
1970 IF K = 3 THEN PRINT "   AT THE 3/8 MILE POLE -"
1990 IF K = 4 THEN PRINT "   MIDWAY IN THE RACE -"
2010 IF K = 5 THEN PRINT "   AT THE 5/8 MILE POLE -"
2030 IF K = 6 THEN PRINT "   ROUNDING THE TURN -"
2050 IF K = 7 THEN PRINT "   COMING DOWN THE STRETCH -"
2060 RETURN
2080 IF 0+(1-I) < 0 GO TO 2110
2090 PRINT "POSITION          HORSE             LENGTHS BEHIND"
2100 GO TO 2140
2110 IF 0+(I-9) < 0 GO TO 2140
2120 GOSUB 2500
2130 RETURN
2140 LET D1=.1*INT(D-H(B(I)))
2150 REM 23.20 IF 0+(B(I)-2)23.4,23.45
2160 REM IF (B(I)-4)23.5,23.55
2170 REM 23.25 IF (B(I)-6)23.6,23.65
2180 REM 23.30 IF (B(I)-8)23.7,23.75
2190 IF B(I) = 1 THEN PRINT I,"    MAN O'WAR    ",D1
2210 IF B(I) = 2 THEN PRINT I,"    CITATION     ",D1
2230 IF B(I) = 3 THEN PRINT I,"    WHIRLAWAY    ",D1
2250 IF B(I) = 4 THEN PRINT I,"     ASSAULT     ",D1
2270 IF B(I) = 5 THEN PRINT I,"   SEABISCUIT    ",D1
2290 IF B(I) = 6 THEN PRINT I,"   GALLANT FOX   ",D1
2310 IF B(I) = 7 THEN PRINT I,"     STYMIE      ",D1
2330 IF B(I) = 8 THEN PRINT I,"    COALTOWN     ",D1
2350 RETURN
2360 GOSUB 2430
2370 LET J=I
2375 REM TRACE ON
2380 LET S2=J
2390 FOR J=I TO 3
2400    GOSUB 2430
2405 NEXT J
2410 RETURN
2430 LET L=2*I+J
2440 LET R=3*(J-1)
2450 IF J > 1 GO TO 2470
2455 REM IF 0+(1-J) < 0 GO TO 2470
2460 LET R=1
2470 REM PRINT "SUBSCRIPT =",L
2475 LET H(L)=1.5+.01*INT((O(B(I))/R+2*(RND(5)-.5))*100)
2480 RETURN
2500 REM27.01 IF (K-2)27.2,27.25
2510 REMID)27.3,27.35
2520 REM IF (K-6)IF K = 1 7.45
2530 IF K = 1 THEN PRINT " 9              OLD PAINT*                 ?"
2540 IF K = 1 THEN PRINT "        *(WAS SHOT BY JOCKEY)"
2560 IF K = 2 THEN PRINT " 9              OLD PAINT*               40.5"
2570 IF K = 2 THEN PRINT "        *(GOT SADDLE CAUGHT IN STARTING GATE)"
2590 IF K = 3 THEN PRINT " 9              OLD PAINT*               4562.8"
2600 IF K = 3 THEN PRINT "        *(IS RUNNING THE WRONG WAY)"
2620 IF K = 4 THEN PRINT " 9              OLD PAINT*      5595.7 AND 3 FEET DOWN"
2630 IF K = 4 THEN PRINT "        *(FELL IN A HOLE)"
2650 IF K = 5 THEN PRINT " 9              OLD PAINT*               20.5"
2660 IF K = 5 THEN PRINT "        *(CUT ACROSS INFIELD)"
2680 IF K = 6 THEN PRINT " 9              OLD PAINT*              4800.1"
2690 IF K = 6 THEN PRINT "        *(LOST A SHOE)"
2710 IF K = 7 THEN PRINT " 9              OLD PAINT*              48000.5"
2720 IF K = 7 THEN PRINT "        *(BROKE LEFT REAR LEG)"
2730 RETURN
2750 PRINT "BET NO. ";,S
2760 INPUT "HORSE?(1-9)",T(S)
2780 IF 0+(9-T(S)) < 0 GO TO 2760
2790 IF 0+(T(S)-1) < 0 GO TO 2760
2800 IF 0+(T(S)-9) < 0 GO TO 2820
2810 PRINT "     GOOD LUCK,DO YOU BET MUCH?"
2820 INPUT "POSITION?(1,2,OR 3)",U(S)
2840 IF 0+(3-U(S)) < 0 GO TO 2820
2850 IF 0+(U(S)-1) < 0 GO TO 2820
2860 INPUT "BET?(2-300[IN DOLLARS])",V(S)
2880 IF 0+(300-V(S)) < 0 GO TO 2860
2890 IF 0+(V(S)-2) < 0 GO TO 2860 
2900 INPUT "MORE BETS?(YES OR NO)",Y1$
2920 IF Y1$="YES" THEN RETURN
2940 LET S1=S
2950 LET S=30
2960 RETURN
