Θ correspond à "thêta", et peut bien sûr être remplacé par n'importe quelle autre
lettre.
:ClrHome:ClrDraw
:{30,30}->dim([A]
:Fill(0,[A])
:For(A,0,1
: For(B,0,29
: 1->[A](1+A*29,B+1
: 1->[A](B+1,1+A*29
: Pxl-On(29*A,B
: Pxl-On(B,29*A
: End
:End
:5->Z
:
:15->E:15->F
:26->U
:14->G:15->H
:U->V
:
:randInt(1,28->I
:randInt(1,28->J
:Pxl-On(J,I
:
:0->S
:
:0->Θ
:While Θ=0
: getKey->K
: If K
: K->U
: U->[A](F+1,E+1)
: If (E=I) and (F=J)
: Then
: Z+6->Z
: randInt(1,28)->I
: randInt(1,28)->J
: While [A](J+1,I+1)
: randInt(1,28)->I
: randInt(1,28)->J
: End
: S+1->S
: Pxl-On(J,I
: End
:
: E+(U=26)-(U=24)->E
: F+(U=34)-(U=25)->F
:
: If Z
: Then
: Z-1->Z
: Else
: 0->[A](H+1,G+1)
: G+(V=26)-(V=24)->G
: H+(V=34)-(V=25)->H
: [A](H+1,G+1)->V
: Pxl-Off(H,G
: End
: Pxl-On(F,E
: [A](F+1,E+1)->Θ
:End
:
:Disp S
Petite précision : si vous n'avez pas la commande "randint("
Il faut combiner 2 commandes : "int(" ([math], 2ème onglet, 5) et rand ([math], 2ème onglet, 1), de cette façon : int(randX).
Ça renvoie alors un nombre entier aléatoire entre 0 et (X-1).
Finalement pour tirer un nombre aléatoire entre 1 et 28, il faut écrire : int(rand28) + 1.