Voici un programme que j'ai trouvé sur Internet (mais il bloque...):
Code
:0üD:0üE
:ClrHome
:For(A,1,8,1
:If Aù2:Output(A-1,2," "
:Output(A,2,"DANE JORGENSEN"
:For(B,1,75,1
:End
:End
:For(A,1,7,1
:If Aù2:Output(A-1,6," "
:Output(A,7,"BY:"
:For(B,1,75,1
:End
:End
:For(A,1,9,1
:If Aù2:Output(5,A-1," "
:Output(5,A,"TOE"
:For(B,1,75,1
:End
:End
:For(A,14,7,ú1
:If A÷13:Output(4,A+3," "
:Output(4,A,"TAC"
:For(B,1,75,1
:End
:End
:For(A,1,5,1
:If Aù2:Output(3,A-1," "
:Output(3,A,"TIC"
:For(B,1,75,1
:End
:End
:Output(1,4,"TWO PLAYER"
:For(A,1,400,1
:End
:ClrHome
:Output(1,4,"POSITIONS"
:Output(2,1,"****************"
:Output(4,6,"-+-+-"
:Output(6,6,"-+-+-"
:Output(3,6,"1!2!3"
:Output(5,6,"4!5!6"
:Output(7,6,"7!8!9"
:For(A,1,800,1
:End
:Lbl A
:0üG:0üH:0üI:0üJ:0üK:0üL:0üM:0üN:0üO
:ClrHome
:Output(4,6,"-+-+-"
:Output(6,6,"-+-+-"
:Output(3,7,"! !"
:Output(5,7,"! !"
:Output(7,7,"! !"
:Output(8,1,"P1: P2:"
:Output(8,4,D
:Output(8,15,E
:Lbl B
:Output(1,1,"P1'S MOVE-"
:Lbl W
:getKeyüF
:If F=0:Goto W
:Output(1,1," "
:If F=92 and G=1:Goto D
:If F=92 and G=2:Goto D
:If F=93 and H=1:Goto D
:If F=93 and H=2:Goto D
:If F=94 and I=1:Goto D
:If F=94 and I=2:Goto D
:If F=82 and J=1:Goto D
:If F=82 and J=2:Goto D
:If F=83 and K=1:Goto D
:If F=83 and K=2:Goto D
:If F=84 and L=1:Goto D
:If F=84 and L=2:Goto D
:If F=72 and M=1:Goto D
:If F=72 and M=2:Goto D
:If F=73 and N=1:Goto D
:If F=73 and N=2:Goto D
:If F=74 and O=1:Goto D
:If F=74 and O=2:Goto D
:If F=92
:Then
:Output(3,6,"X"
:1üG
:Goto E
:End
:If F=93
:Then
:Output(3,8,"X"
:1üH
:Goto E
:End
:If F=94
:Then
:Output(3,10,"X"
:1üI
:Goto E
:End
:If F=82
:Then
:Output(5,6,"X"
:1üJ
:Goto E
:End
:If F=83
:Then
:Output(5,8,"X"
:1üK
:Goto E
:End
:If F=84
:Then
:Output(5,10,"X"
:1üL
:Goto E
:End
:If F=72
:Then
:Output(7,6,"X"
:1üM
:Goto E
:End
:If F=73
:Then
:Output(7,8,"X"
:1üN
:Goto E
:End
:If F=74
:Then
:Output(7,10,"X"
:1üO
:Goto E
:End
:Lbl D
:For(A,1,25,1
:Output(1,3,"-TRY AGAIN-"
:End
:Output(1,1," "
:Goto B
:Lbl E
:If G=1 and H=1 and I=1:Goto F
:If J=1 and K=1 and L=1:Goto F
:If M=1 and N=1 and O=1:Goto F
:If G=1 and J=1 and M=1:Goto F
:If H=1 and K=1 and N=1:Goto F
:If I=1 and L=1 and O=1:Goto F
:If G=1 and K=1 and O=1:Goto F
:If M=1 and K=1 and I=1:Goto F
:If G>0 and H>0 and I>0 and J>0 and K>0 and L>0 and M>0 and N>0 and O>0
:Then
:ClrHome
:For(A,1,30,1
:Output(4,5,"-DRAW-"
:End
:Goto A
:End
:Goto U
:Lbl F
:ClrHome
:D+1üD
:For(A,1,30,1
:Output(4,2,"PLAYER 1 WINS!"
:End
:If D=5
:Then
:ClrHome
:For(A,1,30,1
:Output(3,3,"PLAYER ONE"
:Output(4,7,"IS"
:Output(5,2,"THE ULTIMATE"
:Output(6,5,"PLAYER"
:End
:ClrHome
:Stop
:End
:Goto A
:Lbl U
:Output(1,1,"P2'S MOVE-"
:Lbl R
:getKeyüF
:If F=0:Goto R
:Output(1,1," "
:If F=92 and G=1:Goto Z
:If F=92 and G=2:Goto Z
:If F=93 and H=1:Goto Z
:If F=93 and H=2:Goto Z
:If F=94 and I=1:Goto Z
:If F=94 and I=2:Goto Z
:If F=82 and J=1:Goto Z
:If F=82 and J=2:Goto Z
:If F=83 and K=1:Goto Z
:If F=83 and K=2:Goto Z
:If F=84 and L=1:Goto Z
:If F=84 and L=2:Goto Z
:If F=72 and M=1:Goto Z
:If F=72 and M=2:Goto Z
:If F=73 and N=1:Goto Z
:If F=73 and N=2:Goto Z
:If F=74 and O=1:Goto Z
:If F=74 and O=2:Goto Z
:If F=92
:Then
:Output(3,6,"O"
:2üG
:Goto Y
:End
:If F=93
:Then
:Output(3,8,"O"
:2üH
:Goto Y
:End
:If F=94
:Then
:Output(3,10,"O"
:2üI
:Goto Y
:End
:If F=82
:Then
:Output(5,6,"O"
:2üJ
:Goto Y
:End
:If F=83
:Then
:Output(5,8,"O"
:2üK
:Goto Y
:End
:If F=84
:Then
:Output(5,10,"O"
:2üL
:Goto Y
:End
:If F=72
:Then
:Output(7,6,"O"
:2üM
:Goto Y
:End
:If F=73
:Then
:Output(7,8,"O"
:2üN
:Goto Y
:End
:If F=74
:Then
:Output(7,10,"O"
:2üO
:Goto Y
:End
:Lbl Z
:For(A,1,25,1
:Output(1,3,"-TRY AGAIN-"
:End
:Output(1,1," "
:Goto U
:Lbl Y
:If G=2 and H=2 and I=2:Goto Á
:If J=2 and K=2 and L=2:Goto Á
:If M=2 and N=2 and O=2:Goto Á
:If G=2 and J=2 and M=2:Goto Á
:If H=2 and K=2 and N=2:Goto Á
:If I=2 and L=2 and O=2:Goto Á
:If G=2 and K=2 and O=2:Goto Á
:If M=2 and K=2 and I=2:Goto Á
:If G>0 and H>0 and I>0 and J>0 and K>0 and L>0 and M>0 and N>0 and O>0
:Then
:ClrHome
:For(A,1,30,1
:Output(4,5,"-DRAW-"
:End
:Goto A
:End
:Goto B
:Lbl Á
:ClrHome
:E+1üE
:For(A,1,30,1
:Output(4,2,"PLAYER 2 WINS!"
:End
:If E=5
:Then
:ClrHome
:For(A,1,30,1
:Output(3,3,"PLAYER TWO"
:Output(4,7,"IS"
:Output(5,2,"THE ULTIMATE"
:Output(6,5,"PLAYER"
:End
:ClrHome
:Stop
:End
:Goto A
Cependant il bloque à un moment donné.
Est-ce que quelqu'un peut m'aider ???
HELP ME !!!
PS: Je n'y connais pas grand chose en programmation
PS': 1er message sur ce forum !!!
Autorisation : Membre
Nb de messages : 21
Inscrit le : Dim 09 Nov 2008, 16:35
Posté le : Mar 11 Nov 2008, 10:45
chakal37 >> à la fin
coc5 >> sauf que quand la grille du morpion s'affiche, ça me mets: -TRY AGAIN- et la seule chose que je puisse faire c'est appuyer sur [On]...
Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mar 11 Nov 2008, 10:53
Bon alors c'est un problème bien différent. Beaucoup plus dur à résoudre.
Car en fait, avant l'affichage du "TRY AGAIN", il y a un Lbl D.
Essaye donc de supprimer toute la serie des:
Code
:If F=92 and G=1:Goto D
:If F=92 and G=2:Goto D
:If F=93 and H=1:Goto D
:If F=93 and H=2:Goto D
:If F=94 and I=1:Goto D
:If F=94 and I=2:Goto D
:If F=82 and J=1:Goto D
:If F=82 and J=2:Goto D
:If F=83 and K=1:Goto D
:If F=83 and K=2:Goto D
:If F=84 and L=1:Goto D
:If F=84 and L=2:Goto D
:If F=72 and M=1:Goto D
:If F=72 and M=2:Goto D
:If F=73 and N=1:Goto D
:If F=73 and N=2:Goto D
:If F=74 and O=1:Goto D
:If F=74 and O=2:Goto D
Le problème c'est que l'erreur peut venir d'un seul caractère et que vu ton problème ce caractère peut être n'importe lequel de tout le programme !!!
Mais c'est triste de voir un tel code. A une époque j'avais parier qu'on pouvait faire un morpion en 20 lignes de codes seulements (et j'avais réussis ). Non mais franchement tout ça pour ça, c'est triste.
Si tu n'y arrive pas je te fais un morpion sur mesure c'est pas compliqué
Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mar 11 Nov 2008, 11:06
Citer : coc5
Je n'avance pas quelque chose quand je n'en suis pas capable, donc voici un morpion vraiment pourrit mais en vingts lignes. Enfin bon 20 lignes c'est un peubête car avec plus de lignes mais moins de caractères j'aurais pu économiser un très grand nombre d'octet(ça m'a presque fait mal de coder aussi salement^^)
Mais bon 20 lignes c'est 20 lignes.
On peut même faire moins en rendant le jeu encore plus pourris mais en restant dans le minimum de jouabilité.
Code
ClrHome
[[0,0,0][0,0,0][0,0,0 -> [A]:1 -> S
Output(3,1,"[6 espaces]+---+[11 espaces]![3 espaces]![11 espaces]![3 espaces]![11 espaces]![3 espaces]![11 espaces]+---+
While K-22
For(I,1,3
For(J,1,3
If 1=[A](I,J:Output(I+3,J+7,"+
If 2=[A](I,J:Output(I+3,J+7,"*
End:End
Output(8,min(3,max(1,B))+7," "
Output(min(3,max(1,D))+3,5," "
getKey -> K
min(3,max(1,B+(K=26)-(K=24 -> B
max(1,min(3,A+(K=34)-(K=25 -> A
Output(8,B+7,"^
Output(A+3,5,">
If K=21 and not([A](A,B:not(S -> S
[A](A,B)+(S+1)(K=21 and not([A](A,B -> [A](A,B
End
Ce code est vraiment moche, mais 20 lignes c'est 20 lignes ^^
Autorisation : Membre
Nb de messages : 21
Inscrit le : Dim 09 Nov 2008, 16:35
Posté le : Mar 11 Nov 2008, 16:43
J'ai recopié ton code, y'a encore ma calculette qui m'affiche une erreure!
SYNTAXE
Citer
[[0,0,0][0,0,0][0,0,0 -> [A]:1 -> S
au niveau du crochet [ juste avant le A
La seule erreure que j'ai pu faire (mais je ne sais pas si c'est ça qui fait que ça bloque) c'est de na pas avoir mis d'espace avant et après les flèches, c'est grave ?
Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mar 11 Nov 2008, 18:53
Ce qui est entre crochets il ne faut pas l'écrire mais l'exécuter! Donc [6 espaces] signifie faire 6 espaces (sans les crochets donc)!
Tu retrouveras la même manière de faire dans d'autres programmes, c'est pas juste une fantaisie