Poster un nouveau sujet Poster une réponse Page: 1,      >>
[Pblm Jeu] Morpion à 2 Joueurs !
Auteur Message
mlk23
Invité
Posté le : Dim 09 Nov 2008, 16:41   Citer 

Bonjour,


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 !!! bigmouth.gif


PS: Je n'y connais pas grand chose en programmation godgrace.gif
PS': 1er message sur ce forum !!! clown.gif crazy.gif

  Haut de page Bas de page 
 
coc5
Avatar

Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Dim 09 Nov 2008, 19:42   Citer 

Tout ce code pour faire un pauvre morpion O.o (faisable sur papier en plus -_-)

Bon sinon dis-nous où et quelle erreur est annoncée s'il te plaît winkle.gif

----------------------
Ne cliquez pas ici !
 Adresse email Haut de page Bas de page 
 
mlk23



Autorisation : Membre
Nb de messages : 21
Inscrit le : Dim 09 Nov 2008, 16:35
Posté le : Lun 10 Nov 2008, 17:16   Citer 

Oui, t'as pas tord! godgrace.gif Mais c'est plus rigolo sur calculette! minied.gif

Ca me met:
ERREUR ARRET

Et après il n'y a pas d'endroit précis dans le programme où j'ai pu faire une erreure:

Une fois ça me met:

Citer
:Output(1,1,"P1'S MOVE-"



Je réessais de suite après, et ça me met:

Citer
:If F=73 and N=2:Goto D



Et si je recommence ça me met à un autre endroit encore !...

maxiangry.gif frozen.gif godgrace.gif bigmouth.gif
crazy.gif

 Adresse email Haut de page Bas de page 
 
Google_AdSense



Publicité    



 
chakal37



Autorisation : Membre
Nb de messages : 18
Inscrit le : Sam 18 Oct 2008, 11:38
Posté le : Lun 10 Nov 2008, 18:23   Citer 

Je my connai pas trop mais tu peux ou dans la ligne sil te plait happy.gif

 Adresse email Haut de page Bas de page 
 
coc5
Avatar

Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Lun 10 Nov 2008, 18:24   Citer 

A ok...

Si tu appuies sur [On] durant le jeu, le programme s'arrête de cette manière.
C'est tout.

----------------------
Ne cliquez pas ici !
 Adresse email Haut de page Bas de page 
 
mlk23



Autorisation : Membre
Nb de messages : 21
Inscrit le : Dim 09 Nov 2008, 16:35
Posté le : Mar 11 Nov 2008, 10:45   Citer 

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]... godgrace.gif

 Adresse email Haut de page Bas de page 
 
coc5
Avatar

Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mar 11 Nov 2008, 10:53   Citer 

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 minied.gif ). 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é winkle.gif

----------------------
Ne cliquez pas ici !
 Adresse email Haut de page Bas de page 
 
Sangohan38



Autorisation : Membre
Nb de messages : 3370
Inscrit le : Sam 31 Déc 2005, 19:48
Posté le : Mar 11 Nov 2008, 10:59   Citer 

Ou alors tu cherche dans les programmes des internautes des morpions déjà fait.
Sinon, ton programme faisait combien d'octet coc5?

Sangohan38

 Adresse email Haut de page Bas de page 
 
coc5
Avatar

Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mar 11 Nov 2008, 11:06   Citer 


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 ^^

----------------------
Ne cliquez pas ici !
 Adresse email Haut de page Bas de page 
 
mlk23



Autorisation : Membre
Nb de messages : 21
Inscrit le : Dim 09 Nov 2008, 16:35
Posté le : Mar 11 Nov 2008, 11:28   Citer 

coc5 >> ça marche toujours pas... je crois que je vais laisser tomber et prendre le tient! glasses.gif Merci pour ton aide! godgrace.gif

 Adresse email Haut de page Bas de page 
 
coc5
Avatar

Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mar 11 Nov 2008, 12:18   Citer 

Si tu veux mais il est bof, le but étant de faire le minimum de ligne ^^

----------------------
Ne cliquez pas ici !
 Adresse email Haut de page Bas de page 
 
mlk23



Autorisation : Membre
Nb de messages : 21
Inscrit le : Dim 09 Nov 2008, 16:35
Posté le : Mar 11 Nov 2008, 16:43   Citer 

J'ai recopié ton code, y'a encore ma calculette qui m'affiche une erreure! godgrace.gif

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 ?

 Adresse email Haut de page Bas de page 
 
coc5
Avatar

Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mar 11 Nov 2008, 17:13   Citer 

J'ai recopié exactement la même chose et je n'ai pas cette erreur -_-"

Ne met surtout pas d'espaces en dehors du texte !

N'aurais -tu pas oublié un des deux crochets consécutifs du début ?

----------------------
Ne cliquez pas ici !
 Adresse email Haut de page Bas de page 
 
mlk23



Autorisation : Membre
Nb de messages : 21
Inscrit le : Dim 09 Nov 2008, 16:35
Posté le : Mar 11 Nov 2008, 17:25   Citer 

Non je n'ai rien oublié. J'ai tout vérifié caractère par caracrtère... frozen.gif godgrace.gif

Et le seul endroit où j'ai mis un espace, c'est là:


Citer
: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



Sous les deux lignes de Output(...
Mais c'est automatique ... crazy.gif comme j'arrive en fin de ligne...

godgrace.gif

 Adresse email Haut de page Bas de page 
 
coc5
Avatar

Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mar 11 Nov 2008, 17:42   Citer 

Aahhh mais je comprends...

Tu as tapé "[" + "A" + "]" alors que [A] désigne en fait une matrice située ici : [MATRX] + [1] minied.gif

----------------------
Ne cliquez pas ici !
 Adresse email Haut de page Bas de page 
 
mlk23



Autorisation : Membre
Nb de messages : 21
Inscrit le : Dim 09 Nov 2008, 16:35
Posté le : Mar 11 Nov 2008, 18:06   Citer 

Effectivement ! minied.gif
Bien vu !!! glasses.gif

Maintenant ça marche ! Sauf que... la grille ne s'affiche pas correctement.

A l'écran, j'ai: ( 1 "." = 1 espace)

[......]+---+[..
.........]![...]
![...........]![...
...]![..........
.]![...]![......
.....]+---+

et pourtant tout est juste dans le programme ! frozen.gif godgrace.gif

 Adresse email Haut de page Bas de page 
 
coc5
Avatar

Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mar 11 Nov 2008, 18:53   Citer 

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 winkle.gif

----------------------
Ne cliquez pas ici !
 Adresse email Haut de page Bas de page 
 
mlk23



Autorisation : Membre
Nb de messages : 21
Inscrit le : Dim 09 Nov 2008, 16:35
Posté le : Mar 11 Nov 2008, 20:04   Citer 

Oui, oui... c'est bien ce que j'ai fais happy.gif eyeonly.gif

 Adresse email Haut de page Bas de page 
 
coc5
Avatar

Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mar 11 Nov 2008, 20:14   Citer 

D'après ce que tu me décris tu as mis les crochets (regarde ton message précédent).

----------------------
Ne cliquez pas ici !
 Adresse email Haut de page Bas de page 
 
mlk23



Autorisation : Membre
Nb de messages : 21
Inscrit le : Dim 09 Nov 2008, 16:35
Posté le : Mer 12 Nov 2008, 15:00   Citer 

Oui, j'ai mis les crochets . happy.gif

 Adresse email Haut de page Bas de page 
 
Poster un nouveau sujet Poster une réponse Page: 1,      >>





  Powered by Fire-Soft-Board v1.0.10 © 2004 - 2024 Groupe FSB
Page générée en 9 requêtes
BlackOne par Grimmlink