Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Lun 18 Jui 2007, 13:46
(By Ziassan)
Bon voilà, ça fait bientôt un an que je trifouille la programmation, et je viens de découvrir que je n'étais pas le seul à le faire il y a deux mois. Depuis, j'ai fais quelques programmes dont je considère le démineur comme le plus aboutie.
Je le mettrais ici dès que je l'aurais transféré sur mon ordi. (je tape tout sur ma calculatrice, en cours par exemple^^)
Le problème c'est que je n'y arrive pas. J'ai télécherger mes programmes, mais ils restent sous un format étrange inouvrable. Sinon j'ai des tas de programmes à faire partager (ma connaissance de la programmation est assez désiquilibrée)
Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Lun 18 Jui 2007, 14:15
Finalement, ce fut dur, mais j'ai réussis
Code
CoordOff:GridOff:AxesOff:LabelOff
0=>Xmin:62=>Ymax
0=>Ymin:94=>Xmax
ClrDraw
Vertical 0
Vertical 94
Horizontal 0
Horizontal 62
Line(0,29,94,29
Line(0,30,94,30
Line(0,31,94,31
Line(0,32,94,32
Line(0,33,94,33
For(I,0,7
18!
Line(I,33,I,29
Text(28,I+1,"COC5
If getKey[pas égal à]0:Goto K
End
For(I,93,25,(-)1
If getKey[pas égal à]0:Goto K
I+33
Line(Ans,29,Ans,33
Text(28,I-1," PRESENTE"
Line(94,29,94,33
End
For(I,58,82)
If getKey[pas égal à]0:Goto K
If I=58:Text(28,I-2," D
If I=62:Text(28,I,"E
If I=66:Text(28,I,"M
If I=69+1:Text(28,I,"I
If I=74:Text(28,I,"N
If I=78:Text(28,I,"O
If I=82:Text(28,I,"C
End
For(I,1,5):69!:End
Text(28,1," COC5 PRESENTE DEMINOC "
Lbl K
For(I,6,85
getKey=>K
If K[pas égal à]0:Goto 89
Pt-Change(I,28
Pt-Change(I,29
Pt-Change(I,30
Pt-Change(I,31
Pt-Change(I,32
Pt-Change(I,33
Pt-Change(I,34
End
Goto K
Lbl 89:0=>M
{1,1}=>dim([A]
ClrHome
Menu("DEMINOC","COMMENCER",18,"TAILLE",68,"NOMBRE DE MINE",77,"INSTRUCTIONS",67,"QUITTER",96
Lbl 96
ClrHome
Output(3,1,"JEU ELABORE PAR
Output(5,7,"COC5"
Pause
Stop
Goto 89
Lbl 67
ClrHome
Output(1,1,"DEMINOC :
Output(3,2,"End
Output(3,2,"2
Output(3,6," = DEVOILER LA CASE
Output(5,2,"ALPHA = MARQUER"
Pause :ClrHome
Output(1,1,"POUR GAGNER,VOUS DEVEZ MARQUER TOUTES LES MINES SANS EN DEVOILER UNE SEULE. UN TEMPS D'ATTENTE EST NECESSAIRE(SELON LA TAILLE)
Pause
Goto 89
Lbl 68
Input "TAILLE ?(1/9)",N
If N<1 or N>9:Then:ClrHome:Goto 68:End
(-)N+14=>Liste4(1)
Goto 89
Lbl 77
Input "NOMBRE DE MINE?",ø
If ø=555:Then:0=>ø:Goto 89:End
If ø<1:Then:Disp "PETIT JOUEUR !":Pause :ClrHome:Goto 77:End
If ø>10(N^1.5):Then:Disp "TROP DE MINES !":Pause :ClrHome:Goto 77:End
Goto 89
Lbl 18
0=>N
int(62/Liste4(1))=>Liste4(2)
int(94/Liste4(1))=>Liste4(3)
{Liste4(2)+3,Liste4(3)+3}=>dim([A]
round((94-Liste4(1)*Liste4(3))/2)=>Liste4(4)
round((62-Liste4(1)*Liste4(2))/2)=>Liste4(5)
0-Liste4(4)=>Xmin
0-Liste4(5)=>Ymin
94-Liste4(4)=>Xmax
62-Liste4(5)=>Ymax
Text(31,25,"PATIENTEZ...
Text(3,8,"SI BUG, TAPER [CLEAR]"
For(I,62,Liste4(2)*Liste4(1)+1,(-)1
Line(0,I+2,94,I+1,0:End
If ø<1:Goto 6
Repeat N=ø
Text(31,69,ø-N
If ø-N<10:Text(31,72,"
Lbl 1
If getKey=45:Goto ø
randInt(2,Liste4(2)+1=>A
randInt(2,Liste4(3)+1=>B
If [A](A,B)=9:Goto 1
9=>[A](A,B)
N+1=>N
End
Lbl 6:ClrDraw
1=>ø:1=>Z
0=>M
For(I,0,(Liste4(1)*Liste4(2))/2
Line(0,I,Liste4(1)*Liste4(3),I
Line(0,Liste4(1)*Liste4(2)-I,Liste4(1)*Liste4(3),Liste4(1)*Liste4(2)-I
End
For(J,0,95,Liste4(1)):Line(0,J,94,J,0):Line(J,0,J,94,0):End
Line(Liste4(3)*Liste4(1)+1,0,Liste4(3)*Liste4(1)+1,Liste4(2)*Liste4(1)
Line(0,Liste4(1)*Liste4(2)+1,Liste4(3)*Liste4(1),Liste4(2)*Liste4(1)+1
Line(0,(-)1,Liste4(3)*Liste4(1),(-)1
Line((-)1,0,(-)1,Liste4(2)*Liste4(1)
0=>Y
For(I,2,Liste4(2)+2
For(J,2,Liste4(3)+2
If Y=N:Goto U
If [A](I,J)=9
Then
1+YüY
For(L,(-)1,1
For(K,(-)1,1
[A](I+K,J+L)
If Ans[pas égal à]9:Ans+1=>[A](I+K,J+L)
End:End
End:End:End
Lbl U
Pt-On(ø-1,Z-1)
Pt-On(ø-1,Z+Liste4(1)-1)
Pt-On(ø+Liste4(1)-1,Z-1)
Pt-On(ø+Liste4(1)-1,Z-1+Liste4(1))
[A]=>[B]
For(I,2,Liste4(2)+2
For(J,2,Liste4(3)+2
If [A](I,J)=9:10=>[B](I,J)
End:End
(-)int(Liste4(1)/2)=>P
Lbl 0
getKey=>K
If K>23 and K<35:Then
Pt-Off(ø-1,Z-1):Pt-Off(ø-1,Z+Liste4(1)-1):Pt-Off(ø+Liste4(1)-1,Z-1):Pt-Off(ø+Liste4(1)-1,Z-1+Liste4(1))
If K=26 and F<Liste4(3)+1:Liste4(1)+ø=>ø
If K=24 and ø-Liste4(1)>0:(-)Liste4(1)+ø=>ø
If K=25 and G<Liste4(3)+1:Z+Liste4(1)=>Z
If K=34 and Z-Liste4(1)>0:Z-Liste4(1)=>Z
Pt-On(ø-1,Z-1):Pt-On(ø-1,Z+Liste4(1)-1):Pt-On(ø+Liste4(1)-1,Z-1):Pt-On(ø+Liste4(1)-1,Z-1+Liste4(1))
End
(ø-1)/Liste4(1)+2=>F
M+1=>M
0=>R
(Z-1)/Liste4(1)+2=>G
If K=31:Then
If [A](G,F)=10:1=>R
Line(ø+1,Z+1,ø-3+Liste4(1),Z-3+Liste4(1),R
Line(ø+1,Z-3+Liste4(1),ø-3+Liste4(1),Z+1,R
10=>[A](G,F)
If R=1:Then
[B](G,F)=>[A](G,F)
If [A](G,F)=10:9=>[A](G,F)
End:End
If [A]=[B]:Goto 7
If K=21:Then
int(((Liste4(1)-2)/2)+1=>O
For(I,O,0,(-)1
Line(ø+I,Z,ø+I,Z+Liste4(1)-2,0
Line(ø-I+Liste4(1)-1,Z,ø-I+Liste4(1)-1,Z+Liste4(1)-2,0
End
If [A](G,F)[pas égal à]0:Text((58-Z+P),ø-P,[A](G,F)
If [A](G,F)=9:Then
Text(58-Z+P,ø-P,"ø
Goto 69:End
If [A](G,F)=0:Then
G-2=>J
F-2=>I
For(K,0,Liste4(1)-2
Line((I)Liste4(1)+1+K,(J)Liste4(1),(I)Liste4(1)+1+K,(J)Liste4(1)+Liste4(1),0):End
End:End
Goto 0
Lbl 7
ClrHome
For(I,47,94
Line(I,0,94-I,62,0
Line(94-I,0,I,62,0
End
For(I,62,31,(-)1
Line(0,I,94,62-I,0
Line(0,62-I,94,I,0
End
Disp "GAGNE !!!","TEMPS:"
Output(2,7,M
Disp "TEMPS PAR MINE "
Disp ">
Output(4,2,M/Y
Output(4,7," "
Autorisation : Membre
Nb de messages : 1561
Inscrit le : Mer 01 Mar 2006, 20:41
Posté le : Lun 18 Jui 2007, 16:47
J'en pense que tu as mis la mauvaise balise et aussi que vu les ü et û tu as le cable, et que que d'après le code tu as surement une 84 + se ou une 83 + j'en sais rien , et comme tu programmes depuis un certain temps tu ferais bien de te mettre à l'asm parce que le basic pour la plupart d'entre nous c'est une corvée que de devoir tester les jeux des autres. ((( )))
voila
et j'en profite pour te convertir les symboles de ton code grace à mon algo magic
cadeau de bienvenue :
Code
CoordOff:GridOff:AxesOff:LabelOff
0=>Xmin:62=>Ymax
0=>Ymin:94=>Xmax
ClrDraw
Vertical 0
Vertical 94
Horizontal 0
Horizontal 62
Line(0,29,94,29
Line(0,30,94,30
Line(0,31,94,31
Line(0,32,94,32
Line(0,33,94,33
For(I,0,7
18!
Line(I,33,I,29
Text(28,I+1,"COC5
If getKey[pas égal à]0:Goto K
End
For(I,93,25,(-)1
If getKey[pas égal à]0:Goto K
I+33
Line(Ans,29,Ans,33
Text(28,I-1," PRESENTE"
Line(94,29,94,33
End
For(I,58,82)
If getKey[pas égal à]0:Goto K
If I=58:Text(28,I-2," D
If I=62:Text(28,I,"E
If I=66:Text(28,I,"M
If I=69+1:Text(28,I,"I
If I=74:Text(28,I,"N
If I=78:Text(28,I,"O
If I=82:Text(28,I,"C
End
For(I,1,5):69!:End
Text(28,1," COC5 PRESENTE DEMINOC "
Lbl K
For(I,6,85
getKey=>K
If K[pas égal à]0:Goto 89
Pt-Change(I,28
Pt-Change(I,29
Pt-Change(I,30
Pt-Change(I,31
Pt-Change(I,32
Pt-Change(I,33
Pt-Change(I,34
End
Goto K
Lbl 89:0=>M
{1,1}=>dim([A]
ClrHome
Menu("DEMINOC","COMMENCER",18,"TAILLE",68,"NOMBRE DE MINE",77,"INSTRUCTIONS",67,"QUITTER",96
Lbl 96
ClrHome
Output(3,1,"JEU ELABORE PAR
Output(5,7,"COC5"
Pause
Stop
Goto 89
Lbl 67
ClrHome
Output(1,1,"DEMINOC :
Output(3,2,"End
Output(3,2,"2
Output(3,6," = DEVOILER LA CASE
Output(5,2,"ALPHA = MARQUER"
Pause :ClrHome
Output(1,1,"POUR GAGNER,VOUS DEVEZ MARQUER TOUTES LES MINES SANS EN DEVOILER UNE SEULE. UN TEMPS D'ATTENTE EST NECESSAIRE(SELON LA TAILLE)
Pause
Goto 89
Lbl 68
Input "TAILLE ?(1/9)",N
If N<1 or N>9:Then:ClrHome:Goto 68:End
(-)N+14=>Liste4(1)
Goto 89
Lbl 77
Input "NOMBRE DE MINE?",ø
If ø=555:Then:0=>ø:Goto 89:End
If ø<1:Then:Disp "PETIT JOUEUR !":Pause :ClrHome:Goto 77:End
If ø>10(N^1.5):Then:Disp "TROP DE MINES !":Pause :ClrHome:Goto 77:End
Goto 89
Lbl 18
0=>N
int(62/Liste4(1))=>Liste4(2)
int(94/Liste4(1))=>Liste4(3)
{Liste4(2)+3,Liste4(3)+3}=>dim([A]
round((94-Liste4(1)*Liste4(3))/2)=>Liste4(4)
round((62-Liste4(1)*Liste4(2))/2)=>Liste4(5)
0-Liste4(4)=>Xmin
0-Liste4(5)=>Ymin
94-Liste4(4)=>Xmax
62-Liste4(5)=>Ymax
Text(31,25,"PATIENTEZ...
Text(3,8,"SI BUG, TAPER [CLEAR]"
For(I,62,Liste4(2)*Liste4(1)+1,(-)1
Line(0,I+2,94,I+1,0:End
If ø<1:Goto 6
Repeat N=ø
Text(31,69,ø-N
If ø-N<10:Text(31,72,"
Lbl 1
If getKey=45:Goto ø
randInt(2,Liste4(2)+1=>A
randInt(2,Liste4(3)+1=>B
If [A](A,B)=9:Goto 1
9=>[A](A,B)
N+1=>N
End
Lbl 6:ClrDraw
1=>ø:1=>Z
0=>M
For(I,0,(Liste4(1)*Liste4(2))/2
Line(0,I,Liste4(1)*Liste4(3),I
Line(0,Liste4(1)*Liste4(2)-I,Liste4(1)*Liste4(3),Liste4(1)*Liste4(2)-I
End
For(J,0,95,Liste4(1)):Line(0,J,94,J,0):Line(J,0,J,94,0):End
Line(Liste4(3)*Liste4(1)+1,0,Liste4(3)*Liste4(1)+1,Liste4(2)*Liste4(1)
Line(0,Liste4(1)*Liste4(2)+1,Liste4(3)*Liste4(1),Liste4(2)*Liste4(1)+1
Line(0,(-)1,Liste4(3)*Liste4(1),(-)1
Line((-)1,0,(-)1,Liste4(2)*Liste4(1)
0=>Y
For(I,2,Liste4(2)+2
For(J,2,Liste4(3)+2
If Y=N:Goto U
If [A](I,J)=9
Then
1+YüY
For(L,(-)1,1
For(K,(-)1,1
[A](I+K,J+L)
If Ans[pas égal à]9:Ans+1=>[A](I+K,J+L)
End:End
End:End:End
Lbl U
Pt-On(ø-1,Z-1)
Pt-On(ø-1,Z+Liste4(1)-1)
Pt-On(ø+Liste4(1)-1,Z-1)
Pt-On(ø+Liste4(1)-1,Z-1+Liste4(1))
[A]=>[B]
For(I,2,Liste4(2)+2
For(J,2,Liste4(3)+2
If [A](I,J)=9:10=>[B](I,J)
End:End
(-)int(Liste4(1)/2)=>P
Lbl 0
getKey=>K
If K>23 and K<35:Then
Pt-Off(ø-1,Z-1):Pt-Off(ø-1,Z+Liste4(1)-1):Pt-Off(ø+Liste4(1)-1,Z-1):Pt-Off(ø+Liste4(1)-1,Z-1+Liste4(1))
If K=26 and F<Liste4(3)+1:Liste4(1)+ø=>ø
If K=24 and ø-Liste4(1)>0:(-)Liste4(1)+ø=>ø
If K=25 and G<Liste4(3)+1:Z+Liste4(1)=>Z
If K=34 and Z-Liste4(1)>0:Z-Liste4(1)=>Z
Pt-On(ø-1,Z-1):Pt-On(ø-1,Z+Liste4(1)-1):Pt-On(ø+Liste4(1)-1,Z-1):Pt-On(ø+Liste4(1)-1,Z-1+Liste4(1))
End
(ø-1)/Liste4(1)+2=>F
M+1=>M
0=>R
(Z-1)/Liste4(1)+2=>G
If K=31:Then
If [A](G,F)=10:1=>R
Line(ø+1,Z+1,ø-3+Liste4(1),Z-3+Liste4(1),R
Line(ø+1,Z-3+Liste4(1),ø-3+Liste4(1),Z+1,R
10=>[A](G,F)
If R=1:Then
[B](G,F)=>[A](G,F)
If [A](G,F)=10:9=>[A](G,F)
End:End
If [A]=[B]:Goto 7
If K=21:Then
int(((Liste4(1)-2)/2)+1=>O
For(I,O,0,(-)1
Line(ø+I,Z,ø+I,Z+Liste4(1)-2,0
Line(ø-I+Liste4(1)-1,Z,ø-I+Liste4(1)-1,Z+Liste4(1)-2,0
End
If [A](G,F)[pas égal à]0:Text((58-Z+P),ø-P,[A](G,F)
If [A](G,F)=9:Then
Text(58-Z+P,ø-P,"ø
Goto 69:End
If [A](G,F)=0:Then
G-2=>J
F-2=>I
For(K,0,Liste4(1)-2
Line((I)Liste4(1)+1+K,(J)Liste4(1),(I)Liste4(1)+1+K,(J)Liste4(1)+Liste4(1),0):End
End:End
Goto 0
Lbl 7
ClrHome
For(I,47,94
Line(I,0,94-I,62,0
Line(94-I,0,I,62,0
End
For(I,62,31,(-)1
Line(0,I,94,62-I,0
Line(0,62-I,94,I,0
End
Disp "GAGNE !!!","TEMPS:"
Output(2,7,M
Disp "TEMPS PAR MINE "
Disp ">
Output(4,2,M/Y
Output(4,7," "
Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Lun 18 Jui 2007, 17:32
Merci, mais c'est quoi l'asm ? (Assembleur ? Mais c'est quoi l'assembleur^^ ?) J'ai depuis toujours programmé sur ma calculatrice (qui d'ailleurs est une Ti82stats).
Si vous avez des suggestions pour améliorer ce programme dîtes le moi s'il vous plaît
Et sinon, il est bien ou pas ? (vu que je connais que moi qui a fait des démineurs, ça fausse un peu mon jugement^^)
Autorisation : Membre
Nb de messages : 891
Inscrit le : Sam 16 Jui 2007, 13:37
Posté le : Mar 19 Jui 2007, 10:44
Ca me renseigne pas trop pour l'assembleur^^
Je vois qu'un jeu de super Mario (qui a du être fait avec un assembleur sûrement, mais ça change quoi ?)
Je n'ai vraiment aucune idée ce que ça peut être...
Sinon pour le bug normalement c 'est pas celui là qui apparaît (celui du screen). Il est vraiment beaucoup plus rare. Je crois que tu as juste oublié de spécifier le nombre de mine et la taille du terrain^^