Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50110/basbal.dem
There are 2 other files named basbal.dem in the archive. Click here to see a list.
100'  NAME--BASBAL
110'
120'  DESCRIPTION--GENERATES A BASEBALL GAME.
130'
140'  SOURCE--WRITTEN BY JOHN KEMENY, REVISED 1/13/65 BY KEITH BELLAIRS.
150'  REVISED 6/30 BY JOHN KEMENY.
160'
170'  INSTRUCTIONS--TYPE "RUN" AND FOLLOW INSTRUCTIONS.
180'
190'
200'  *  *  *  *  *  *   MAIN PROGRAM   *  *  *  *  *  *  *  *  *  *  *
210' 
220   PRINT "WELCOME TO THE PDP-10 TIMESHARING  WORLD SERIES."
230   PRINT "YOU MAY THROW OUT THE FIRST BALL ---"
240   PRINT "PLEASE TYPE A NUMBER FROM 1 TO 1000, AND PUSH 'RETURN'";
250   INPUT Q
260   PRINT "BATTER UP *****"
270  READ Q1
280  LET Q = Q + Q1
290  FOR I = 1 TO Q
300 LET X=RND
310  NEXT I
320  REM READ TABLE B, RULES OF THE GAME
330  FOR R = 1 TO 4
340  FOR B = 1 TO 8
350  READ B(R,B)
360  NEXT B
370  NEXT R
380  PRINT
390  REM  PROBABILITIES OF STEAL AND OF SAFE ON STEAL
400  LET P7 = .1
410  LET P8 = .6
420  REM  INITIALIZE
430  FOR T = 1 TO 2
440 LET E(T) = 0
450 LET K(T) = 1
460 LET I = 1
470 NEXT T
480 REM READ BATTING PERCENTAGES
490 FOR K = 1 TO 9
500 FOR J = 1 TO 4
510 READ Q(K,J)
520 NEXT J
530 NEXT K
540 FOR K = 1 TO 9
550 LET S = 0
560 FOR J = 1 TO 4
570 LET S = S + Q(K,J)
580 LET P(K,J) = S
590 NEXT J
600 NEXT K
610 PRINT "DODGERS              YANKEES"
620 PRINT
630 PRINT
640 GOTO 1100
650 REM NEW INNING
660 FOR T = 1 TO 2
670 LET O(T) = 0
680 LET Z(T) = 0
690 LET C(T) = 8
700 LET F(T) = 0
710 NEXT T
720 LET T = 1
730 LET K = K(T)
740 GOTO 810
750 REM NEW BATTER
760 LET K(T) = K
770 LET T = 3-T
780 LET K = K(T)
790 IF Z(T) > 0 THEN 1420
800 GOTO 1490
810 LET X=RND
820 IF X < P(K,1) THEN 870
830 IF X < P(K,2) THEN 1150
840 IF X < P(K,3) THEN 1330
850 IF X < P(K,4) THEN 1360
860 GOTO 1390
870 LET O(T) = O(T) +1
880 PRINT K "  OUT";
890 IF T=2 THEN 920
900 PRINT "          ";
910 GOTO 930
920 PRINT 
930 IF O(T) < 3 THEN 1290
940 LET Z(T) = 1
950 GOTO 1290
960 PRINT "RUNS:"F(T);
970 LET Z(T) = 2
980 IF T=2 THEN 1010
990 PRINT "          ";
1000 GO TO 760
1010 PRINT
1020 GOTO760
1030 PRINT
1040 IF T = 1 THEN 1060
1050 PRINT
1060 LET I = I+1
1070 IF I <= 9 THEN 1100
1080 IF E(1) = E(2) THEN 1100
1090 GOTO 1740
1100 PRINT "INNING"I
1110 PRINT
1120 PRINT "PLAYER  RESULT       PLAYER  RESULT"
1130 REM                  7 SPACES
1140 GOTO 660
1150 LET R = 1
1160 REM ALL "RESULTS" ARE FILLED OUT TO EXTEND 2 SPCES PAST THE LAST
1170 REM COLUMN OF THE WORD RESULT.  493 EXTENDS THE PRINT LINE UNDER
1180 REM THE PLAYER COLUMN IF APPROPRIATE.
1190 PRINT K "  WALK    ";
1200 IF T=1 THEN 1230
1210 PRINT
1220 GOTO 1240
1230 PRINT "     ";
1240 LET X = B(R,C(T))
1250 LET Q = INT(X/10)
1260 LET E(T) = E(T) + Q
1270 LET F(T) = F(T) + Q
1280 LET C(T) = X - Q*10
1290 LET K = K+1 - 9*INT((K+1)/9)
1300 IF K > 0 THEN 760
1310 LET K = 9
1320 GOTO 760
1330 LET R = 2
1340 PRINT K "  SINGLE  ";
1350 GOTO 1200
1360 LET R = 3
1370 PRINT K "  DOUBLE  ";
1380 GOTO 1200
1390 LET R = 4
1400 PRINT K "  HOME RUN";
1410 GOTO 1200
1420 IF Z(T) = 1 THEN 960
1430 IF Z(3-T) = 2 THEN 1030
1440 IF T = 1 THEN 1470
1450 PRINT
1460 GOTO 760
1470 PRINT"   ","      ";
1480 GOTO 760
1490 IF C(T) = 1 THEN 1510
1500 IF C(T) <> 5 THEN 810
1510 LET X=RND
1520 IF X > P7 THEN 810
1530 PRINT "STEAL   ";
1540 LET X=RND
1550 IF X > P8 THEN 1630
1560 PRINT "SAFE";
1570 IF T=1 THEN 1600
1580 PRINT
1590 GOTO 1610
1600 PRINT "         ";
1610 LET C(T) = C(T)+1
1620 GOTO 770
1630 PRINT "OUT";
1640 IF T=1 THEN 1670
1650 PRINT
1660 GOTO 1680
1670 PRINT "          ";
1680 LET C(T) = C(T) - 1
1690 IF C(T) > 0 THEN 1710
1700 LET C(T) = 8
1710 LET K = K-1
1720 LET O(T) = O(T)+1
1730 GOTO 930
1740 PRINT
1750 PRINT
1760 PRINT "FINAL SCORE: " E(1); "TO  "; E(2)
1770 PRINT
1780 PRINT
1790 REM  FOR AN EXCITING GAME INPUT 234.
1800 DATA 1
1810 DATA 3, 3, 7, 5, 7, 7, 17, 1
1820 DATA 5, 11, 15, 11, 15, 21, 25, 1
1830 DATA 12, 12, 22, 12, 22, 22, 32, 2
1840 DATA 28, 28, 38, 28, 38, 38, 48, 18
1850 DATA .6, .1, .21, .06, .6, .1, .21, .06, .6, .1, .21, .06
1860 DATA .65, .1, .11, .08, .65, .1, .11, .08, .65, .1, .11, .08
1870 DATA .75, .05, .17, .03, .75, .05, .17, .03, .75, .05, .17, .03
1880 END