Autorisation : Membre
Nb de messages : 51
Inscrit le : Mar 13 Nov 2007, 18:54
Posté le : Lun 19 Nov 2007, 19:35
Bon ba c'est mon premier jeu graphique, je pense ya moyen d'économiser beaucoup de place mais bon c'est un début
Il faut prendre l'image pour jouer (c'est la table de morpion)
P.S: Je n'ai pas mis d'AI pour la première version, sa sera pour la prochaine
Autorisation : Membre
Nb de messages : 51
Inscrit le : Mar 13 Nov 2007, 18:54
Posté le : Mar 20 Nov 2007, 13:15
Voici le code de mon morpion
Il n'y a pas d'AI pour cette version... Mais des beaux graphiques
Code
ClrHome
Output(3,3,"LE MORPION
Output(4,5,"V1.1
Output(6,6,"BY :
Output(7,2,"ROBIN CARAYOL
For(T,11,900)
End
0üXmin
0üYmin
94üXmax
62üYmax
AxesOff
0üS
0üR
Lbl 7
ClrHome
ClrDraw
Menu("MORPION V1.1","JOUER/CONTINUER!",8,"INFOS",9,"QUITTER",10
Lbl 9
ClrHome
ClrDraw
Text(0,10,"MORPION VERSION 1.1
Text(6,15,"BY : ROBIN CARAYOL
Text(20,5,"BUT DU JEU :
Text(26,0,"ALIGNER TROIS MEMES SIGNE
Text(40,0,"POUR TOUT RENSEIGNEMENT :
Text(46,0,"ROBIN.CARAYOL A HOTMAIL.FR
Circle(52,13,3
Pause
Goto 7
Lbl 8
randInt(1,2)üJ
{0,0,0,0,0,0,0,0,0}üL
ClrHome
ClrDraw
RecallPic 5
Text(14,55,"JOUER :"
Text(22,55,"JOUEUR 1
Text(28,55,"JOUEUR 2
Lbl Á
Repeat K=45
If L(1)+L(2)+L(3)=3 or L(4)+L(5)+L(6)=3 or L(7)+L(8)+L(9)=3 or L(1)+L(4)+L(7)=3 or L(2)+L(5)+L(8)=3 or L(3)+L(6)+L(9)=3 or L(1)+L(5)+L(9)=3 or L(3)+L(5)+L(7)=3
Goto 4
If L(1)+L(2)+L(3)=15 or L(4)+L(5)+L(6)=15 or L(7)+L(8)+L(9)=15 or L(1)+L(4)+L(7)=15 or L(2)+L(5)+L(8)=15 or L(3)+L(6)+L(9)=15 or L(1)+L(5)+L(9)=15 or L(3)+L(5)+L(7)=15
Goto 5
If L(1)ø0 and L(2)ø0 and L(3)ø0 and L(4)ø0 and L(5)ø0 and L(6)ø0 and L(7)ø0 and L(2)ø0 and L(9)ø0
Goto 6
Pt-Off(85,35)
Pt-Off(85,38)
Pt-Off(88,38)
Pt-Off(88,35)
Pt-Off(86,36)
Pt-Off(86,37)
Pt-Off(87,37)
Pt-Off(87,36)
Pt-Off(85,30)
Pt-Off(85,33)
Pt-Off(88,33)
Pt-Off(88,30)
Pt-Off(86,31)
Pt-Off(86,32)
Pt-Off(87,32)
Pt-Off(87,31)
If J=1
Goto 1
If J=2
Line(85,33,88,30)
Line(85,30,88,33)
getKeyüK
If K=92 and L(1)=0
Circle(25,22,3
If K=92 and L(1)=0
J-1üJ
If K=92 and L(1)=0
5üL(1
If K=93 and L(2)=0
Circle(35,22,3
If K=93 and L(2)=0
J-1üJ
If K=93 and L(2)=0
5üL(2)
If K=94 and L(3)=0
Circle(45,22,3
If K=94 and L(3)=0
J-1üJ
If K=94 and L(3)=0
5üL(3
If K=82 and L(4)=0
Circle(25,32,3
If K=82 and L(4)=0
J-1üJ
If K=82 and L(4)=0
5üL(4
If K=83 and L(5)=0
Circle(35,32,3
If K=83 and L(5)=0
J-1üJ
If K=83 and L(5)=0
5üL(5
If K=84 and L(6)=0
Circle(45,32,3
If K=84 and L(6)=0
J-1üJ
If K=84 and L(6)=0
5üL(6
If K=72 and L(7)=0
Circle(25,42,3
If K=72 and L(7)=0
J-1üJ
If K=72 and L(7)=0
5üL(7
If K=73 and L(8)=0
Circle(35,42,3
If K=73 and L(8)=0
J-1üJ
If K=73 and L(8)=0
5üL(8
If K=74 and L(9)=0
Circle(45,42,3
If K=74 and L(9)=0
J-1üJ
If K=74 and L(9)=0
5üL(9
Goto Á
Lbl 1
Line(85,35,88,38)
Line(85,38,88,35)
getKeyüK
If K=92 and L(1)=0
Line(23,20,27,24)
If K=92 and L(1)=0
Line(27,20,23,24)
If K=92 and L(1)=0
J+1üJ
If K=92 and L(1)=0
1üL(1)
If K=93 and L(2)=0
Line(33,24,37,20)
If K=93 and L(2)=0
Line(33,20,37,24)
If K=93 and L(2)=0
J+1üJ
If K=93 and L(2)=0
1üL(2)
If K=94 and L(3)=0
Line(43,20,47,24
If K=94 and L(3)=0
Line(47,20,43,24)
If K=94 and L(3)=0
J+1üJ
If K=94 and L(3)=0
1üL(3)
If K=82 and L(4)=0
Line(23,30,27,34)
If K=82 and L(4)=0
Line(23,34,27,30)
If K=82 and L(4)=0
J+1üJ
If K=82 and L(4)=0
1üL(4)
If K=83 and L(5)=0
Line(33,30,37,34
If K=83 and L(5)=0
Line(33,34,37,30)
If K=83 and L(5)=0
J+1üJ
If K=83 and L(5)=0
1üL(5)
If K=84 and L(6)=0
Line(43,30,47,34)
If K=84 and L(6)=0
Line(43,34,47,30)
If K=84 and L(6)=0
J+1üJ
If K=84 and L(6)=0
1üL(6)
If K=72 and L(7)=0
Line(23,40,27,44)
If K=72 and L(7)=0
Line(23,44,27,40)
If K=72 and L(7)=0
J+1üJ
If K=72 and L(7)=0
1üL(7)
If K=73 and L(8)=0
Line(33,40,37,44)
If K=73 and L(8)=0
Line(33,44,37,40)
If K=73 and L(8)=0
J+1üJ
If K=73 and L(8)=0
1üL(8)
If K=74 and L(9)=0
Line(43,40,47,44)
If K=74 and L(9)=0
Line(43,44,47,40)
If K=74 and L(9)=0
J+1üJ
If K=74 and L(9)=0
1üL(9)
Goto Á
End
Lbl 4
ClrDraw
ClrHome
S+1üS
Output(3,4,"JOUEUR 1
Output(4,5,"GAGNE
Output(6,2,"JOUEUR 1 :
Output(6,13,S)
Output(7,2,"JOUEUR 2 :
Output(7,13,R
Pause
ClrHome
ClrDraw
Goto 7
Lbl 5
ClrDraw
ClrHome
R+1üR
Output(3,4,"JOUEUR 2
Output(4,5,"GAGNE
Output(6,2,"JOUEUR 1 :
Output(6,13,S
Output(7,2,"JOUEUR 2 :
Output(7,13,R
Pause
ClrHome
ClrDraw
Goto 7
Lbl 6
ClrDraw
ClrHome
Output(4,4,"EGALITE"
Output(6,2,"JOUEUR 1 :
Output(6,13,S
Output(7,2,"JOUEUR 2 :
Output(7,13,R
Pause
ClrHome
ClrDraw
Goto 7
Lbl 10
ClrHome
ClrDraw
Stop
Autorisation : Membre
Nb de messages : 768
Inscrit le : Jeu 28 Sep 2006, 18:42
Posté le : Mar 20 Nov 2007, 16:55
If K=92 and L(1)=0
Line(23,20,27,24)
If K=92 and L(1)=0
Line(27,20,23,24)
If K=92 and L(1)=0
J+1üJ
If K=92 and L(1)=0
1üL(1)
If K=93 and L(2)=0
Line(33,24,37,20)
If K=93 and L(2)=0
Line(33,20,37,24)
If K=93 and L(2)=0
J+1üJ
If K=93 and L(2)=0
1üL(2)
If K=94 and L(3)=0
Line(43,20,47,24
If K=94 and L(3)=0
Line(47,20,43,24)
If K=94 and L(3)=0
J+1üJ
If K=94 and L(3)=0
1üL(3)
If K=82 and L(4)=0
Line(23,30,27,34)
If K=82 and L(4)=0
Line(23,34,27,30)
If K=82 and L(4)=0
J+1üJ
If K=82 and L(4)=0
1üL(4)
If K=83 and L(5)=0
Line(33,30,37,34
If K=83 and L(5)=0
Line(33,34,37,30)
If K=83 and L(5)=0
J+1üJ
If K=83 and L(5)=0
1üL(5)
If K=84 and L(6)=0
Line(43,30,47,34)
If K=84 and L(6)=0
Line(43,34,47,30)
If K=84 and L(6)=0
J+1üJ
If K=84 and L(6)=0
1üL(6)
If K=72 and L(7)=0
Line(23,40,27,44)
If K=72 and L(7)=0
Line(23,44,27,40)
If K=72 and L(7)=0
J+1üJ
If K=72 and L(7)=0
1üL(7)
If K=73 and L(=0
Line(33,40,37,44)
If K=73 and L(=0
Line(33,44,37,40)
If K=73 and L(=0
J+1üJ
If K=73 and L(=0
1üL(
If K=74 and L(9)=0
Line(43,40,47,44)
If K=74 and L(9)=0
Line(43,44,47,40)
If K=74 and L(9)=0
J+1üJ
If K=74 and L(9)=0
1üL(9)
c'est enorme ça, je veux dire dans mon morpion ça preniat large moisn de place
Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mar 20 Nov 2007, 20:58
D'abord bravo pour ton premier programme, ne te décourage pas
Sinon, il n'est pas si mal mais disons qu'on peut faire un bon morpion en une vingtaine de ligne tout au plus.
Tu gagnerais beaucoup (énormément en fait^^) à connaître les For(
Rapidement:
For( prend trois arguments et un quatrième facultatif , c'est à dire que tu dois lui donner trois information.
Sous cette forme:
Code
For(I,0,100)
*****Ton code*****
End
C'est un exemple. En fait, ce code met 0 dans I, lit le code jusqu'à :End, puis rajoute un à I (on dit incrémenter), et ainsi de suite jusqu'à que I arrive à cent.
En fait par exemple pour remplir un écran ou Ymin=0 et Ymax=62 tu peux écrire ça:
Code
For(I,0,62
Horizontal I
End
Sinon pense aussi à étudier les matrices (comme des listes mais à doubles entrés, c'est à dire des tableaux). C'est facile pour un morpion, tu fais un tableau de 3x3.
Code
{3,3 - > dim([A]
tu peux ensuite tester une case pour voir si elle est remplie ( If [A](X,Y) )
Mais je te le répète, c'est déjà très bien que tu aies réussis ce programme, c'est très bien pour un premier programme, je ne peux que t'encourager !
Autorisation : Membre
Nb de messages : 51
Inscrit le : Mar 13 Nov 2007, 18:54
Posté le : Mar 20 Nov 2007, 21:10
Et ba merci bien pour ces conseils (j'ai commencé à programmé il y a 3 ou 4 semaines) donc sa fait plaisir. Je vais essayer de refaire le morpion en faisant ce que tu a dis ! Mais pour l'instant je suis en train de faire un snake graphique, je l'aurais surement fini demain ou aprés-demain.
Autorisation : Membre
Nb de messages : 51
Inscrit le : Mar 13 Nov 2007, 18:54
Posté le : Mer 21 Nov 2007, 15:59
Euh, par contre j'ai une petite question:
avec les matices (je sais comment sa marche et tout mais...) est-il possible de "selectionner" toute un ligne? Je m'explique: dans le morpion, quand je joue j'obtient ça par exemple:
Code
1 5 1
5 1 1
5 5 1<==toute cette ligne
Si c'est possible sa me prendrais beaucoup moin de place dans mon jeu
Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mer 21 Nov 2007, 16:01
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," +---+ ! ! ! ! ! ! +---+
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