Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50110/nonam1.gam
There are 2 other files named nonam1.gam in the archive. Click here to see a list.
1780     END;
1790 FOR I:=0 STEP 1 UNTIL 99 DO
1800     IF MF[I]=100 THEN MF[I]:=0;
1810 SL:=EVEN:=YS:=MS:=0;
1820 ML:=YL:=7;
1830 PRINT("WHO FIRST (0=YOU, 1=ME)",NTAB,NCR);
1840 READATA(TTY,I);
1850 IF I<>1 THEN GOTO YRTRN;
1860 MYTRN:
1870 ROUND;
1880 IF ML+MS>100 THEN
1890     BEGIN
1900     PRINT("I WIN");
1910     GOTO SS
1920     END;
1930 MS:=MS+ML;
1940 FOR S:=1,2,3,4 DO
1950     IF Y[S,-1]<>0 AND Y[S,1]<>0 THEN
1960          BEGIN
1970          L:=G[S];
1980          FOR N:=1 STEP 1 UNTIL ST[Y[S,1],0] DO
1990               FOR D:=0,1,2,3 DO
2000                    BEGIN
2010                    SWITCH H:=ILLEG,BLANK,FULL;
2020                    SQ:=ST[Y[S,1],N];
2030                    FOR I:=1 STEP 1 UNTIL 8 DO  P[I,1]:=-1;
2040                    W:=0;
2050                    DIR:=NE[D];
2060                    NX:=SQ;
2070               OTHWAY: DT:=0;
2080                    SW:=1;
2090               RV:  NM:=1;
2100                    FOR I:=0 STEP 1 UNTIL L DO  Z[I]:=Y[S,I];
2110                    FOR I:=1 STEP 1 UNTIL Y[S,0] DO  
2120                         IF Z[I]=YF[NX] THEN
2130                              BEGIN
2140                              Z[I]:=0;
2150                              Z[0]:=Z[0]-1;
2160                              I:=L;
2170                              END;
2180               MORE: NOW:=NX;
2190                    GOTO H[EX(YF,NOW,DIR,NX)+2];
2200               FULL: IF Z[0]<>0 THEN
2210                         FOR I:=1 STEP 1 UNTIL L DO
2220                              IF Z[I]=YF[NX] THEN
2230                                   BEGIN
2240                                   Z[I]:=0;
2250                                   Z[0]:=Z[0]-1;
2260                                   GOTO OKAY;
2270                                   END;
2280                    IF YF[NX]>99 THEN GOTO BLANK;
2290               ILLEG: IF SW<0 THEN GOTO REVSQ;
2300                    SW:=-1;
2310                    NX:=NOW;
2320                    DIR:=-DIR;
2330                    GOTO RV;
2340               BLANK: DT:=DT+SW;
2350                    DIS:=ABS(DT);
2360                    P[W+DIS,1]:=NX;
2370                    P[W+DIS,2]:=PR[DIS]*(L*Y[S,0])^2;
2380                    GOTO OK;
2390               OKAY: DT:=DT+SW;
2400                    DIS:=ABS(DT);
2410               OK:  NM:=NM+1;
2420                    IF NM<L THEN GOTO MORE;
2430                    IF Z[0]>0 THEN
2440               REVSQ:    FOR I:=W+1 STEP 1 UNTIL W+4 DO
2450                              P[I,1]:=-1;
2460                    IF SQ>-1 THEN
2470                         BEGIN
2480                         W:=4;
2490                         NX:=SQ;
2500                         SQ:=-1;
2510                         DIR:=NE[D+4];
2520                         GOTO OTHWAY;
2530                         END;
2540                    FOR I:=1,2,3,4 DO
2550                         FOR J:=5,6,7,8 DO
2560                              IF P[I,1]=P[J,1] THEN P[J,1]:=-1;
2570                    FOR I:=1 STEP 1 UNTIL 8 DO
2580                         BEGIN
2590                         J:=P[I,1];
2600                         IF J<>-1 THEN YF[J]:=YF[J]+P[I,2];
2610                         END;
2620                    END;
2630          END;
2640 FOR I:=1 STEP 1 UNTIL ML DO
2650     BEGIN
2660     II:=0;
2670     FOR J:=1 STEP 1 UNTIL 99 DO
2680          IF (YF[II]<YF[J])
2690               OR  YF[II]=YF[J] AND RANDOM<.33 THEN
2700                    II:=J;
2710     IF YF[II]<100 THEN GOTO OUT;
2720     YF[II]:=SL;
2730     ST[SL,I]:=II;
2740     END;
2750 OUT:
2760 FOR J:=0 STEP 1 UNTIL 99 DO
2770     IF YF[J]>99 THEN YF[J]:=0;
2780 IF I<=ML THEN
2790     BEGIN
2800     XY1:=1;
2810     FOR J:=1,2,3,4 DO
2820          IF Y[J,1]=0 THEN XY1:=G[J];
2830     DIS:=0;
2840     FOR II:=1 STEP 1 UNTIL ML DO
2850          BEGIN
2860     A:   XY:=MD(100);
2870          IF YF[XY]<>0 THEN GOTO A;
2880          FOR D:=0 STEP 1 UNTIL 7 DO
2890               BEGIN
2900               NOW:=XY;
2910               FOR JJ:=2 STEP 1 UNTIL XY1 DO
2920                    IF EX(YF,NOW,NE[D],N)=0
2930                         THEN NOW:=NX
2940                              ELSE GOTO O2;
2950               GOTO O1;
2960          O2:  END;
2970          DIS:=DIS+1;
2980          IF DIS>10 THEN XY1:=1;
2990          GOTO A;
3000     O1:  IF II+1<=ML AND XY1>1 THEN
3010               BEGIN
3020               JJ:=XY+NE[D];
3030               ST[SL,II]:=JJ;
3040               YF[JJ]:=SL;
3050               II:=II+1;
3060               END;
3070         
3080          ST[SL,II]:=XY;
3090          YF[XY]:=SL;
3100          END;
3110     END;
3120 PRINT("MY SHOTS ARE",NTAB,NCR);
3130 FOR I:=1 STEP 1 UNTIL ML DO  PRINT(ST[SL,I],NTAB,NCR);
3140 PRINT;
3150 ST[SL,0]:=ML;
3160 GOTO REP;
3170 R1: PRINT("REPEAT ",NTAB,NCR);
3180 REP:
3190 PRINT("REPORT",NTAB,NCR);
3200 READATA(TTY,HIT[1],HIT[2],HIT[3],HIT[4]);
3210 IF HIT[1]+HIT[2]+HIT[3]+HIT[4]>ML THEN GOTO R1;
3220 FOR I:=1 STEP 1 UNTIL 4 DO
3230     IF HIT[I]+Y[I,0]>G[I] THEN GO TO R1;
3240 FOR I:=1,2,3,4 DO
3250     IF Y[I,-1]<>0 THEN
3260          BEGIN
3270          IF Y[I,0]+HIT[I]=G[I] THEN Y[I,-1]:=0;
3280          FOR II:=1 STEP 1 UNTIL HIT[I] DO
3290               Y[I,Y[I,0]+II]:=SL;
3300          Y[I,0]:=Y[I,0]+HIT[I];
3310          END;
3320 YL:=0;
3330 FOR I:=1,2,3,4 DO YL:=YL+Y[I,-1];
3340 IF YL=0 THEN
3350     BEGIN
3360     PRINT("I WIN");
3370     GOTO TD;
3380     END;
3390 YRTRN:
3400 ROUND;
3410 IF YL+YS>100 THEN
3420     BEGIN
3430     PRINT("YOU WIN");
3440     ML:=YL;
3450     MS:=YS;
3460     GOTO TD;
3470     END;
3480 I:=MD(100);
3490 PRINT("YOUR",NTAB,YL,NTAB,"SHOTS, ",NTAB,NCR);
3500 IF YL<ML THEN PRINT("O LOSING ONE")
3510      ELSE IF I<25 THEN PRINT("JOHN PAUL")
3520          ELSE IF I<50 THEN PRINT("LORD NELSON")
3530               ELSE IF I<75 THEN PRINT("LIEF")
3540                    ELSE PRINT("SIR FRANCIS");
3550 YS:=YS+YL;
3560 FOR I:=0,1,2,3,4 DO HIT[I]:=0;
3570 IF            YL=1 THEN READATA(TTY,Z[1])
3580  ELSE      IF YL=2 THEN READATA(TTY,Z[1],Z[2])
3590   ELSE     IF YL=3 THEN READATA(TTY,Z[1],Z[2],Z[3])
3600    ELSE    IF YL=4 THEN READATA(TTY,Z[1],Z[2],Z[3],Z[4])
3610     ELSE   IF YL=5 THEN READATA(TTY,Z[1],Z[2],Z[3],Z[4],Z[5])
3620      ELSE  IF YL=6 THEN READATA(TTY,Z[1],Z[2],Z[3],Z[4],Z[5],Z[6])
3630       ELSE              READATA(TTY,Z[1],Z[2],Z[3],Z[4],Z[5],Z[6],Z[7]);
3640 FOR K:=1 STEP 1 UNTIL YL DO
3650     BEGIN
3660 GOTO B2;
3670 B1: READATA(TTY,Z[K]);
3680 B2: I:=Z[K];
3690     IF I<0 OR I>99 THEN
3700          BEGIN
3710          PRINT(I,NTAB," IIS OUT OF BOUNDS.");
3720          GOTO B1;
3730          END;
3740     J:=MF[I];
3750     IF J>0 THEN
3760          BEGIN
3770          PRINT(I,NTAB,"WAS TAKEN ON ROUND",NTAB,J);
3780         GOTO B1;
3790          END;
3800     IF J<0 THEN
3810          BEGIN
3820          J:=-J;
3830          HIT[0]:=1;
3840          HIT[J]:=HIT[J]+1;
3850          M[J,0]:=M[J,0]+1;
3860          END;
3870     MF[I]:=SL;
3880     END;
3890 IF HIT[0]=0 THEN PRINT("SPLASH")
3900     ELSE FOR K:=1,2,3,4 DO
3910          IF HIT[K]<>0 THEN
3920               BEGIN
3930               PRINT("YOU HIT MY ",NTAB,NCR);
3940               PS(K);
3950               PRINT(HIT[K],NTAB,"TIMES",NTAB,NCR);
3960               IF M[K,0]=G[K] THEN
3970                    BEGIN
3980                    PRINT(" AND SANK IT",NTAB,NCR);
3990                    M[K,-1]:=0;
4000                    END;
4010               B;
4020               END;
4030 ML:=0;
4040 FOR I:=1,2,3,4 DO ML := ML+M[I,-1];
4050 IF ML<>0 THEN GOTO MYTRN;
4060 B;
4070 B;
4080 PRINT("YOU WIN");
4090 GOTO TD;
4100 SS:
4110 PRINT(100-MS,NTAB,"SQUARES LEFT FOR",NTAB,ML,NTAB,"SHOTS");
4120 TD:
4130 PRINT("MY SHIPS:");
4140 FOR K:=1,2,3,4 DO
4150     BEGIN
4160     PS(K);
4170     FOR J:=1 STEP 1 UNTIL G[K] DO PRINT(M[K,J],NTAB,NCR);
4180     B;
4190     END;
4200 END