5 PRINT TAB(31);"BASKETBALL"
7 PRINT TAB(15);"CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
8 IF INFO("wordsize") < 64 THEN PRINT "This program requires a 64-bit uBasic" : END
9 PRINT:PRINT:PRINT
10 PRINT "THIS IS DARTMOUTH COLLEGE BASKETBALL.  YOU WILL BE DARTMOUTH"
20 PRINT " CAPTAIN AND PLAYMAKER.  CALL SHOTS AS FOLLOWS:  1. LONG"
30 PRINT " (10 m) JUMP SHOT; 2. SHORT (5 m) JUMP SHOT; 3. LAY"
40 PRINT " UP; 4. SET SHOT." : PRINT
60 PRINT "BOTH TEAMS WILL USE THE SAME DEFENSE.  CALL DEFENSE AS"
70 PRINT "FOLLOWS:  60. PRESS; 65 MAN-TO MAN; 70. ZONE; 75 NONE."
72 PRINT "TO CHANGE DEFENSE, JUST TYPE 0 AS YOUR NEXT SHOT." : PRINT
76 INPUT "YOUR STARTING DEFENSE WILL BE: ";D:IF D<60 THEN 2010
79 PRINT : Proc _Frand(Time()) : D=FUNC(_Itof (D*1000))
80 K=ASK("CHOOSE YOUR OPPONENT: ")
370 PRINT "CENTER JUMP"
390 IF FUNC(_Frnd) > FUNC(_Fdiv(3, 5)) THEN 420
400 PRINT SHOW(K);" CONTROLS THE TAP."
410 GOTO 3000
420 PRINT "DARTMOUTH CONTROLS THE TAP."
425 PRINT
430 INPUT "YOUR SHOT: ";Z
440 P=0
446 IF (Z<0) + (Z>4) THEN 455
447 GOTO 460
455 PRINT "INCORRECT ANSWER. RETYPE IT. ";:GOTO 430
460 IF FUNC(_Frnd)) < FUNC(_Itof(5000)) THEN 1000
480 IF T<100 THEN 1000
490 PRINT
491 IF @(1)#@(0) THEN 510
492 PRINT:PRINT "   ***** END OF SECOND HALF *****":PRINT
493 PRINT "SCORE AT END OF REGULATION TIME:"
494 PRINT "        DARTMOUTH: ";@(1);"  ";SHOW(K);": ";@(0)
495 PRINT
496 PRINT "BEGIN TWO MINUTE OVERTIME PERIOD"
499 T=93
500 GOTO 370
510 PRINT "   ***** END OF GAME *****":PRINT
515 PRINT "FINAL SCORE: DARTMOUTH: ";@(1);"  ";SHOW(K);": ";@(0)
520 STOP
600 PRINT
610 PRINT "   *** TWO MINUTES LEFT IN THE GAME ***"
620 PRINT
630 RETURN
1000 IF (Z=1) + (Z=2) THEN GOTO 1040
1030 GOTO 1300
1040 T=T+1
1041 IF T=50 THEN 8000
1042 IF T=92 THEN 1046
1043 GOTO 1050
1046 GOSUB 600
1050 PRINT "JUMP SHOT"
1060 IF FUNC(_Frnd) > FUNC(_Fmul(FUNC(_Itof(3410)), FUNC(_Fdiv(D, FUNC(_Itof(80000)))))) THEN 1090
1070 PRINT "SHOT IS GOOD."
1075 GOSUB 7000
1085 GOTO 3000
1090 IF FUNC(_Frnd) > FUNC(_Fmul(FUNC(_Itof(6820)), FUNC(_Fdiv(D, FUNC(_Itof(80000)))))) THEN 1200
1100 PRINT "SHOT IS OFF TARGET."
1105 IF FUNC(_Fmul(FUNC(_Fdiv(D, FUNC(_Itof(60000)))), FUNC(_Frnd))) > FUNC(_Itof(4500)) THEN 1130
1110 PRINT "DARTMOUTH CONTROLS THE REBOUND."
1120 GOTO 1145
1130 PRINT "REBOUND TO ";SHOW(K)
1140 GOTO 3000
1145 IF FUNC(_Frnd) > FUNC(_Itof(4000)) THEN 1158
1150 GOTO 1300
1158 IF D=FUNC(_Itof(60000)) THEN 5100
1160 PRINT "BALL PASSED BACK TO YOU. ";
1170 GOTO 430
1180 IF FUNC(_Frnd) > FUNC(_Itof(9000)) THEN 1190
1185 PRINT "PLAYER FOULED, TWO SHOTS."
1187 GOSUB 4000
1188 GOTO 3000
1190 PRINT "BALL STOLEN. ";SHOW(K);"'S BALL."
1195 GOTO 3000
1200 IF FUNC(_Frnd) > FUNC(_Fmul(FUNC(_Itof(7820)), FUNC(_Fdiv(D, FUNC(_Itof(80000)))))) THEN 1250
1210 PRINT "SHOT IS BLOCKED. BALL CONTROLLED BY ";
1230 IF FUNC(_Frnd)>FUNC(_Itof(5000)) THEN 1242
1235 PRINT "DARTMOUTH."
1240 GOTO 430
1242 PRINT SHOW(K);"."
1245 GOTO 3000
1250 IF FUNC(_Frnd) > FUNC(_Fmul(FUNC(_Itof(8430)), FUNC(_Fdiv(D, FUNC(_Itof(80000)))))) THEN 1270
1255 PRINT "SHOOTER IS FOULED. TWO SHOTS."
1260 GOSUB 4000
1265 GOTO 3000
1270 PRINT "CHARGING FOUL. DARTMOUTH LOSES BALL."
1280 GOTO 3000
1300 T=T+1
1301 IF T=50 THEN 8000
1302 IF T=92 THEN 1304
1303 GOTO 1305
1304 GOSUB 600
1305 IF Z=0 THEN 2010
1310 IF Z>3 THEN 1700
1320 PRINT "LAY UP."
1330 IF FUNC(_Fmul(FUNC(_Fdiv(FUNC(_Itof(70000)), D)), FUNC(_Frnd))) > FUNC(_Itof(4000)) THEN 1360
1340 PRINT "SHOT IS GOOD. TWO POINTS."
1345 GOSUB 7000
1355 GOTO 3000
1360 IF FUNC(_Fmul(FUNC(_Fdiv(FUNC(_Itof(70000)), D)), FUNC(_Frnd))) > FUNC(_Itof(7000)) THEN 1500
1370 PRINT "SHOT IS OFF THE RIM."
1380 IF FUNC(_Frnd)>FUNC(_Fdiv(2, 3)) THEN 1415
1390 PRINT SHOW(K);" CONTROLS THE REBOUND."
1400 GOTO 3000
1415 PRINT "DARTMOUTH CONTROLS THE REBOUND."
1420 IF FUNC(_Frnd)>FUNC(_Itof(4000)) THEN 1440
1430 GOTO 1300
1440 PRINT "BALL PASSED BACK TO YOU. ";
1450 GOTO 430
1500 IF FUNC(_Fmul(FUNC(_Fdiv(FUNC(_Itof(70000)), D)), FUNC(_Frnd))) > FUNC(_Itof(8750)) THEN 1600
1510 PRINT "SHOOTER FOULED. TWO SHOTS."
1520 GOSUB 4000
1530 GOTO 3000
1600 IF FUNC(_Fmul(FUNC(_Fdiv(FUNC(_Itof(70000)), D)), FUNC(_Frnd))) > FUNC(_Itof(9250)) THEN 1630
1610 PRINT "SHOT BLOCKED. ";SHOW(K);"'S BALL."
1620 GOTO 3000
1630 PRINT "CHARGING FOUL. DARTMOUTH LOSES THE BALL."
1640 GOTO 3000
1700 PRINT "SET SHOT."
1710 GOTO 1330
2010 INPUT "YOUR NEW DEFENSIVE ALLIGNMENT IS: ";D
2030 IF D<60 THEN 2010
2040 D=FUNC(_Itof (D*1000)) : GOTO 425
3000 P=1
3005 T=T+1
3008 IF T=50 THEN 8000
3012 GOTO 3018
3015 GOSUB 600
3018 PRINT
3020 Q=FUNC(_Fmul(FUNC(_Fdiv(10, 4)), FUNC(_Frnd)+FUNC(_Itof(10000))))
3030 IF Q>FUNC(_Itof(20000)) THEN 3500
3040 PRINT "JUMP SHOT."
3050 IF FUNC(_Fmul(FUNC(_Fdiv(FUNC(_Itof(80000)), D)), FUNC(_Frnd))) > FUNC(_Itof(3500)) THEN 3100
3060 PRINT "SHOT IS GOOD."
3080 GOSUB 6000
3090 GOTO 425
3100 IF FUNC(_Fmul(FUNC(_Fdiv(FUNC(_Itof(80000)), D)), FUNC(_Frnd))) > FUNC(_Itof(7500)) THEN 3200
3105 PRINT "SHOT IS OFF RIM."
3110 IF FUNC(_Fmul(FUNC(_Fdiv(D, FUNC(_Itof(60000)))), FUNC(_Frnd))) > FUNC(_Itof(5000)) THEN 3150
3120 PRINT "DARTMOUTH CONTROLS THE REBOUND."
3130 GOTO 425
3150 PRINT SHOW(K);" CONTROLS THE REBOUND."
3160 IF D=FUNC(_Itof(60000)) THEN 5000
3165 IF FUNC(_Frnd)>FUNC(_Itof(5000)) THEN 3175
3168 PRINT "PASS BACK TO ";SHOW(K);" GUARD."
3170 GOTO 3000
3175 GOTO 3500
3200 IF FUNC(_Fmul(FUNC(_Fdiv(FUNC(_Itof(80000)), D)), FUNC(_Frnd))) > FUNC(_Itof(9000)) THEN 3310
3210 PRINT "PLAYER FOULED. TWO SHOTS."
3220 GOSUB 4000
3230 GOTO 425
3310 PRINT "OFFENSIVE FOUL. DARTMOUTH'S BALL."
3320 GOTO 425
3500 IF Q>FUNC(_Itof(30000)) THEN 3800
3510 PRINT "LAY UP."
3520 IF FUNC(_Fmul(FUNC(_Fdiv(FUNC(_Itof(70000)), D)), FUNC(_Frnd))) > FUNC(_Itof(4130)) THEN 3600
3530 PRINT "SHOT IS GOOD."
3540 GOSUB 6000
3550 GOTO 425
3600 PRINT "SHOT IS MISSED."
3610 GOTO 3110
3800 PRINT "SET SHOT."
3810 GOTO 3520
4000 REM FOUL SHOOTING
4010 IF FUNC(_Frnd)>FUNC(_Itof(4900)) THEN 4050
4020 PRINT "SHOOTER MAKES BOTH SHOTS."
4030 @(1-P)=@(1-P)+2
4040 GOSUB 6010
4041 RETURN
4050 IF FUNC(_Frnd)>FUNC(_Itof(7500)) THEN 4100
4060 PRINT "SHOOTER MAKES ONE SHOT AND MISSES ONE."
4070 @(1-P)=@(1-P)+1
4080 GOTO 4040
4100 PRINT "BOTH SHOTS MISSED."
4110 GOTO 4040
5000 IF FUNC(_Frnd)>FUNC(_Itof(7500)) THEN 5010
5005 GOTO 3165
5010 PRINT "BALL STOLEN. EASY LAY UP FOR DARTMOUTH."
5015 GOSUB 7000
5030 GOTO 3000
5100 IF FUNC(_Frnd)>FUNC(_Itof(6000)) THEN 5120
5110 GOTO 1160
5120 PRINT "PASS STOLEN BY ";SHOW(K);" EASY LAYUP."
5130 GOSUB 6000
5140 GOTO 425
6000 @(0)=@(0)+2
6010 PRINT "SCORE: ";@(1);" TO ";@(0)
6020 RETURN
7000 @(1)=@(1)+2
7010 GOSUB 6010
7020 RETURN
8000 PRINT:PRINT "   ***** END OF FIRST HALF *****":PRINT
8010 PRINT "SCORE: DARTMOUTH: ";@(1);"  ";SHOW(K);": ";@(0)
8015 PRINT
8016 PRINT
8020 GOTO 370
9999 END

_Frand Param (1) : o = a@ : Return
_Frnd Return (FUNC(_Fdiv(Set(o, (((o+1)*75)-1)%65537), 65536)))
_Fmul Param (2) : Return ((a@*b@)/16384)
_Fdiv Param (2) : Return ((a@*16384)/b@)
_Itof Param (1) : Return ((16384*a@)/10000)
_Ftoi Param (1) : Return ((10000*a@)/16384)
_Fprint Param (1) : a@ = FUNC(_Ftoi(a@)) : Print Using "+?.####";a@; : Return

