Autorisation : Membre
Nb de messages : 3370
Inscrit le : Sam 31 Déc 2005, 19:48
Posté le : Mer 24 Mai 2006, 15:29
Et voici mon morpion fait maison:
Code
FullScreen
0=>Xmin
94=>Xmax
0=>Ymin
62=>Ymax
ClrDraw
CoordOff
GridOff
AxesOff
Horizontal 0
Horizontal 62
Vertical 0
Vertical 94
For(A,1,07
Text(10,A," SANGOHAN38"
End
For(A,1,10
Text(A,53," PRESENTE:"
End
For(A,1,34
Text(28,A," MORPION"
End
Text(52,27,"VERSION 1.0"
Pause
ClrDraw
Lbl 1
Menu("MORPION:","JORER",2,"INSTRUCTIONS",3,"QUITTER",4
Lbl 4
ClrDraw
ClrHome
Ortput(1,1," "
Stop
Lbl 3
ClrDraw
Text(1,1,"PORR JORER, ON UTILISE LES"
Text(7,1,"TORCHES [1] A [9]."
Text(13,1,"SOIT 7 LA TORCHE EN HAUT A"
Text(19,1,"GAUCHE."
Line(52,30,52,0
Line(22,30,22,00
Line(52,30,22,30
Line(52,20,22,20
Line(52,10,22,10
Line(52,00,22,00
Line(42,30,42,0
Line(32,30,32,0
Pause
Goto 1
Lbl 2
ClrDraw
1=>A
0=>L2(1)
0=>L2(2)
0=>L2(3)
0=>L2(4)
0=>L2(5)
0=>L2(6)
0=>L2(7)
0=>L2(8)
0=>L2(9)
Line(32,10,32,40
Line(42,10,42,40
Line(52,10,52,40
Line(62,10,62,40
Line(32,10,62,10
Line(32,20,62,20
Line(32,30,62,30
Line(32,40,62,40
Text(1,25,"JOUEUR"
Lbl 5
1=>A
Text(1,52,A
1=>X
GetKey=>B
If B=92:Goto C
If B=93:Goto D
If B=94:Goto E
If B=82:Goto 9
If B=83:Goto A
If B=84:Goto B
If B=72:Goto 6
If B=73:Goto 7
If B=74:Goto 8
Goto 5
Lbl F
2=>A
Text(1,52,A
4=>X
GetKey=>B
If B=92:Goto C
If B=93:Goto D
If B=94:Goto E
If B=82:Goto 9
If B=83:Goto A
If B=84:Goto B
If B=72:Goto 6
If B=73:Goto 7
If B=74:Goto 8
Goto F
Goto 5
Lbl 6
24=>S
36=>N
7=>O
Goto I
Lbl I
If L2(O)+X=1:Then:L2(O)+X=>L2(O)
Text(S,N,"X":Goto G
Else
If L2(O)+X=4:Then:L2(O)+X=>L2(O):Text(S,N,"O":Goto H
Else
If L2(O)=1 and X=1 or L2(O)=4 and X=1
Goto 5
If L2(O)=1 and X=4 or L2(O)=4 and X=4:Goto F
Lbl 7
24=>S
46=>N
8=>O
Goto I
Lbl 8
24=>S
56=>N
9=>O
Goto I
Lbl 9
34=>S
36=>N
4=>O
Goto I
Lbl A
34=>S
46=>N
5=>O
Goto I
Lbl B
34=>S
56=>N
6=>O
Goto I
Lbl C
44=>S
36=>N
1=>O
Goto I
Lbl D
44=>S
46=>N
2=>O
Goto I
Lbl E
44=>S
56=>N
3=>O
Goto I
Lbl M
If L2(7)+L2(8)+L2(9)=3 or L2(7)+L2(8)+L2(9)=12
Line(32,35,62,35
If L2(4)+L2(5)+L2(6)=3 or L2(4)+L2(5)+L2(6)=12
Line(32,25,62,25
If L2(1)+L2(2)+L2(3)=3 or L2(1)+L2(2)+L2(3)=12
Line(32,15,62,15
If L2(7)+L2(4)+L2(1)=3 or L2(7)+L2(4)+L2(1)=12
Line(37,40,37,10
If L2(8)+L2(5)+L2(2)=3 or L2(8)+L2(5)+L2(2)=12
Line(47,40,47,10
If L2(9)+L2(6)+L2(3)=3 or L2(9)+L2(6)+L2(3)=12
Line(57,40,57,10
If L2(7)+L2(5)+L2(3)=3 or L2(7)+L2(5)+L2(3)=12
Line(32,40,62,10
If L2(9)+L2(5)+L2(1)=3 or L2(9)+L2(5)+L2(1)=12
Line(62,40,32,10
Pause
Goto 1
Lbl G
If L2(1)+L2(2)+L2(3)=3 or L2(4)+L2(5)+L2(6)=3 or L2(7)+L2(8)+L2(9)=3 or L2(1)+L2(4)+L2(7)=3 or L2(2)+L2(5)+L2(8)=3 or L2(3)+L2(6)+L2(9)=3 or L2(1)+L2(5)+L2(9)=3 or L2(3)+L2(5)+L2(7)=3:Then:Text(7,30,"GAGNE":Goto M
Else
If L2(1)+L2(2)+L2(3)+L2(4)+L2(5)+L2(6)+L2(7)+L2(8)+L2(9)=21:Then:Text(7,30,"EGALITE"
Pause
Goto 1
Else
If L2(1)+L2(2)+L2(3)ø3 and L2(4)+L2(5)+L2(6)ø3 and L2(7)+L2(8)+L2(9)ø3 and L2(1)+L2(4)+L2(7)ø3 and L2(2)+L2(5)+L2(8)ø3 and L2(3)+L2(6)+L2(9)ø3 and L2(1)+L2(5)+L2(9)ø3 and L2(3)+L2(5)+L2(7)ø3
Goto F
Lbl H
If L2(1)+L2(2)+L2(3)=12 or L2(4)+L2(5)+L2(6)=12 or L2(7)+L2(8)+L2(9)=12 or L2(1)+L2(4)+L2(7)=12 or L2(2)+L2(5)+L2(8)=12 or L2(3)+L2(6)+L2(9)=12 or L2(1)+L2(5)+L2(9)=12 or L2(3)+L2(5)+L2(7)=12
Then
Text(7,30,"GAGNE"
Goto M
Else
If L2(1)+L2(2)+L2(3)ø12 and L2(4)+L2(5)+L2(6)ø12 and L2(7)+L2(8)+L2(9)ø12 and L2(1)+L2(4)+L2(7)ø12 and L2(2)+L2(5)+L2(8)ø12 and L2(3)+L2(6)+L2(9)ø12 and L2(1)+L2(5)+L2(9)ø12 and L2(3)+L2(5)+L2(7)ø12
Goto 5
Et le code de mon puissance 4(il manque les conditions de victoire):
Code
FullScreen
0=>Xmin
94=>Xmax
0=>Ymin
62=>Ymax
ClrDraw
CoordOff
QuadOff
AxesOff
Horizontal 0
Horizontal 62
Vertical 0
Vertical 94
For(A,1,07
Text(10,A," SANGOHAN38"
End
For(A,1,10
Text(A,53," PRESENTE:"
End
For(A,1,25
Text(32,A," PUISSANCE 4"
End
Text(52,27,"VERSION 1.0"
Pause
ClrDraw
Lbl 1
Menu("PUISSANCE 4","JOUER",2,"INSTRUCTIONS",3,"QUITTER",4)
Lbl 3
ClrDraw
Text(1,1,"LE BUT DE CE JEU EST "
Text(7,1,"D ALINER 4 PIONTS SOIT"
Text(13,1,"EN LIGNE, SOIT EN COLONNE"
Text(19,1,"SOIT EN DIAGONALE."
Text(28,1,"POUR CHOISIR LA COLONNE,"
Text(34,1,"ON UTILISE LES FLECHES ET"
Text(40,1,"LA TOUCHE [2ND]."
Pause
Goto 1
Lbl 4
ClrHome
ClrDraw
Output(1,1," "
Stop
Lbl 2
ClrDraw
41=>A
EffListe L1
43=>dim(L1
Float
Line(37,50,93,50
Line(37,42,93,42
Line(37,34,93,34
Line(37,26,93,26
Line(37,18,93,18
Line(37,10,93,10
Line(37,2,93,2
Line(37,50,37,2
Line(45,50,45,2
Line(53,50,53,2
Line(61,50,61,2
Line(69,50,69,2
Line(77,50,77,2
Line(85,50,85,2
Line(93,50,93,2
Text(17,5,"JOUEUR"
(-)2=>Y
Lbl 5
1=>[THETA]
1=>B
Text(17,31,[THETA]
Pt-Off(A-8,52
Pt-Off(A-8,53
Pt-Off(A-8,54
Pt-Off(A-8,55
Pt-Off(A+8,52
Pt-Off(A+8,53
Pt-Off(A+8,54
Pt-Off(A+8,55
Line(A,52,A,55
Getkey=>C
If C=24:A-8=>A
If C=26:A+8=>A
If C=21:Goto 6
Goto 5
Lbl 7
2=>[THETA]
0.1=>B
Text(17,31,[THETA]
Pt-Off(A-8,52
Pt-Off(A-8,53
Pt-Off(A-8,54
Pt-Off(A-8,55
Pt-Off(A+8,52
Pt-Off(A+8,53
Pt-Off(A+8,54
Pt-Off(A+8,55
Line(A,52,A,55
Getkey=>C
If C=24:A-8=>A
If C=26:A+8=>A
If C=21:Goto 6
Goto 7
Lbl 6
If A=41:1=>Z
If A=49:7=>Z
If A=57:13=>Z
If A=65:19=>Z
If A=73:25=>Z
If A=81:31=>Z
If A=89:37=>Z
Goto 0
Lbl 0
Z+1=>Z
Y+8=>Y
If L1(Z)[différent de]0 et B=1:Goto 0
If L1(Z)[différent de]0 et B=0.1:Goto 0
If L1(Z)=0 et B=1:Goto 8
If L1(Z)=0 et B=0.1:Goto 9
Lbl 8
Circle(A,Y,3
1=>L1(Z)
(-)2=>Y
Goto 7
Lbl 9
Circle(A,Y,3
0.1=>L1(Z)
Line(A-3,Y,A+3,Y
Line(A,Y-3,A,Y+3
(-)2=>Y
Goto 5
Autorisation : Membre
Nb de messages : 3370
Inscrit le : Sam 31 Déc 2005, 19:48
Posté le : Jeu 25 Mai 2006, 11:22
Ouai: quand tu enregistre un prog à partir d'un bloc note de ti grph link, il te montre les erreures mais comme la j'ai pris sur le ti graph link 83+ anglais c'est bon.
Autorisation : Membre
Nb de messages : 1561
Inscrit le : Mer 01 Mar 2006, 20:41
Posté le : Ven 16 Jui 2006, 13:55
Disp, c'est la methode la plus simple, c'est pas mal pour les debutants , mais effectivement output permet 8 lignes de textes et en plus c'est plus rapide à afficher
Autorisation : Membre
Nb de messages : 3370
Inscrit le : Sam 31 Déc 2005, 19:48
Posté le : Ven 16 Jui 2006, 19:25
Pero, j'ai connu Output avant Dip ce qui fait que je favorise le Output.
Et puis pas besoin de mettre Disp quand j'arrive au même résultat en un Output.
Autorisation : Membre
Nb de messages : 3370
Inscrit le : Sam 31 Déc 2005, 19:48
Posté le : Ven 16 Jui 2006, 20:37
Pa forcement, moi j'utilise une méthode assez simple: on sait que c'est les " qui délimitent les lignes donc après le texte s'affiche en fonction.
Sinon, c'est pas pour 4 octets de plu qu'on va pleurer.
Même si au bout d'un moment, ça commence a devenir un grand chiffre.