P183 ORACLE 183 Mon26 Apr ITV 1900:10 254**********? 254**********? dlesoftware & Education Project  P2OGRAM SOCCER  This program simulates a football league table. Fixtures are arranged over 44 'Saturdays' On each 'Saturday' therd are either 10 or 11 matches, each team playing every other team once at home and away. The program is organised in three main sections, 1-display fixtures; 2-compute scores and 3-update and display league table.
P183 ORACLE 183 Mon26 Apr ITV 1900:30 35206136NFSN0 SOCCER 35206136NFSN0 1 REM ********************************** |e2 REM *** soccer league by I G GUNTER **|63 REM *** BEACON SCHOOL CROWBORGTGH **|&4 REM **************************** ******|h5 OPTION BASE 0|56 RANDOMIZE |;7 GOSUB 122|(8 N=21 : DIM T$(N),N(N),L(N) ,G N),D(N),F(N) A(N),P(N),S(N),X(9),Q(N) ,Y(N),G(N)|d9 DIM Z(1,N)<$10 FOR L=0 TO N : READ T$(L) : NEXT L |÷11 DATA "A SEN AL","A. VILLA","BIRMINGHAM","BOLTON","BR ISTOL C."|%12 DATA "CHELSEA","COVENTRY", "DERBY","EVERTON","IPSWICH","LEEDS UTD." ,"LIVERPOOL"| 13 DATA "MAN. CITY","MAN. UTD.","MIDDLESBRO","NORWICH","NOTTM FOR "|,14 DATA "Q. P. R.","SOUTHAMPTN","TOTT ENHAM","WEST. BROM","WOLVES"|d15 REM *** *****************************|f16 DD * set all teams equal 10th ***|717 REM * ** in league for 1st match ***|:18 REM ********************************|i19 FOR L=0 TO 21 : N(L)=10 : NEXT L |t|
P183 ORACLE 183 Mon26 Apr ITV 1900:13 35206136NFSN0 SOCCER 35206136NFSN0 20 H=1-H : IF Y=44 THEN 47|*21 Z=INT(22* RND) : IF Z(H,Z) THEN 21|822 Z(H,Z)=1 : Y=Y+1|,23 REM ***********************|k2 4 REM *** SELECT FIXTURES ***|<25 REM ** *********************|m26 M=10 : IF Z/2= INT(Z/2) THEN M=9|927 P=0 : C=0|l28 P=P+ 1 : Q=Z-P|>29 IF Q<0 THEN Q=Q+22|p30 IF NOT P>Q THEN 28|w31 P(C)=P : P(C+11)=Q : REM HOME $FAM NO./AWAY $JAM NO.|v32 IF H THEN P C)=Q : P(C+11)=P|q33 C=C+1 : IF C R L=0 TO M|t36 IF L/2=INT(L/2) THEN PR INT CUR(L,0) CYA ELSE PRINT CUR(L,0) YEL |f37 PRINT CUR(L,1) T$(P(L)) CUR(L,20) "v" CUR(L,28) T$(P(L+11))||38 NEXT L |r 39 GOSUB 116|—40 REM NOg PLAY MATCHES |3 41 GOSUB 48 : REM *** matches ***|,42 GO SUB 118|<43 REM table|/44 GOSUB 71 : REM table routine|845 GOSUB 114|;46 GOTO 20 |a47 GOTO 65000|{48 REM **************** **************|x|
P183 ORACLE 183 Mon26 Apr ITV 1900:12 0 REM ******************************|q51 REM ******"****************|l52 REM *** expected scords ***|d53 @M ************|n54 FOR L=0 TO M|u55 S(P( L))= 70+1.5*(N(P(L+11))-N(P(L))))/40|k56 S(P(L+11))=(40+N(P(L))-N(P(L+11)))/40 |g57 REM ***********************|258 REM *** poisson proce1s ***|359 REM * **********"***********|460 FOR J=0 TO 11 STEP 11|£61 FOR K=0 TO 9 : X(K)=0 : NEXT K <}62 FOR K=0 TO INT 10*S(P L+J)))|s63 P=INT(10*RND) : X(P)=X (P)+1|"64 NEXT K |p65 P=INT 10*R ND)|?66 S(P(L+H )=X(P)|d67 NEXT J |268 PRINT CUR(L,11) S(P(L)) CUR(L,23) S(P(L+11))|769 NEXT L |v70 RETURN |£71 REM *********************|z72 REM *** ta ble routine ***|s73 REM **************** *****||74 PRINT @R$(12)|i31 FOR L=0 TO M|x|
P183 ORACLE 183 Mon26 Apr ITV 1905:00 35206136NFSN0 SOCCER 35206136NFSN0 49 REM *** routine to play matches **|£5 0 REM ******************************|q51 REM ***********************|l52 REM *** expected scores ***|d53 REM *********** ************|n54 FOR L=0 TO M|u55 S(P( L))= NPLNPL S(P(L+11))=(40+N(P(L))-N(P(L+11)))/40 |g57 REM ***********************|258 REM *** poisson process ***|359 REM * **********************|460 FOR B=0 TO 11 STEP 11|£61 FOR K=0 TO 9 : X(K)=0 : NEXT K |}62 FOR K=0 TO INT(10*S(P (LkM8))|s63 P=INT(10*RND) : X(P)=X (P)+1|"64 NEXT K |p65 P=INT(10*R ND)|?66 S(P(L+J))=X(P)|d67 NEXT J |268 PRINT CUR(L,15) S(P(L)) CUR(L,23) S(P(L+11))|769 NEXT L |v70 RETURN |£71 REM *********************|z72 REM *** ta ble routine ***|s73 REM **************** *****||74 PRINT CHR$(12)|i75 FOR L=0 TO M|x|
P183 ORACLE 183 Mon26 Apr ITV 1902:00 35206136NFSN0 SOCCER 35206136NFSN0 94 REM *****************************|o95 FOR L=0 TO N|{96 Y(L)=Q(L)+(F(L)-A(L) )/1000|f97 NEXT L |w98 PRINT CUR(0,0) YE L|+99 PRINT CUR(0,12) "P" CUR(0,16) "W" CUR(0,20) "D" CUR(0,24) "L"|p100 PRINT C UR(0,28) "F" CUR(0,32) "A" CUR(0,36) "PT S"|a101 R=0|m102 FOR L=0 TO N| 103 P=- 1|{104 FOR K=0 TO N|a105 IF NOT Y( K)>P THEN 107||106 P=Y(K) : Q=K|(107 NEXT K |>108 R=R+1 : N(Q)=R : Y(Q)= -99||109 IF INT(L/2)=L/2 THEN PRINT CU R(L+1,0) GRN ELSE PRINT CUR(L+1,0) CYA|, 110 PRINT CUR(L+1,1) T$(Q) CUR(L+1,11) G(Q) CUR(L+1,15) W(Q) CUR(L+1,19) D(Q) CUR(L+1,23) L(Q)|>111 PRINT CUR(L+1,27 ) F(Q) CUR(L+1,31) A(Q) CUR(L+1,35) Q(Q) ||112 NEXT L |{113 RETURN |1114 PRINT CU R(23,0) GRED NWBG YEL " press" FLSH " SPACEBAR" STDY "to continue";|c115 GOTO 119|'|
P183 ORACLE 183 Mon26 Apr ITV 1910:06 35206136NFSN0 SOCCER 35206136NFSN0 76 IF S(P(L))>S(P(L+11)) THEN W(P(L))= W(P(L))+1 : L(P(L+11))=L(P(L+11))+1 : GO TO 83|677 IF S(P(L)) (P(L))=L(P(L))+1 : W(P(L+11))=W(P(L+11)) +1 : GOTO 83|578 D(P(L))=D(P(L))+1 : D (P(L+11))=D(P(L+11))+1|979 REM ******* *******************|480 REM *** 2 poin ts for a win ***|i81 REM *** 1 point f or a draw ***|682 REM **************** **********|.83 Q(P(L))=2*g(P(L))+D(P(L ))|184 Q(P(L+11))=2*W(P(L+11))+D(P(L+1 1))|y85 F(P(L))=F(P(L))+S(P(L)) : F(P( L+11))=F(P(L+11))+S(P(L+11))|l86 A(P(L ))=A(P(L))+S(P(L+11)) : A(P(L+11))=A(P(L +11))+S(P(L))|y87 G(P(L))=G(P(L))+1 : G(P(L+11))=G(P(L+11))+1|%88 NEXT L |w89 REM *****************************|s90 RE M *** add one thousandth of ***|'91 REM *** goal difference to ***|w92 REM ** * points for true league***|>93 REM *** position ***|}|
P183 ORACLE 183 Mon26 Apr ITV 1906:54 35206136NFSN0 SOCCER 35206136NFSN0 116 PRINT CUR(18,0) GRED NWBG BLU " prd ss" FLSH "SPACEBAR" STDY "to play matche s";|x117 GOTO 119|)118 PRINT CUR(18,0) G BLU NWBG YEL " press" FLSH "SPACEBAR" S TDY "for league table";|m119 X$="x" : IF SYS(5) THEN GET X$|e120 IF X$=" " THEN RETURN |j121 GOTO 119|$122 REM instructi ons|f123 PRINT CHR$(12)|4124 PRINT GBLU NWBG YEL DBLE " FOOTBALL LEAGUE SIMULA TION"|(125 PRINT : PRINT |h126 PRINT : P RINT YEL "This program simulates a leagu e of 22"|k127 PRINT YEL "teams where eac h team plays every other"|t128 PRINT YEL "team once at home and away .b|o129 PRI NT |e130 PRINT : PRINT YEL "The fixtures are arranged in blocks"|>131 PRINT YEL "spread over 44 'Saturdays' .b|+132 PRIN T |133 PRINT : PRINT YEL "After each se t of matches the current"|b134 PRINT YEL "league table will be displayed ."|6135 GOSUB 114|k136 RETURN |6|
P183 ORACLE 183 Mon26 Apr ITV 1801:01 35206136NFSN0 SOCCER 35206136FFSN0 94 REM *****************************|o95 FOR L=0 TG N|{96 Y L =Q(L)+(F(L)-A(L) /1000|f97 NEXT L |w98 PRINT CUR(0,0) YE L|+99 PRINT CUR(0,12) "P" CUR(0,16) "C" CA DCURLPRINTC UR(0,28) "F" CUR(0,32) "A" CUR 0,36) "PT S"|a101 R=0|m102 FOR L<0 TO N| 103 P= K)>@ THEN 107||106 P=Y K) : Q=K| 107 NEXT K |>108 R=R+1 : N(Q)=R : Y(Q)= -99||109 IF INT(L/2)=L'2 THEN PRINT CU R(L+1,0) GRN ELSE PRINT CUR L 1,0) CYA|, 110 PRINT CUR(L+1,1) T$ Q) CUP(L£1,11) G(Q) CUR(L+1,15) W P CUR(L+1,19) D(Q) C R L+1,23) L(Q)|>111 PRINT CUR(L+1,27 ) F(Q) CUR(L+1,31) A Q) CUR(L+1,35) Q(Q) ||112 NAXT L |{113 RETURN |1114 PRINT CU