Voici un jeu que j'ai programmé il y a quelques jours.
le but est de résoudre les calculs proposés par la calculette :
Voici le code :
| Code | :Clrhome
:Disp" ENTRAINEMENT"," CEREBRAL"
:Pause
:5ü dim L:Fill(0,L)
:3ü X:1ü Y
:Clrhome
:Menu("CALCUL MENTAL :",CALCUL 20",A,"CALCUL 100",B
::Lbl A
:20ü B
:Goto 0
:Lbl B
:100ü B
:Lbl 0
:For(A,1,B)
:Lbl 1
:int rand11ü L(1)
:int rand3+1ü L(2)
:int rand11ü L(3)
:
:If L(2)=2 and L(1)<L(3):Goto 1
:
:Output(Y,X,L(1)
:
:If L(2)=1
:Then
:Output(Y,X+2,"+"
:L(1)+L(3)ü L(4)
:End
:
:If L(2)=2
:Then
:Output(Y,X+2,"-"
:L(1)-L(2)ü L(4)
:End
:
:If L(2)=3
:Then
:Output(Y,X+2,"*"
:L(1)*L(3)ü L(4)
:End
:
:Output(Y,X+3,L(3)
:Output(Y,X+5,"="
:Disp " "
:Input "",Z
:
:If Z=L(4)
:Then
:L(5)+1ü L(5)
:Output(Y,15,"V"
:Else
:L(5)-1ü L(5)
:Output(Y,15,"F"
:End
:
:Y+2ü Y
:If Yù 8:8ü Y
:
:End
:
:Clrhome
:Disp "SCORE :",L(5) |
:

|