Randomize Timer Dim p%(20), pt%(20), bp%(20), bc%(20), clas%(20), eq$(20), eqt%(2), g%(20), nu%(20) Dim jt%(20), sc%(20) Dim B1, B2, P1, P2, C$, S$, Z$, ne%, NE1%, NR%, E%, S%, J%, JL%, LJ%, JO%, AL%, I%, BIDON% Dim R%, EQ%, C%, NS1%, NW%, M%, MA%, SC1%, SC2%, K%, NS%, NI%, JJ%, J1%, P!, f$ Data Auxerre,Nice,Guingamp,Marseille,Lens,Le Mans,Lille,Lyon,Metz,Ajaccio Data Monaco,Bordeaux,Montpellier,Rennes,PSG,Bastia,Sochaux,Nantes,Toulouse,Strasbourg debut: Data 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 reprise: Data 16,9,12,13,6,10,7,15,8,11,4,1,18,5,2,17,14,19,20,3 Data 10,18,1,20,3,12,6,2,5,4,9,15,11,16,13,8,17,14,19,7 Data 16,13,12,1,7,9,8,19,4,17,18,6,2,10,15,11,14,3,20,5 Data 10,4,1,14,3,8,6,20,5,2,11,9,13,15,18,12,17,7,19,16 Data 16,3,12,17,7,11,8,1,4,6,9,13,2,18,15,19,14,5,20,10 Data 10,14,1,16,3,15,6,8,5,12,13,11,18,4,2,7,17,20,19,9 Data 16,17,12,10,7,13,8,5,4,2,9,3,11,19,15,1,14,6,20,18 Data 10,8,1,7,3,11,6,12,5,9,4,16,18,14,2,20,17,15,19,13 Data 16,5,12,19,7,10,8,17,9,18,11,1,13,3,15,6,14,2,20,4 Data 10,15,1,13,3,19,6,16,5,7,4,14,18,8,2,12,17,11,20,9 Data 16,10,12,4,7,3,8,2,9,17,11,6,13,18,15,5,14,20,19,1 Data 10,11,1,3,6,9,5,13,4,8,18,15,2,16,14,7,17,19,20,12 Data 16,18,12,14,3,17,7,4,8,20,9,1,11,5,13,10,15,2,19,6 Data 10,19,12,16,6,13,5,3,4,15,18,11,2,9,14,8,17,1,20,7 Data 1,6,16,14,3,10,7,18,8,12,9,4,11,2,13,17,15,20,19,5 Data 10,1,12,7,6,3,5,17,8,9,4,11,18,19,2,13,14,15,20,16 Data 1,5,16,8,3,18,7,6,9,14,11,20,13,4,15,12,17,10,19,2 Data 10,5,16,7,12,9,6,17,8,15,4,19,18,1,2,3,14,11,20,13 Data 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 ne% = 20 NE1% = ne% - 1 NR% = ne% / 2 For E% = 1 To ne% Read eq$(E%) Next E% menux: Cls Locate 20, 1 Print "F O O T B A L L" Locate 5, 4 Print "1. Simulation" Locate 5, 6 Print "2. Initialiser le championnat" Locate 5, 8 Print "3. Lire les données" Locate 5, 10 Print "4. Enregistrer des données" Locate 5, 12 Print "5. Entrer les resultats" Locate 5, 14 Print "6. Sortir le classement" Locate 5, 16 Print "7. Dérouler le championnat" Locate 5, 18 Print "8. Fin" choix: Locate 20, 23 Print "Choix de l'option : "; Input C$ Select Case C$ Case "1" GoTo simulation Case "2" GoTo initialiser Case "3" GoTo lire Case "4" GoTo enregistrer Case "5" GoTo resultats Case "6" GoTo classement Case "7" GoTo deroulement Case "8" Cls End End Select GoTo choix deroulement: Restore debut Cls If S% = 0 Then Print AT(12, 12); "aucun score en memoire ..." GoSub attendcar GoTo menux End If GoSub initab For J% = 1 To JL% P! = True GoSub jour GoSub attendcar GoSub triclas GoSub attendcar Cls Next J% GoTo menux classement: Cls If S% = 0 Then Print AT(12, 12); "aucun score en memoire ..." Else GoSub cumscore GoSub triclas End If GoSub attendcar GoTo menux lire: Cls Print AT(20, 1); "lecture du fichier score" FileSelect "\*.scr", "", f$ Open f$ for Input As # 1 s$ = Input$(381, # 1) s% = VarPtr(s$) jl% = Asc(Mid$(s$, 1, 1)) Close # 1 GoTo menux enregistrer: If S% = 0 Then Print AT(12, 12); "aucun score en memoire ..." GoSub attendcar Else Cls Print AT(20, 1); "enregistrement du fichier score" FileSelect "\*.scr", "", f$ Open f$ for Output As # 1 Print # 1, s$ Close # 1 End If GoTo menux initialiser: S$ = String$(381, 255) Mid$(S$, 1, 1) = Chr$(0) S% = VarPtr(S$) GoTo menux resultats: Cls If S% = 0 Then Print AT(1, 12); "Initialisation obligatoire avant entrée de résultats ..." GoSub attendcar GoTo menux End If LJ% = Asc(Left$(S$, 1)) Print AT(30, 1); "Entrée de resultats" journee: Print AT(1, 12); "Journée (0 = nouvelle journée ) : "; Input "", JO% If JO% = 0 Then LJ% = LJ% + 1 JO% = LJ% End If If JO% < 1 Or JO% > LJ% Then GoTo journee End If Cls AL% = (JO% - 1) \ NE1% + 1 J% = JO% - (AL% - 1) * NE1% If AL% = 1 Then Restore debut Else Restore reprise End If If J% > 1 Then For I% = 1 To (J% - 1) * ne% Read BIDON% Next I% End If Print Tab(27); AL% * NE1% - NE1% + J%; Mid$("èreème", (AL% * J% = 1) * 3 + 4, 3); " journée du championnat" Print Print For R% = 1 To NR% sc%(R% + R% - 1) = Asc(Mid$(S$, (JO% - 1) * ne% + R% + R%, 1)) sc%(R% + R%) = Asc(Mid$(S$, (JO% - 1) * ne% + R% + R% + 1, 1)) Read eqt%(AL%), eqt%(3 - AL%) Print Tab(35 - Len(eq$(eqt%(1)))); eq$(eqt%(1)); "-"; eq$(eqt%(2)); Tab(52); If sc%(R% + R% - 1) = 255 Then Print "_ - _" Else Print sc%(R% + R% - 1)`"-"`sc%(R% + R%) End If Print Next R% EQ% = 1 Do Do If sc%(EQ%) = 255 Then C$ = "_" Else C$ = Chr$(sc%(EQ%) + 48) End If Print AT(53 + ((EQ% - 1) Mod 2) * 4, 4 + ((EQ% - 1) \ 2) * 2); C$; "D"; C% = 102 Do Print ""; Chr$(C%); Z$ = InKey$ If Z$ = Chr$(13) Or (Z$ >= "0" And Z$ <= "9") Or (InStr("HMKP", Mid$(Z$, 2, 1)) > 0) Or Z$ = "_" Then Exit Do C% = 203 - C% Loop If Chr$(13) = Z$ Then Exit Do If (Z$ >= "0" And Z$ <= "9") Or Z$ = "_" Then Print Z$; sc%(EQ%) = Asc(Z$) - 48 - 208 * (Z$ = "_") EQ% = EQ% + 1 + ne% * (EQ% = ne%) Else Z$ = Mid$(Z$, 2, 1) EQ% = EQ% - (Z$ = "M") * (1 + ne% * (EQ% = ne%)) + (Z$ = "K") * (1 + ne% * (EQ% = 1)) - (Z$ = "P") * (2 + ne% * (EQ% > 18)) + (Z$ = "H") * (2 + ne% * (EQ% < 3)) End If '##E# Loop Print "f"; AT(10, 25); "tapez M pour Modifier A pour Abandonner ou C pour Conserver : "; Do Z$ = UCase$(InKey$) If InStr("ACM", Z$) > 0 Then Exit Do Loop Print AT(1, 25); "K"; If Z$ = "A" Then GoTo menux EndIf If Z$ = "C" Then Exit Do Loop For I% = 1 To ne% Mid$(S$, (JO% - 1) * ne% + I% + 1, 1) = Chr$(sc%(I%)) Next I% Mid$(S$, 1, 1) = Chr$(LJ%) GoTo menux simulation: GoSub initab NS1% = NE1% For NW% = 1 To 2 For M% = 1 To NE1% MA% = MA% + 1 Cls Print Tab(27); MA%; Mid$("èreème", (NW% * M% = 1) * 3 + 4, 3); " journée du championnat" Print Print For R% = 1 To NR% Read eqt%(NW%), eqt%(3 - NW%) SC1% = 0 SC2% = 0 For K% = 1 To 2 B1 = 1.3 B2 = .9 P1 = B1 / (2 + B1) P2 = B2 / (2 + B2) While Rnd < P1 SC1% = SC1% + 1 Wend While Rnd < P2 SC2% = SC2% + 1 Wend Next K% jt%(eqt%(1)) = jt%(eqt%(1)) + 1 jt%(eqt%(2)) = jt%(eqt%(2)) + 1 bp%(eqt%(1)) = bp%(eqt%(1)) + SC1% bc%(eqt%(1)) = bc%(eqt%(1)) + SC2% bp%(eqt%(2)) = bp%(eqt%(2)) + SC2% bc%(eqt%(2)) = bc%(eqt%(2)) + SC1% If SC2% > SC1% Then pt%(eqt%(2)) = pt%(eqt%(2)) + 3 g%(eqt%(2)) = g%(eqt%(2)) + 1 p%(eqt%(1)) = p%(eqt%(1)) + 1 ElseIf SC1% = SC2% Then pt%(eqt%(1)) = pt%(eqt%(1)) + 1 pt%(eqt%(2)) = pt%(eqt%(2)) + 1 nu%(eqt%(1)) = nu%(eqt%(1)) + 1 nu%(eqt%(2)) = nu%(eqt%(2)) + 1 Else pt%(eqt%(1)) = pt%(eqt%(1)) + 3 g%(eqt%(1)) = g%(eqt%(1)) + 1 p%(eqt%(2)) = p%(eqt%(2)) + 1 End If Print Tab(35 - Len(eq$(eqt%(1)))); eq$(eqt%(1)); "-"; eq$(eqt%(2)); " "; SC1%; "-"; SC2% Next R% Rem GoSub attendcar GoSub triclas Rem GoSub attendcar KeyGet Z$ Next M% Restore reprise Next NW% End initab: For I% = 1 To ne% jt%(I%) = 0 bp%(I%) = 0 bc%(I%) = 0 g%(I%) = 0 p%(I%) = 0 nu%(I%) = 0 pt%(I%) = 0 clas%(I%) = I% Next I% Restore debut Return cumscore: GoSub initab NW% = 1 For J% = 1 To JL% P! = False GoSub jour Next J% Return triclas: NS% = NE1% Do NI% = 0 For I% = 1 To NS% JJ% = clas%(I%) K% = clas%(I% + 1) If (pt%(JJ%) < pt%(K%)) Or ((bp%(JJ%) - bc%(JJ%)) < (bp%(K%) - bc%(K%)) And (pt%(JJ%) = pt%(K%))) Then NI% = NI% + 1 clas%(I%) = K% clas%(I% + 1) = JJ% End If Next I% NS% = NS% - 1 Loop Until NI% = 0 Rem Cls Print Print Tab(30); "CLASSEMENT" Print Print Tab(38); "J G N P PT BP BC" I% = 1 J1% = clas%(I%) Print Tab(17); I%; eq$(J1%); Tab(37); Using("## ## ## ## ## ### ###"; jt%(J1%); g%(J1%); nu%(J1%); p%(J1%); pt%(J1%); bp%(J1%); bc%(J1%)) For I% = 2 To ne% JJ% = clas%(I%) If pt%(JJ%) = pt%(J1%) Then Print Tab(20); eq$(JJ%); Tab(37); Using("## ## ## ## ## ### ###"; jt%(JJ%); g%(JJ%); nu%(JJ%); p%(JJ%); pt%(JJ%); bp%(JJ%); bc%(JJ%)) Else Print Tab(17 + (I% > 9)); I%; ; eq$(JJ%); Tab(37); Using("## ## ## ## ## ### ###"; jt%(JJ%); g%(JJ%); nu%(JJ%); p%(JJ%); pt%(JJ%); bp%(JJ%); bc%(JJ%)) End If J1% = JJ% Next I% Return attendcar: Do Loop Until Len(InKey$) > 0 Return jour: If P! Then Print Tab(27); J%; Mid$("ŠreŠme", (J% = 1) * 3 + 4, 3); " journ‚e du championnat" Print Print End If If J% = ne% Then Restore reprise End If NW% = 1 - (J% > NE1%) For R% = 1 To NR% Read eqt%(NW%), eqt%(3 - NW%) sc%(1) = Asc(Mid$(S$, (J% - 1) * ne% + R% + R%, 1)) sc%(2) = Asc(Mid$(S$, (J% - 1) * ne% + R% + R% + 1, 1)) If sc%(1) < 255 And sc%(2) < 255 Then jt%(eqt%(1)) = jt%(eqt%(1)) + 1 jt%(eqt%(2)) = jt%(eqt%(2)) + 1 bp%(eqt%(1)) = bp%(eqt%(1)) + sc%(1) bc%(eqt%(1)) = bc%(eqt%(2)) + sc%(2) bp%(eqt%(2)) = bp%(eqt%(2)) + sc%(2) bc%(eqt%(2)) = bc%(eqt%(2)) + sc%(1) If sc%(2) > sc%(1) Then pt%(eqt%(2)) = pt%(eqt%(2)) + 3 g%(eqt%(2)) = g%(eqt%(2)) + 1 p%(eqt%(1)) = p%(eqt%(1)) + 1 ElseIf sc%(1) = sc%(2) Then pt%(eqt%(1)) = pt%(eqt%(1)) + 1 pt%(eqt%(2)) = pt%(eqt%(2)) + 1 nu%(eqt%(1)) = nu%(eqt%(1)) + 1 nu%(eqt%(2)) = nu%(eqt%(2)) + 1 Else pt%(eqt%(1)) = pt%(eqt%(1)) + 3 g%(eqt%(1)) = g%(eqt%(1)) + 1 p%(eqt%(2)) = p%(eqt%(2)) + 1 End If End If If P! Then Print Tab(35 - Len(eq$(eqt%(1)))); eq$(eqt%(1)); "-"; eq$(eqt%(2)); Tab(52); If sc%(1) = 255 Then Print "_ - _" Else Print sc%(1)`"-"`sc%(2) End If Print End If Next R% Return