home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
101-125
/
apd107
/
leaguesim.amos
/
leaguesim.amosSourceCode
Wrap
AMOS Source Code
|
1991-02-14
|
3KB
|
133 lines
' League Sim By D. Ramsey
' For advice etc, write to :-
' 2,THE PADDOCKS,HADDENHAM,AYLESBURY,BUCKS HP17 8AG
' Feb 91
Screen Open 0,320,200,4,Lowres
Curs Off : Hide On : Flash Off : Paper 0 : Pen 1
Palette $978,0,$FFE,$443
Dim TEAM$(22),SKILL#(22),WON(22),DRWN(22),LOST(22),PTS(22)
DELAY=1
' Delay in printing league table
' Teams Skill increases with success, decreases with failure
SETUP:
Cls 0 : MTCH=0
Restore TEAMDAT
For A=1 To 20
Read TEAM$(A),SKILL#(A)
WON(A)=0 : DRWN(A)=0 : LOST(A)=0 : PTS(A)=0
Next
'
TEAMDAT:
Data "Liverpool",8,"Arsenal",7,"Crystal Palace",8,"Manchester United",9,"Leeds United",8,"Tottenham Hotspur",7
Data "Manchester City",7,"Wimbledon",6,"Chelsea",6,"Norwich City",6,"Nottingham Forest",6,"Everton",6,"Aston Villa",6
Data "Southampton",5,"Coventry City",5,"Luton Town",5,"Sunderland",4,"Queens Park Rangers",4,"Sheffield United",3,"Derby County",3
' Skill Level Of Team 3-9
' Fixtures are not calculated properly,
' Each team plays the team below in the league.
MAIN:
' 38 Games in a season
If MTCH=38 Then Gosub NDGAME
For B=1 To 20 Step 2
H=Rnd(SKILL#(B)*2.1)
A=Rnd(SKILL#(B+1)*2.1)
H=H/3 : A=A/3
' H & A are scores Home & Away
If H>A
Inc WON(B)
Inc LOST(B+1)
PTS(B)=PTS(B)+3
SKILL#(B)=SKILL#(B)+0.3
SKILL#(B+1)=SKILL#(B+1)-0.3
End If
If A>H
Inc WON(B+1)
Inc LOST(B)
PTS(B+1)=PTS(B+1)+3
SKILL#(B+1)=SKILL#(B+1)+0.3
SKILL#(B)=SKILL#(B)-0.3
End If
If A=H
Inc DRWN(B)
Inc DRWN(B+1)
Inc PTS(B)
Inc PTS(B+1)
End If
If SKILL#(B+1)>9 Then SKILL#(B+1)=9
If SKILL#(B)>9 Then SKILL#(B)=9
If SKILL#(B+1)<3 Then SKILL#(B+1)=3
If SKILL#(B)<3 Then SKILL#(B)=3
Next
'
'
SRT:
' Simple Bubble Sort
For A=1 To 20
For B=A+1 To 21
If PTS(B)>PTS(A)
Swap TEAM$(A),TEAM$(B)
Swap PTS(A),PTS(B)
Swap WON(A),WON(B)
Swap DRWN(A),DRWN(B)
Swap LOST(A),LOST(B)
End If
Next B
Next A
Inc MTCH
'
'Print Out League with delay after each team
Pen 1
Locate 1,0
Print " BARCLAYS LEAGUE DIVISION ONE"
Pen 3
Locate 1,2
Print "Pos Team P W D L Pts"
Pen 1
For A=1 To 20
' As A increases, position on screen goes down
Wait DELAY
Locate 0,A+2
' Erase old Line
Print " "
Locate 0,A+2
Print A
Locate 4,A+2
' Highlight the best team!
If TEAM$(A)="Manchester United" Then Pen 3 Else Pen 2
Print TEAM$(A)
Locate 25,A+2
Pen 1
Print MTCH
Locate 28,A+2
Print WON(A)
Locate 31,A+2
Print DRWN(A)
Locate 34,A+2
Print LOST(A)
Locate 37,A+2
Print PTS(A)
Next
Wait(DELAY*15)
Goto MAIN
'
'
'End Of Game Screen
NDGAME:
Cls 0
Locate 1,2
Centre "League Winners"
Locate 1,4
' First Team
Centre TEAM$(1)
Locate 1,5
T$="SKILL FACTOR :"+Str$(SKILL#(1))
Centre T$
Locate 1,7
Centre "Runners Up"
Locate 1,9
Centre TEAM$(2)
'
Locate 1,18
Centre "Hit The Mouse"
Repeat : Until Mouse Key
Goto SETUP
' Making Sure to Restore Data and not Re-Dim Arrays