add 00_Alternate_Langage folder and move alternate ports there

This commit is contained in:
Jeff Atwood
2022-03-15 20:49:07 -07:00
parent a0931700e9
commit 43f2ec013a
1789 changed files with 85900 additions and 446 deletions

View File

@@ -0,0 +1,9 @@
Please refer to the `readme.md` in the parent folder.
Each subfolder represents a port of this program to a language which is _not_ one of the agreed upon 10 languages, which are intended to meet these three criteria:
1. Popular (by TIOBE index)
2. Memory safe
3. Generally considered a 'scripting' language
We welcome additional ports, but these additional ports are for educational purposes only.

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,22 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Football", "Football.csproj", "{092442FA-EA04-4A80-AB12-138E18CD480A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{092442FA-EA04-4A80-AB12-138E18CD480A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{092442FA-EA04-4A80-AB12-138E18CD480A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{092442FA-EA04-4A80-AB12-138E18CD480A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{092442FA-EA04-4A80-AB12-138E18CD480A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Microsoft C#](https://docs.microsoft.com/en-us/dotnet/csharp/)

View File

@@ -0,0 +1,181 @@
1 PRINT TAB(32);"FOOTBALL"
2 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
3 PRINT:PRINT:PRINT
100 REM
120 DIM A(20),B(20),C(40),H(2),T(2),W(2),X(2),Y(2),Z(2)
130 DIM M$(2),D(2),P$(20)
140 PRINT "PRESENTING N.F.U. FOOTBALL (NO FORTRAN USED)"
145 PRINT:PRINT
150 INPUT "DO YOU WANT INSTRUCTIONS";A$
160 IF A$="NO" THEN 290
165 IF A$<>"YES" THEN 150
170 PRINT "THIS IS A FOOTBALL GAME FOR TWO TEAMS IN WHICH PLAYERS MUST"
180 PRINT "PREPARE A TAPE WITH A DATA STATEMENT (1770 FOR TEAM 1,"
190 PRINT "1780 FOR TEAM 2) IN WHICH EACH TEAM SCRAMBLES NOS. 1-20"
195 PRINT "THESE NUMBERS ARE THEN ASSIGNED TO TWENTY GIVEN PLAYS."
200 PRINT"A LIST OF NOS. AND THEIR PLAYS IS PROVIDED WITH"
210 PRINT "BOTH TEAMS HAVING THE SAME PLAYS. THE MORE SIMILAR THE"
220 PRINT "PLAYS THE LESS YARDAGE GAINED. SCORES ARE GIVEN"
223 PRINT "WHENEVER SCORES ARE MADE. SCORES MAY ALSO BE OBTAINED"
225 PRINT "BY INPUTTING 99,99 FOR PLAY NOS. TO PUNT OR ATTEMPT A"
227 PRINT "FIELD GOAL, INPUT 77,77 FOR PLAY NUMBERS. QUESTIONS WILL BE"
230 PRINT "ASKED THEN. ON 4TH DOWN, YOU WILL ALSO BE ASKED WHETHER"
240 PRINT "YOU WANT TO PUNT OR ATTEMPT A FIELD GOAL. IF THE ANSWER TO"
250 PRINT "BOTH QUESTIONS IS NO IT WILL BE ASSUMED YOU WANT TO"
260 PRINT "TRY AND GAIN YARDAGE. ANSWER ALL QUESTIONS YES OR NO."
270 PRINT "THE GAME IS PLAYED UNTIL PLAYERS TERMINATE (CONTROL-C)."
280 PRINT "PLEASE PREPARE A TAPE AND RUN.": STOP
290 PRINT:PRINT "PLEASE INPUT SCORE LIMIT ON GAME";:INPUT E
300 FOR I=1 TO 40: READ N: IF I>20 THEN 350
330 A(N)=I: GOTO 360
350 B(N)=I-20
360 C(I)=N: NEXT I
370 FOR I=1 TO 20: READ P$(I): NEXT I
380 L=0: T=1
410 PRINT "TEAM";T;"PLAY CHART"
420 PRINT "NO. PLAY"
430 FOR I=1 TO 20
440 REM
450 PRINT C(I+L);TAB(6);P$(I)
460 NEXT I
630 L=L+20:T=2
640 PRINT
650 PRINT "TEAR OFF HERE----------------------------------------------"
660 FOR X=1 TO 11: PRINT: NEXT X
670 FOR Z=1 TO 3000: NEXT Z
680 IF L=20 THEN 410
690 D(1)=0: D(2)=3: M$(1)="--->": M$(2)="<---"
700 H(1)=0: H(2)=0: T(1)=2: T(2)=1
710 W(1)=-1: W(2)=1: X(1)=100: X(2)=0
720 Y(1)=1: Y(2)=-1: Z(1)=0: Z(2)=100
725 GOSUB 1910
730 PRINT "TEAM 1 DEFENDS 0 YD GOAL -- TEAM 2 DEFENDS 100 YD GOAL."
740 T=INT(2*RND(1)+1)
760 PRINT: PRINT "THE COIN IS FLIPPED"
765 P=X(T)-Y(T)*40
770 GOSUB 1860: PRINT : PRINT "TEAM";T;"RECEIVES KICK-OFF"
780 K=INT(26*RND(1)+40)
790 P=P-Y(T)*K
794 IF W(T)*P<Z(T)+10 THEN 810
795 PRINT: PRINT "BALL WENT OUT OF ENDZONE --AUTOMATIC TOUCHBACK--"
796 GOTO 870
810 PRINT "BALL WENT";K;"YARDS. NOW ON";P:GOSUB 1900
830 PRINT "TEAM";T;"DO YOU WANT TO RUNBACK";:INPUT A$
840 IF A$="YES" THEN 1430
845 IF A$<>"NO" THEN 830
850 IF W(T)*P<Z(T) THEN 880
870 P=Z(T)-W(T)*20
880 D=1: S=P
885 FOR I=1 TO 72: PRINT "=";: NEXT I
890 PRINT: PRINT "TEAM";T;"DOWN";D;"ON";P
893 IF D<>1 THEN 900
895 IF Y(T)*(P+Y(T)*10)>=X(T) THEN 898
897 C=4: GOTO 900
898 C=8
900 IF C=8 THEN 904
901 PRINT TAB(27);10-(Y(T)*P-Y(T)*S);"YARDS TO 1ST DOWN"
902 GOTO 910
904 PRINT TAB(27);X(T)-Y(T)*P;"YARDS"
910 GOSUB 1900: IF D=4 THEN 1180
920 REM
930 U=INT(3*RND(0)-1): GOTO 940
936 PRINT "ILLEGAL PLAY NUMBER, CHECK AND"
940 PRINT "INPUT OFFENSIVE PLAY, DEFENSIVE PLAY";
950 IF T=2 THEN 970
960 INPUT P1,P2: GOTO 975
970 INPUT P2,P1
975 IF P1=77 THEN 1180
980 IF P1>20 THEN 1800
985 IF P1<1 THEN 1800
990 IF P2>20 THEN 1800
992 IF P2<1 THEN 1800
995 P1=INT(P1): P2=INT(P2)
1000 Y=INT(ABS(A(P1)-B(P2))/19*((X(T)-Y(T)*P+25)*RND(1)-15))
1005 PRINT: IF T=2 THEN 1015
1010 IF A(P1)<11 THEN 1048
1012 GOTO 1020
1015 IF B(P2)<11 THEN 1048
1020 IF U<>0 THEN 1035
1025 PRINT "PASS INCOMPLETE TEAM";T
1030 Y=0: GOTO 1050
1035 G=RND(1): IF G>.025 THEN 1040
1037 IF Y>2 THEN 1045
1040 PRINT "QUARTERBACK SCRAMBLED": GOTO 1050
1045 PRINT "PASS COMPLETED": GOTO 1050
1048 PRINT "THE BALL WAS RUN"
1050 P=P-W(T)*Y
1060 PRINT: PRINT "NET YARDS GAINED ON DOWN";D;"ARE ";Y
1070 G=RND(1): IF G>.025 THEN 1110
1080 PRINT: PRINT "** LOSS OF POSSESSION FROM TEAM";T;"TO TEAM";T(T)
1100 GOSUB 1850: PRINT: T=T(T): GOTO 830
1110 IF Y(T)*P>=X(T) THEN 1320
1120 IF W(T)*P>=Z(T) THEN 1230
1130 IF Y(T)*P-Y(T)*S>=10 THEN 880
1140 D=D+1: IF D<>5 THEN 885
1160 PRINT: PRINT "CONVERSION UNSUCCESSFUL TEAM";T:T=T(T)
1170 GOSUB 1850: GOTO 880
1180 PRINT "DOES TEAM";T;"WANT TO PUNT";: INPUT A$
1185 IF A$="NO" THEN 1200
1187 IF A$<>"YES" THEN 1180
1190 PRINT:PRINT "TEAM";T;"WILL PUNT": G=RND(1): IF G<.025 THEN 1080
1195 GOSUB 1850: K=INT(25*RND(1)+35): T=T(T): GOTO 790
1200 PRINT "DOES TEAM";T;"WANT TO ATTEMPT A FIELD GOAL";: INPUT A$
1210 IF A$="YES" THEN 1640
1215 IF A$<>"NO" THEN 1200
1217 GOTO 920
1230 PRINT: PRINT "SAFETY AGAINST TEAM";T;"**********************OH-OH"
1240 H(T(T))=H(T(T))+2: GOSUB 1810
1280 PRINT"TEAM";T;"DO YOU WANT TO PUNT INSTEAD OF A KICKOFF";:INPUT A$
1290 P=Z(T)-W(T)*20: IF A$="YES" THEN 1190
1320 PRINT: PRINT "TOUCHDOWN BY TEAM";T;"*********************YEA TEAM"
1340 Q=7: G=RND(1): IF G>.1 THEN 1380
1360 Q=6: PRINT "EXTRA POINT NO GOOD": GOTO 1390
1380 PRINT "EXTRA POINT GOOD"
1390 H(T)=H(T)+Q: GOSUB 1810
1420 T=T(T): GOTO 765
1430 K=INT(9*RND(0)+1)
1440 R=INT(((X(T)-Y(T)*P+25)*RND(1)-15)/K)
1460 P=P-W(T)*R
1480 PRINT:PRINT "RUNBACK TEAM";T;R;"YARDS"
1485 G=RND(1): IF G<.025 THEN 1080
1490 IF Y(T)*P>=X(T) THEN 1320
1500 IF W(T)*P>=Z(T) THEN 1230
1510 GOTO 880
1640 PRINT: PRINT "TEAM";T;"WILL ATTEMPT A FIELD GOAL"
1645 G=RND(1): IF G<.025 THEN 1080
1650 F=INT(35*RND(1)+20)
1660 PRINT: PRINT "KICK IS";F;"YARDS LONG"
1680 P=P-W(T)*F: G=RND(1)
1690 IF G<.35 THEN 1735
1700 IF Y(T)*P<X(T) THEN 1740
1710 PRINT "FIELD GOAL GOOD FOR TEAM";T;"*********************YEA"
1720 Q=3: GOTO 1390
1735 PRINT "BALL WENT WIDE"
1740 PRINT "FIELD GOAL UNSUCCESFUL TEAM";T;"-----------------TOO BAD"
1742 GOSUB 1850: IF Y(T)*P<X(T)+10 THEN 1745
1744 T=T(T): GOTO 794
1745 PRINT: PRINT "BALL NOW ON";P
1750 T=T(T): GOSUB 1900: GOTO 830
1770 DATA 17,8,4,14,19,3,10,1,7,11,15,9,5,20,13,18,16,2,12,6
1780 DATA 20,2,17,5,8,18,12,11,1,4,19,14,10,7,9,15,6,13,16,3
1790 DATA "PITCHOUT","TRIPLE REVERSE","DRAW","QB SNEAK","END AROUND"
1792 DATA "DOUBLE REVERSE","LEFT SWEEP","RIGHT SWEEP","OFF TACKLE"
1794 DATA "WISHBONE OPTION","FLARE PASS","SCREEN PASS"
1796 DATA "ROLL OUT OPTION","RIGHT CURL","LEFT CURL","WISHBONE OPTION"
1798 DATA "SIDELINE PASS","HALF-BACK OPTION","RAZZLE-DAZZLE","BOMB!!!!"
1800 IF P1<>99 THEN 936
1810 PRINT: PRINT "TEAM 1 SCORE IS";H(1)
1820 PRINT "TEAM 2 SCORE IS";H(2): PRINT
1825 IF H(T)<E THEN 1830
1827 PRINT "TEAM";T;"WINS*******************": GOTO 2000
1830 IF P1=99 THEN 940
1835 RETURN
1850 PRINT
1860 FOR X=1 TO 72: PRINT "+";: NEXT X: PRINT
1870 RETURN
1900 PRINT TAB(D(T)+5+P/2);M$(T)
1910 PRINT "TEAM 1 [0 10 20 30 40 50 60 70 80 90";
1915 PRINT " 100] TEAM 2"
1920 PRINT
1930 RETURN
2000 END

View File

@@ -0,0 +1,298 @@
10 PRINT TAB(33);"FTBALL"
20 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY"
30 PRINT:PRINT
220 PRINT "THIS IS DARTMOUTH CHAMPIONSHIP FOOTBALL.":PRINT
230 PRINT "YOU WILL QUARTERBACK DARTMOUTH. CALL PLAYS AS FOLLOWS:"
240 PRINT "1= SIMPLE RUN; 2= TRICKY RUN; 3= SHORT PASS;"
250 PRINT "4= LONG PASS; 5= PUNT; 6= QUICK KICK; 7= PLACE KICK."
260 PRINT
270 PRINT "CHOOSE YOUR OPPONENT";
280 INPUT O$(1)
290 O$(0)="DARTMOUTH"
300 PRINT
310 LET S(0)=0: LET S(1)=0
320 REM
330 DIM L$(20)
340 FOR I=1 TO 20: READ L$(I): NEXT I
350 DATA "KICK","RECEIVE"," YARD ","RUN BACK FOR ","BALL ON "
360 DATA "YARD LINE"," SIMPLE RUN"," TRICKY RUN"," SHORT PASS"
370 DATA " LONG PASS","PUNT"," QUICK KICK "," PLACE KICK"," LOSS "
380 DATA " NO GAIN","GAIN "," TOUCHDOWN "," TOUCHBACK ","SAFETY***"
385 DATA "JUNK"
390 LET P=INT(RND(1)*2)
400 PRINT O$(P);" WON THE TOSS"
410 DEF FNF(X)=1-2*P
420 DEF FNG(Z)=P*(X1-X)+(1-P)*(X-X1)
430 IF P=0 THEN 470
440 PRINT O$(1);" ELECTS TO RECEIVE."
450 PRINT
460 GOTO 580
470 PRINT "DO YOU ELECT TO KICK OR RECEIVE";
480 INPUT A$
490 PRINT
500 FOR E=1 TO 2
510 IF A$=L$(E) THEN 550
520 NEXT E
530 PRINT "INCORRECT ANSWER. PLEASE TYPE 'KICK' OR 'RECEIVE'";
540 GOTO 480
550 IF E=2 THEN 580
560 LET P=1
580 LET X=40+(1-P)*20
590 LET Y=INT(200*(RND(1)-.5)^3+55)
600 PRINT Y;L$(3);" KICKOFF"
610 LET X=X-FNF(1)*Y
620 IF ABS(X-50)>=50 THEN 700
630 LET Y=INT(50*RND(1)^2)+(1-P)*INT(50*RND(1)^4)
640 LET X=X+FNF(1)*Y
650 IF ABS(X-50)>=50 THEN 655
651 PRINT Y;L$(3);" RUNBACK"
652 GOTO 720
655 PRINT L$(4);
660 GOTO 2600
700 PRINT "TOUCHBACK FOR ";O$(P);"."
710 LET X=20+P*60
720 REM FIRST DOWN
730 GOSUB 800
740 LET X1=X
750 LET D=1
760 PRINT:PRINT "FIRST DOWN ";O$(P);"***"
770 PRINT
780 PRINT
790 GOTO 860
800 REM PRINT POSITION
810 IF X>50 THEN 840
820 PRINT L$(5);O$(0);X;L$(6)
830 GOTO 850
840 PRINT L$(5);O$(1);100-X;L$(6)
850 RETURN
860 REM NEW PLAY
870 LET T=T+1
880 IF T=30 THEN 1060
890 IF T<50 THEN 940
900 IF RND(1)>.2 THEN 940
910 PRINT "END OF GAME ***"
920 PRINT "FINAL SCORE: ";O$(0);": ";S(0);" ";O$(1);": ";S(1)
930 STOP
940 IF P=1 THEN 1870
950 PRINT "NEXT PLAY";
960 INPUT Z
970 IF Z<>INT(Z) THEN 990
980 IF ABS(Z-4)<=3 THEN 1010
990 PRINT "ILLEGAL PLAY NUMBER, RETYPE";
1000 GOTO 960
1010 LET F=0
1020 PRINT L$(Z+6);". ";
1030 LET R=RND(1)*(.98+FNF(1)*.02)
1040 LET R1=RND(1)
1050 ON Z GOTO 1110,1150,1260,1480,1570,1570,1680
1060 REM JEAN'S SPECIAL
1070 IF RND(1)> 1/3 THEN 940
1080 PRINT "GAME DELAYED. DOG ON FIELD."
1090 PRINT
1100 GOTO 940
1110 REM SIMPLE RUN
1120 LET Y=INT(24*(R-.5)^3+3)
1130 IF RND(1)<.05 THEN 1180
1140 GOTO 2190
1150 REM TRICKY RUN
1160 LET Y=INT(20*R-5)
1170 IF RND(1)>.1 THEN 2190
1180 LET F=-1
1190 LET X3=X
1200 LET X=X+FNF(1)*Y
1210 IF ABS(X-50)>=50 THEN 1240
1220 PRINT "*** FUMBLE AFTER ";
1230 GOTO 2230
1240 PRINT "*** FUMBLE."
1250 GOTO 2450
1260 REM SHORT PASS
1270 LET Y=INT(60*(R1-.5)^3+10)
1280 IF R<.05 THEN 1330
1290 IF R<.15 THEN 1390
1300 IF R<.55 THEN 1420
1310 PRINT "COMPLETE. ";
1320 GOTO 2190
1330 IF D=4 THEN 1420
1340 PRINT "INTERCEPTED."
1350 LET F=-1
1360 LET X=X+FNF(1)*Y
1370 IF ABS(X-50)>=50 THEN 2450
1380 GOTO 2300
1390 PRINT "PASSER TACKLED. ";
1400 LET Y=-INT(10*R1)
1410 GOTO 2190
1420 LET Y=0
1430 IF RND(1)<.3 THEN 1460
1440 PRINT "INCOMPLETE. ";
1450 GOTO 2190
1460 PRINT "BATTED DOWN. ";
1470 GOTO 2190
1480 REM LONG PASS
1490 LET Y=INT(160*(R1-.5)^3+30)
1500 IF R<.1 THEN 1330
1510 IF R<.3 THEN 1540
1520 IF R<.75 THEN 1420
1530 GOTO 1310
1540 PRINT "PASSER TACKLED. ";
1550 LET Y=-INT(15*R1+3)
1560 GOTO 2190
1570 REM PUNT OR KICK
1580 LET Y=INT(100*(R-.5)^3+35)
1590 IF D=4 THEN 1610
1600 LET Y=INT(Y*1.3)
1610 PRINT Y;L$(3);" PUNT"
1620 IF ABS(X+Y*FNF(1)-50)>=50 THEN 1670
1630 IF D<4 THEN 1670
1640 LET Y1=INT(R1^2*20)
1650 PRINT Y1;L$(3);" RUN BACK"
1660 LET Y=Y-Y1
1670 GOTO 1350
1680 REM PLACE KICK
1690 LET Y=INT(100*(R-.5)^3+35)
1700 IF R1>.15 THEN 1750
1710 PRINT "KICK IS BLOCKED ***"
1720 LET X=X-5*FNF(1)
1730 LET P=1-P
1740 GOTO 720
1750 LET X=X+FNF(1)*Y
1760 IF ABS(X-50)>=60 THEN 1810
1770 PRINT "KICK IS SHORT."
1780 IF ABS(X-50)>=50 THEN 2710
1790 P=1-P
1800 GOTO 630
1810 IF R1>.5 THEN 1840
1820 PRINT "KICK IS OFF TO THE SIDE."
1830 GOTO 2710
1840 PRINT "FIELD GOAL ***"
1850 LET S(P)=S(P)+3
1860 GOTO 2640
1870 REM OPPONENT'S PLAY
1880 IF D>1 THEN 1940
1890 IF RND(1)>1/3 THEN 1920
1900 LET Z=3
1910 GOTO 1010
1920 LET Z=1
1930 GOTO 1010
1940 IF D=4 THEN 2090
1950 IF 10+X-X1<5 THEN 1890
1960 IF X<5 THEN 1890
1970 IF X<=10 THEN 2160
1980 IF X>X1 THEN 2020
1990 LET A=INT(2*RND(1))
2000 LET Z=2+A*2
2010 GOTO 1010
2020 IF D<3 THEN 1990
2030 IF X<45 THEN 1990
2040 IF RND(1)>1/4 THEN 2070
2050 LET Z=6
2060 GOTO 1010
2070 LET Z=4
2080 GOTO 1010
2090 IF X>30 THEN 2140
2100 IF 10+X-X1<3 THEN 1890
2110 IF X<3 THEN 1890
2120 LET Z=7
2130 GOTO 1010
2140 LET Z=5
2150 GOTO 1010
2160 LET A=INT(2*RND(1))
2170 LET Z=2+A
2180 GOTO 1010
2190 REM GAIN OR LOSS
2200 LET X3=X
2210 LET X=X+FNF(1)*Y
2220 IF ABS(X-50)>=50 THEN 2450
2230 IF Y=0 THEN 2250
2240 PRINT ABS(Y);L$(3);
2250 PRINT L$(15+SGN(Y))
2280 IF ABS(X3-50)>40 THEN 2300
2290 IF RND(1)<.1 THEN 2860
2300 GOSUB 800
2310 IF F=0 THEN 2340
2320 LET P=1-P
2330 GOTO 740
2340 IF FNG(1)>=10 THEN 740
2350 IF D=4 THEN 2320
2360 LET D=D+1
2370 PRINT "DOWN: ";D;" ";
2380 IF (X1-50)*FNF(1)<40 THEN 2410
2390 PRINT "GOAL TO GO"
2400 GOTO 2420
2410 PRINT "YARDS TO GO: ";10-FNG(1)
2420 PRINT
2430 PRINT
2440 GOTO 860
2450 REM BALL IN END-ZONE
2460 IF X>=100 THEN 2490
2470 LET E=0
2480 GOTO 2500
2490 LET E=1
2500 ON 1+E-F*2+P*4 GOTO 2510,2590,2760,2710,2590,2510,2710,2760
2510 REM SAFETY
2520 LET S(1-P)=S(1-P)+2
2530 PRINT L$(19)
2540 GOSUB 2800
2550 PRINT O$(P);" KICKS OFF FROM ITS 20 YARD LINE."
2560 LET X=20+P*60
2570 LET P=1-P
2580 GOTO 590
2590 REM OFFENSIVE TD
2600 PRINT L$(17);"***"
2610 IF RND(1)>.8 THEN 2680
2620 LET S(P)=S(P)+7
2630 PRINT "KICK IS GOOD."
2640 GOSUB 2800
2650 PRINT O$(P);" KICKS OFF"
2660 LET P=1-P
2670 GOTO 580
2680 PRINT "KICK IS OFF TO THE SIDE"
2690 LET S(P)=S(P)+6
2700 GOTO 2640
2710 REM TOUCHBACK
2720 PRINT L$(18)
2730 LET P=1-P
2740 LET X=20+P*60
2750 GOTO 720
2760 REM DEFENSIVE TD
2770 PRINT L$(17);"FOR ";O$(1-P);"***"
2780 LET P=1-P
2790 GOTO 2600
2800 REM SCORE
2810 PRINT
2820 PRINT "SCORE: ";S(0);" TO ";S(1)
2830 PRINT
2840 PRINT
2850 RETURN
2860 REM PENALTY
2870 LET P3=INT(2*RND(1))
2880 PRINT O$(P3);" OFFSIDES -- PENALTY OF 5 YARDS."
2890 PRINT
2900 PRINT
2910 IF P3=0 THEN 2980
2920 PRINT "DO YOU ACCEPT THE PENALTY";
2930 INPUT A$
2940 IF A$="NO" THEN 2300
2950 IF A$="YES" THEN 3110
2960 PRINT "TYPE 'YES' OR 'NO'";
2970 GOTO 2930
2980 REM OPPONENT'S STRATEGY ON PENALTY
2990 IF P=1 THEN 3040
3000 IF Y<=0 THEN 3080
3010 IF F<0 THEN 3080
3020 IF FNG(1)<3*D-2 THEN 3080
3030 GOTO 3100
3040 IF Y<=5 THEN 3100
3050 IF F<0 THEN 3100
3060 IF D<4 THEN 3080
3070 IF FNG(1)<10 THEN 3100
3080 PRINT "PENALTY REFUSED."
3090 GOTO 2300
3100 PRINT "PENALTY ACCEPTED."
3110 LET F=0
3120 LET D=D-1
3130 IF P<>P3 THEN 3160
3140 LET X=X3-FNF(1)*5
3150 GOTO 2300
3160 LET X=X3+FNF(1)*5
3170 GOTO 2300
3180 END

View File

@@ -0,0 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Oracle Java](https://openjdk.java.net/)

View File

@@ -0,0 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Shells)

View File

@@ -0,0 +1,9 @@
<html>
<head>
<title>FOOTBALL</title>
</head>
<body>
<pre id="output" style="font-size: 12pt;"></pre>
<script src="football.js"></script>
</body>
</html>

View File

@@ -0,0 +1,504 @@
// FOOTBALL
//
// Converted from BASIC to Javascript by Oscar Toledo G. (nanochess)
//
function print(str)
{
document.getElementById("output").appendChild(document.createTextNode(str));
}
function input()
{
var input_element;
var input_str;
return new Promise(function (resolve) {
input_element = document.createElement("INPUT");
print("? ");
input_element.setAttribute("type", "text");
input_element.setAttribute("length", "50");
document.getElementById("output").appendChild(input_element);
input_element.focus();
input_str = undefined;
input_element.addEventListener("keydown", function (event) {
if (event.keyCode == 13) {
input_str = input_element.value;
document.getElementById("output").removeChild(input_element);
print(input_str);
print("\n");
resolve(input_str);
}
});
});
}
function tab(space)
{
var str = "";
while (space-- > 0)
str += " ";
return str;
}
var player_data = [17,8,4,14,19,3,10,1,7,11,15,9,5,20,13,18,16,2,12,6,
20,2,17,5,8,18,12,11,1,4,19,14,10,7,9,15,6,13,16,3];
var aa = [];
var ba = [];
var ca = [];
var ha = [];
var ta = [];
var wa = [];
var xa = [];
var ya = [];
var za = [];
var ms = [];
var da = [];
var ps = [, "PITCHOUT","TRIPLE REVERSE","DRAW","QB SNEAK","END AROUND",
"DOUBLE REVERSE","LEFT SWEEP","RIGHT SWEEP","OFF TACKLE",
"WISHBONE OPTION","FLARE PASS","SCREEN PASS",
"ROLL OUT OPTION","RIGHT CURL","LEFT CURL","WISHBONE OPTION",
"SIDELINE PASS","HALF-BACK OPTION","RAZZLE-DAZZLE","BOMB!!!!"];
var p;
var t;
function field_headers()
{
print("TEAM 1 [0 10 20 30 40 50 60 70 80 90");
print(" 100] TEAM 2\n");
print("\n");
}
function separator()
{
str = "";
for (x = 1; x <= 72; x++)
str += "+";
print(str + "\n");
}
function show_ball()
{
print(tab(da[t] + 5 + p / 2) + ms[t] + "\n");
field_headers();
}
function show_scores()
{
print("\n");
print("TEAM 1 SCORE IS " + ha[1] + "\n");
print("TEAM 2 SCORE IS " + ha[2] + "\n");
print("\n");
if (ha[t] >= e) {
print("TEAM " + t + " WINS*******************");
return true;
}
return false;
}
function loss_posession() {
print("\n");
print("** LOSS OF POSSESSION FROM TEAM " + t + " TO TEAM " + ta[t] + "\n");
print("\n");
separator();
print("\n");
t = ta[t];
}
function touchdown() {
print("\n");
print("TOUCHDOWN BY TEAM " + t + " *********************YEA TEAM\n");
q = 7;
g = Math.random();
if (g <= 0.1) {
q = 6;
print("EXTRA POINT NO GOOD\n");
} else {
print("EXTRA POINT GOOD\n");
}
ha[t] = ha[t] + q;
}
// Main program
async function main()
{
print(tab(32) + "FOOTBALL\n");
print(tab(15) + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n");
print("\n");
print("\n");
print("\n");
print("PRESENTING N.F.U. FOOTBALL (NO FORTRAN USED)\n");
print("\n");
print("\n");
while (1) {
print("DO YOU WANT INSTRUCTIONS");
str = await input();
if (str == "YES" || str == "NO")
break;
}
if (str == "YES") {
print("THIS IS A FOOTBALL GAME FOR TWO TEAMS IN WHICH PLAYERS MUST\n");
print("PREPARE A TAPE WITH A DATA STATEMENT (1770 FOR TEAM 1,\n");
print( "1780 FOR TEAM 2) IN WHICH EACH TEAM SCRAMBLES NOS. 1-20\n");
print("THESE NUMBERS ARE THEN ASSIGNED TO TWENTY GIVEN PLAYS.\n");
print("A LIST OF NOS. AND THEIR PLAYS IS PROVIDED WITH\n");
print("BOTH TEAMS HAVING THE SAME PLAYS. THE MORE SIMILAR THE\n");
print("PLAYS THE LESS YARDAGE GAINED. SCORES ARE GIVEN\n");
print("WHENEVER SCORES ARE MADE. SCORES MAY ALSO BE OBTAINED\n");
print("BY INPUTTING 99,99 FOR PLAY NOS. TO PUNT OR ATTEMPT A\n");
print("FIELD GOAL, INPUT 77,77 FOR PLAY NUMBERS. QUESTIONS WILL BE\n");
print("ASKED THEN. ON 4TH DOWN, YOU WILL ALSO BE ASKED WHETHER\n");
print("YOU WANT TO PUNT OR ATTEMPT A FIELD GOAL. IF THE ANSWER TO\n");
print("BOTH QUESTIONS IS NO IT WILL BE ASSUMED YOU WANT TO\n");
print("TRY AND GAIN YARDAGE. ANSWER ALL QUESTIONS YES OR NO.\n");
print("THE GAME IS PLAYED UNTIL PLAYERS TERMINATE (CONTROL-C).\n");
print("PLEASE PREPARE A TAPE AND RUN.\n");
}
print("\n");
print("PLEASE INPUT SCORE LIMIT ON GAME");
e = parseInt(await input());
for (i = 1; i <= 40; i++) {
if (i <= 20) {
aa[player_data[i - 1]] = i;
} else {
ba[player_data[i - 1]] = i - 20;
}
ca[i] = player_data[i - 1];
}
l = 0;
t = 1;
do {
print("TEAM " + t + " PLAY CHART\n");
print("NO. PLAY\n");
for (i = 1; i <= 20; i++) {
str = "" + ca[i + l];
while (str.length < 6)
str += " ";
str += ps[i];
print(str + "\n");
}
l += 20;
t = 2;
print("\n");
print("TEAR OFF HERE----------------------------------------------\n");
for (x = 1; x <= 11; x++)
print("\n");
} while (l == 20) ;
da[1] = 0;
da[2] = 3;
ms[1] = "--->";
ms[2] = "<---";
ha[1] = 0;
ha[2] = 0;
ta[1] = 2;
ta[2] = 1;
wa[1] = -1;
wa[2] = 1;
xa[1] = 100;
xa[2] = 0;
ya[1] = 1;
ya[2] = -1;
za[1] = 0;
za[2] = 100;
p = 0;
field_headers();
print("TEAM 1 DEFEND 0 YD GOAL -- TEAM 2 DEFENDS 100 YD GOAL.\n");
t = Math.floor(2 * Math.random() + 1);
print("\n");
print("THE COIN IS FLIPPED\n");
routine = 1;
while (1) {
if (routine <= 1) {
p = xa[t] - ya[t] * 40;
separator();
print("\n");
print("TEAM " + t + " RECEIVES KICK-OFF\n");
k = Math.floor(26 * Math.random() + 40);
}
if (routine <= 2) {
p = p - ya[t] * k;
}
if (routine <= 3) {
if (wa[t] * p >= za[t] + 10) {
print("\n");
print("BALL WENT OUT OF ENDZONE --AUTOMATIC TOUCHBACK--\n");
p = za[t] - wa[t] * 20;
if (routine <= 4)
routine = 5;
} else {
print("BALL WENT " + k + " YARDS. NOW ON " + p + "\n");
show_ball();
}
}
if (routine <= 4) {
while (1) {
print("TEAM " + t + " DO YOU WANT TO RUNBACK");
str = await input();
if (str == "YES" || str == "NO")
break;
}
if (str == "YES") {
k = Math.floor(9 * Math.random() + 1);
r = Math.floor(((xa[t] - ya[t] * p + 25) * Math.random() - 15) / k);
p = p - wa[t] * r;
print("\n");
print("RUNBACK TEAM " + t + " " + r + " YARDS\n");
g = Math.random();
if (g < 0.25) {
loss_posession();
routine = 4;
continue;
} else if (ya[t] * p >= xa[t]) {
touchdown();
if (show_scores())
return;
t = ta[t];
routine = 1;
continue;
} else if (wa[t] * p >= za[t]) {
print("\n");
print("SAFETY AGAINST TEAM " + t + " **********************OH-OH\n");
ha[ta[t]] = ha[ta[t]] + 2;
if (show_scores())
return;
print("TEAM " + t + " DO YOU WANT TO PUNT INSTEAD OF A KICKOFF");
str = await input();
p = za[t] - wa[t] * 20;
if (str == "YES") {
print("\n");
print("TEAM " + t + " WILL PUNT\n");
g = Math.random();
if (g < 0.25) {
loss_posession();
routine = 4;
continue;
}
print("\n");
separator();
k = Math.floor(25 * Math.random() + 35);
t = ta[t];
routine = 2;
continue;
}
touchdown();
if (show_scores())
return;
t = ta[t];
routine = 1;
continue;
} else {
routine = 5;
continue;
}
} else if (str == "NO") {
if (wa[t] * p >= za[t])
p = za[t] - wa[t] * 20;
}
}
if (routine <= 5) {
d = 1;
s = p;
}
if (routine <= 6) {
str = "";
for (i = 1; i <= 72; i++)
str += "=";
print(str + "\n");
print("TEAM " + t + " DOWN " + d + " ON " + p + "\n");
if (d == 1) {
if (ya[t] * (p + ya[t] * 10) >= xa[t])
c = 8;
else
c = 4;
}
if (c != 8) {
print(tab(27) + (10 - (ya[t] * p - ya[t] * s)) + " YARDS TO 1ST DOWN\n");
} else {
print(tab(27) + (xa[t] - ya[t] * p) + " YARDS\n");
}
show_ball();
if (d == 4)
routine = 8;
}
if (routine <= 7) {
u = Math.floor(3 * Math.random() - 1);
while (1) {
print("INPUT OFFENSIVE PLAY, DEFENSIVE PLAY");
str = await input();
if (t == 1) {
p1 = parseInt(str);
p2 = parseInt(str.substr(str.indexOf(",") + 1));
} else {
p2 = parseInt(str);
p1 = parseInt(str.substr(str.indexOf(",") + 1));
}
if (p1 == 99) {
if (show_scores())
return;
if (p1 == 99)
continue;
}
if (p1 < 1 || p1 > 20 || p2 < 1 || p2 > 20) {
print("ILLEGAL PLAY NUMBER, CHECK AND\n");
continue;
}
break;
}
}
if (d == 4 || p1 == 77) {
while (1) {
print("DOES TEAM " + t + " WANT TO PUNT");
str = await input();
if (str == "YES" || str == "NO")
break;
}
if (str == "YES") {
print("\n");
print("TEAM " + t + " WILL PUNT\n");
g = Math.random();
if (g < 0.25) {
loss_posession();
routine = 4;
continue;
}
print("\n");
separator();
k = Math.floor(25 * Math.random() + 35);
t = ta[t];
routine = 2;
continue;
}
while (1) {
print("DOES TEAM " + t + " WANT TO ATTEMPT A FIELD GOAL");
str = await input();
if (str == "YES" || str == "NO")
break;
}
if (str == "YES") {
print("\n");
print("TEAM " + t + " WILL ATTEMPT A FIELD GOAL\n");
g = Math.random();
if (g < 0.025) {
loss_posession();
routine = 4;
continue;
} else {
f = Math.floor(35 * Math.random() + 20);
print("\n");
print("KICK IS " + f + " YARDS LONG\n");
p = p - wa[t] * f;
g = Math.random();
if (g < 0.35) {
print("BALL WENT WIDE\n");
} else if (ya[t] * p >= xa[t]) {
print("FIELD GOLD GOOD FOR TEAM " + t + " *********************YEA");
q = 3;
ha[t] = ha[t] + q;
if (show_scores())
return;
t = ta[t];
routine = 1;
continue;
}
print("FIELD GOAL UNSUCCESFUL TEAM " + t + "-----------------TOO BAD\n");
print("\n");
separator();
if (ya[t] * p < xa[t] + 10) {
print("\n");
print("BALL NOW ON " + p + "\n");
t = ta[t];
show_ball();
routine = 4;
continue;
} else {
t = ta[t];
routine = 3;
continue;
}
}
} else {
routine = 7;
continue;
}
}
y = Math.floor(Math.abs(aa[p1] - ba[p2]) / 19 * ((xa[t] - ya[t] * p + 25) * Math.random() - 15));
print("\n");
if (t == 1 && aa[p1] < 11 || t == 2 && ba[p2] < 11) {
print("THE BALL WAS RUN\n");
} else if (u == 0) {
print("PASS INCOMPLETE TEAM " + t + "\n");
y = 0;
} else {
g = Math.random();
if (g <= 0.025 && y > 2) {
print("PASS COMPLETED\n");
} else {
print("QUARTERBACK SCRAMBLED\n");
}
}
p = p - wa[t] * y;
print("\n");
print("NET YARDS GAINED ON DOWN " + d + " ARE " + y + "\n");
g = Math.random();
if (g <= 0.025) {
loss_posession();
routine = 4;
continue;
} else if (ya[t] * p >= xa[t]) {
touchdown();
if (show_scores())
return;
t = ta[t];
routine = 1;
continue;
} else if (wa[t] * p >= za[t]) {
print("\n");
print("SAFETY AGAINST TEAM " + t + " **********************OH-OH\n");
ha[ta[t]] = ha[ta[t]] + 2;
if (show_scores())
return;
print("TEAM " + t + " DO YOU WANT TO PUNT INSTEAD OF A KICKOFF");
str = await input();
p = za[t] - wa[t] * 20;
if (str == "YES") {
print("\n");
print("TEAM " + t + " WILL PUNT\n");
g = Math.random();
if (g < 0.25) {
loss_posession();
routine = 4;
continue;
}
print("\n");
separator();
k = Math.floor(25 * Math.random() + 35);
t = ta[t];
routine = 2;
continue;
}
touchdown();
if (show_scores())
return;
t = ta[t];
routine = 1;
} else if (ya[t] * p - ya[t] * s >= 10) {
routine = 5;
} else {
d++;
if (d != 5) {
routine = 6;
} else {
print("\n");
print("CONVERSION UNSUCCESSFUL TEAM " + t + "\n");
t = ta[t];
print("\n");
separator();
routine = 5;
}
}
}
}
main();

View File

@@ -0,0 +1,9 @@
<html>
<head>
<title>FTBALL</title>
</head>
<body>
<pre id="output" style="font-size: 12pt;"></pre>
<script src="ftball.js"></script>
</body>
</html>

View File

@@ -0,0 +1,508 @@
// FTBALL
//
// Converted from BASIC to Javascript by Oscar Toledo G. (nanochess)
//
function print(str)
{
document.getElementById("output").appendChild(document.createTextNode(str));
}
function input()
{
var input_element;
var input_str;
return new Promise(function (resolve) {
input_element = document.createElement("INPUT");
print("? ");
input_element.setAttribute("type", "text");
input_element.setAttribute("length", "50");
document.getElementById("output").appendChild(input_element);
input_element.focus();
input_str = undefined;
input_element.addEventListener("keydown", function (event) {
if (event.keyCode == 13) {
input_str = input_element.value;
document.getElementById("output").removeChild(input_element);
print(input_str);
print("\n");
resolve(input_str);
}
});
});
}
function tab(space)
{
var str = "";
while (space-- > 0)
str += " ";
return str;
}
var os = [];
var sa = [];
var ls = [, "KICK","RECEIVE"," YARD ","RUN BACK FOR ","BALL ON ",
"YARD LINE"," SIMPLE RUN"," TRICKY RUN"," SHORT PASS",
" LONG PASS","PUNT"," QUICK KICK "," PLACE KICK"," LOSS ",
" NO GAIN","GAIN "," TOUCHDOWN "," TOUCHBACK ","SAFETY***",
"JUNK"];
var p;
var x;
var x1;
function fnf(x)
{
return 1 - 2 * p;
}
function fng(z)
{
return p * (x1 - x) + (1 - p) * (x - x1);
}
function show_score()
{
print("\n");
print("SCORE: " + sa[0] + " TO " + sa[1] + "\n");
print("\n");
print("\n");
}
function show_position()
{
if (x <= 50) {
print(ls[5] + os[0] + " " + x + " " + ls[6] + "\n");
} else {
print(ls[5] + os[1] + " " + (100 - x) + " " + ls[6] + "\n");
}
}
function offensive_td()
{
print(ls[17] + "***\n");
if (Math.random() <= 0.8) {
sa[p] = sa[p] + 7;
print("KICK IS GOOD.\n");
} else {
print("KICK IS OFF TO THE SIDE\n");
sa[p] = sa[p] + 6;
}
show_score();
print(os[p] + " KICKS OFF\n");
p = 1 - p;
}
// Main program
async function main()
{
print(tab(33) + "FTBALL\n");
print(tab(15) + "CREATIVE COMPUTING MORRISTOWN, NEW JERSEY\n");
print("\n");
print("\n");
print("THIS IS DARTMOUTH CHAMPIONSHIP FOOTBALL.\n");
print("\n");
print("YOU WILL QUARTERBACK DARTMOUTH. CALL PLAYS AS FOLLOWS:\n");
print("1= SIMPLE RUN; 2= TRICKY RUN; 3= SHORT PASS;\n");
print("4= LONG PASS; 5= PUNT; 6= QUICK KICK; 7= PLACE KICK.\n");
print("\n");
print("CHOOSE YOUR OPPONENT");
os[1] = await input();
os[0] = "DARMOUTH";
print("\n");
sa[0] = 0;
sa[1] = 0;
p = Math.floor(Math.random() * 2);
print(os[p] + " WON THE TOSS\n");
if (p != 0) {
print(os[1] + " ELECTS TO RECEIVE.\n");
print("\n");
} else {
print("DO YOU ELECT TO KICK OR RECEIVE");
while (1) {
str = await input();
print("\n");
if (str == ls[1] || str == ls[2])
break;
print("INCORRECT ANSWER. PLEASE TYPE 'KICK' OR 'RECEIVE'");
}
e = (str == ls[1]) ? 1 : 2;
if (e == 1)
p = 1;
}
t = 0;
start = 1;
while (1) {
if (start <= 1) {
x = 40 + (1 - p) * 20;
}
if (start <= 2) {
y = Math.floor(200 * Math.pow((Math.random() - 0.5), 3) + 55);
print(" " + y + " " + ls[3] + " KICKOFF\n");
x = x - fnf(1) * y;
if (Math.abs(x - 50) >= 50) {
print("TOUCHBACK FOR " + os[p] + ".\n");
x = 20 + p * 60;
start = 4;
} else {
start = 3;
}
}
if (start <= 3) {
y = Math.floor(50 * Math.pow(Math.random(), 2)) + (1 - p) * Math.floor(50 * Math.pow(Math.random(), 4));
x = x + fnf(1) * y;
if (Math.abs(x - 50) < 50) {
print(" " + y + " " + ls[3] + " RUNBACK\n");
} else {
print(ls[4]);
offensive_td();
start = 1;
continue;
}
}
if (start <= 4) {
// First down
show_position();
}
if (start <= 5) {
x1 = x;
d = 1;
print("\n");
print("FIRST DOWN " + os[p] + "***\n");
print("\n");
print("\n");
}
// New play
t++;
if (t == 30) {
if (Math.random() <= 1.3) {
print("GAME DELAYED. DOG ON FIELD.\n");
print("\n");
}
}
if (t >= 50 && Math.random() <= 0.2)
break;
if (p != 1) {
// Opponent's play
if (d <= 1) {
z = Math.random() > 1 / 3 ? 1 : 3;
} else if (d != 4) {
if (10 + x - x1 < 5 || x < 5) {
z = Math.random() > 1 / 3 ? 1 : 3;
} else if (x <= 10) {
a = Math.floor(2 * Math.random());
z = 2 + a;
} else if (x <= x1 || d < 3 || x < 45) {
a = Math.floor(2 * Math.random());
z = 2 + a * 2;
} else {
if (Math.random() > 1 / 4)
z = 4;
else
z = 6;
}
} else {
if (x <= 30) {
z = 5;
} else if (10 + x - x1 < 3 || x < 3) {
z = Math.random() > 1 / 3 ? 1 : 3;
} else {
z = 7;
}
}
} else {
print("NEXT PLAY");
while (1) {
z = parseInt(await input());
if (Math.abs(z - 4) <= 3)
break;
print("ILLEGAL PLAY NUMBER, RETYPE");
}
}
f = 0;
print(ls[z + 6] + ". ");
r = Math.random() * (0.98 + fnf(1) * 0.02);
r1 = Math.random();
switch (z) {
case 1: // Simple run
case 2: // Tricky run
if (z == 1) {
y = Math.floor(24 * Math.pow(r - 0.5, 3) + 3);
if (Math.random() >= 0.05) {
routine = 1;
break;
}
} else {
y = Math.floor(20 * r - 5);
if (Math.random() > 0.1) {
routine = 1;
break;
}
}
f = -1;
x3 = x;
x = x + fnf(1) * y;
if (Math.abs(x - 50) < 50) {
print("*** FUMBLE AFTER ");
routine = 2;
break;
} else {
print("*** FUMBLE.\n");
routine = 4;
break;
}
case 3: // Short pass
case 4: // Long pass
if (z == 3) {
y = Math.floor(60 * Math.pow(r1 - 0.5, 3) + 10);
} else {
y = Math.floor(160 * Math.pow((r1 - 0.5), 3) + 30);
}
if (z == 3 && r < 0.05 || z == 4 && r < 0.1) {
if (d != 4) {
print("INTERCEPTED.\n");
f = -1;
x = x + fnf(1) * y;
if (Math.abs(x - 50) >= 50) {
routine = 4;
break;
}
routine = 3;
break;
} else {
y = 0;
if (Math.random() < 0.3) {
print("BATTED DOWN. ");
} else {
print("INCOMPLETE. ");
}
routine = 1;
break;
}
} else if (z == 4 && r < 0.3) {
print("PASSER TACKLED. ");
y = -Math.floor(15 * r1 + 3);
routine = 1;
break;
} else if (z == 3 && r < 0.15) {
print("PASSER TACLKED. ");
y = -Math.floor(10 * r1);
routine = 1;
break;
} else if (z == 3 && r < 0.55 || z == 4 && r < 0.75) {
y = 0;
if (Math.random() < 0.3) {
print("BATTED DOWN. ");
} else {
print("INCOMPLETE. ");
}
routine = 1;
break;
} else {
print("COMPLETE. ");
routine = 1;
break;
}
case 5: // Punt
case 6: // Quick kick
y = Math.floor(100 * Math.pow((r - 0.5), 3) + 35);
if (d != 4)
y = Math.floor(y * 1.3);
print(" " + y + " " + ls[3] + " PUNT\n");
if (Math.abs(x + y * fnf(1) - 50) < 50 && d >= 4) {
y1 = Math.floor(Math.pow(r1, 2) * 20);
print(" " + y1 + " " + ls[3] + " RUN BACK\n");
y = y - y1;
}
f = -1;
x = x + fnf(1) * y;
if (Math.abs(x - 50) >= 50) {
routine = 4;
break;
}
routine = 3;
break;
case 7: // Place kick
y = Math.floor(100 * Math.pow((r - 0.5), 3) + 35);
if (r1 <= 0.15) {
print("KICK IS BLOCKED ***\n");
x = x - 5 * fnf(1);
p = 1 - p;
start = 4;
continue;
}
x = x + fnf(1) * y;
if (Math.abs(x - 50) >= 60) {
if (r1 <= 0.5) {
print("KICK IS OFF TO THE SIDE.\n");
print(ls[18] + "\n");
p = 1 - p;
x = 20 + p * 60;
start = 4;
continue;
} else {
print("FIELD GOAL ***\n");
sa[p] = sa[p] + 3;
show_score();
print(os[p] + " KICKS OFF\n");
p = 1 - p;
start = 1;
continue;
}
} else {
print("KICK IS SHORT.\n");
if (Math.abs(x - 50) >= 50) {
// Touchback
print(ls[18] + "\n");
p = 1 - p;
x = 20 + p * 60;
start = 4;
continue;
}
p = 1 - p;
start = 3;
continue;
}
}
// Gain or loss
if (routine <= 1) {
x3 = x;
x = x + fnf(1) * y;
if (Math.abs(x - 50) >= 50) {
routine = 4;
}
}
if (routine <= 2) {
if (y != 0) {
print(" " + Math.abs(y) + " " + ls[3]);
if (y < 0)
yt = -1;
else if (y > 0)
yt = 1;
else
yt = 0;
print(ls[15 + yt]);
if (Math.abs(x3 - 50) <= 40 && Math.random() < 0.1) {
// Penalty
p3 = Math.floor(2 * Math.random());
print(os[p3] + " OFFSIDES -- PENALTY OF 5 YARDS.\n");
print("\n");
print("\n");
if (p3 != 0) {
print("DO YOU ACCEPT THE PENALTY");
while (1) {
str = await input();
if (str == "YES" || str == "NO")
break;
print("TYPE 'YES' OR 'NO'");
}
if (str == "YES") {
f = 0;
d = d - 1;
if (p != p3)
x = x3 + fnf(1) * 5;
else
x = x3 - fnf(1) * 5;
}
} else {
// Opponent's strategy on penalty
if ((p != 1 && (y <= 0 || f < 0 || fng(1) < 3 * d - 2))
|| (p == 1 && ((y > 5 && f >= 0) || d < 4 || fng(1) >= 10))) {
print("PENALTY REFUSED.\n");
} else {
print("PENALTY ACCEPTED.\n");
f = 0;
d = d - 1;
if (p != p3)
x = x3 + fnf(1) * 5;
else
x = x3 - fnf(1) * 5;
}
}
routine = 3;
}
}
}
if (routine <= 3) {
show_position();
if (f != 0) {
p = 1 - p;
start = 5;
continue;
} else if (fng(1) >= 10) {
start = 5;
continue;
} else if (d == 4) {
p = 1 - p;
start = 5;
continue;
} else {
d++;
print("DOWN: " + d + " ");
if ((x1 - 50) * fnf(1) >= 40) {
print("GOAL TO GO\n");
} else {
print("YARDS TO GO: " + (10 - fng(1)) + "\n");
}
print("\n");
print("\n");
start = 6;
continue;
}
}
if (routine <= 4) {
// Ball in end-zone
e = (x >= 100) ? 1 : 0;
switch (1 + e - f * 2 + p * 4) {
case 1:
case 5:
// Safety
sa[1 - p] = sa[1 - p] + 2;
print(ls[19] + "\n");
show_score();
print(os[p] + " KICKS OFF FROM ITS 20 YARD LINE.\n");
x = 20 + p * 60;
p = 1 - p;
start = 2;
continue;
case 3:
case 6:
// Defensive TD
print(ls[17] + "FOR " + os[1 - p] + "***\n");
p = 1 - p;
// Fall-thru
case 2:
case 8:
// Offensive TD
print(ls[17] + "***\n");
if (Math.random() <= 0.8) {
sa[p] = sa[p] + 7;
print("KICK IS GOOD.\n");
} else {
print("KICK IS OFF TO THE SIDE\n");
sa[p] = sa[p] + 6;
}
show_score();
print(os[p] + " KICKS OFF\n");
p = 1 - p;
start = 1;
continue;
case 4:
case 7:
// Touchback
print(ls[18] + "\n");
p = 1 - p;
x = 20 + p * 60;
start = 4;
continue;
}
}
}
print("END OF GAME ***\n");
print("FINAL SCORE: " + os[0] + ": " + sa[0] + " " + os[1] + ": " + sa[1] + "\n");
}
main();

View File

@@ -0,0 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language))

View File

@@ -0,0 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Perl](https://www.perl.org/)

View File

@@ -0,0 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Python](https://www.python.org/about/)

View File

@@ -0,0 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Ruby](https://www.ruby-lang.org/en/)

View File

@@ -0,0 +1,22 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Football", "Football.vbproj", "{5491221D-33D3-4ADF-9E0A-FB58D5C12EE2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5491221D-33D3-4ADF-9E0A-FB58D5C12EE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5491221D-33D3-4ADF-9E0A-FB58D5C12EE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5491221D-33D3-4ADF-9E0A-FB58D5C12EE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5491221D-33D3-4ADF-9E0A-FB58D5C12EE2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RootNamespace>Football</RootNamespace>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>16.9</LangVersion>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,3 @@
Original BASIC source [downloaded from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Visual Basic .NET](https://en.wikipedia.org/wiki/Visual_Basic_.NET)