Page 1 of 2

Programme en ti basic

PostPosted: 07 Oct 2007, 17:56
by Tiboo
bonjour tout le monde !
voila je suis en seconde, j'ai une ti 83+ et depuis une semaine je me suis mis a programmer en basic
après avoir fait un jeu de ski avec un copain je me suis attaqué a un jeu style d'éboulement mais je ne comprend pas les problemes qu'il a a marcher
ma ti m'affiche une erreur de domaine alors que j'ai tout prévu pour qu'il n'y en ait pas ...
Enfin bref le programme en lui même sera plus explicite

Code: Select all
clrhome
1-X:1-B
1-E:1-F
1-Z:1-W
1-G:1-C
randInt(1,16)-D
randInt(1,16)-N
N#D
Goto 0
Lbl 5
1-C
Goto 55
Lbl 1
1-G
Goto 11
Lbl 55
randInt(1,16)-D
Goto 0
Lbl 11
randInt(1,16)-N
N#D
Lbl 0
Repeat K=105
Output(E,F," "
Output(C,D,"="
C-E:D-F
C+1-C
If C=2
Then
Output(Z,W," "
Output(G,N,"*"
G-Z:N-W
G+1-G
End
Output(8,B," "
Output(8,X,"+"
X-B
getkey-K
If K=24:X-1-X
If K=26:X+1-X
If X=17:16-X
If X=0:1-X
If C=9
Goto 5
If G=9
Goto 1
If C=8 and D=X
Goto 8
If G=8 and N=X
Goto 8
End
Lbl 8


merci d'avance
(l'erreur domaine vient du "=" G,N)

Re: Programme en ti basic

PostPosted: 07 Oct 2007, 18:49
by tama
1.bienvenue :)
2.
N#D


# c'est quoi ?

3.Arg ! des goto x___x essaie de les enlever

Re: Programme en ti basic

PostPosted: 07 Oct 2007, 20:02
by Tiboo
#=différent ^^ ya pas le symbole sur l'ordi c'est pour que le deuxieme truc qui tombe soit pas au meme endroit que le premier mais ca ne marche pas
pour les goto je vois pas bien comment faire autrement
je pourrais mettre des conditions a l'intérieur de la boucle mais ca ferait que rallonger

Re: Programme en ti basic

PostPosted: 07 Oct 2007, 22:15
by Yak
oui les gotos sont tes enemis...
Il y a toujours des solutions : le For et le While sont eux tes alliés.

Re: Programme en ti basic

PostPosted: 08 Oct 2007, 12:41
by ProgVal
Voilà, je suis pas un pro du z80, mais voici tout de même une petite correction et un éclaircissement du code.
Code: Select all
clrhome
1-X
1-B
1-E
1-F
1-Z
1-W
1-G
1-C
randInt(1,16)-D
randInt(1,16)-N
if N#D
Goto 0
Lbl 5
1-C
Goto 55
Lbl 1
1-G
Goto 11
Lbl 55
randInt(1,16)-D
Goto 0
Lbl 11
randInt(1,16)-N
N#D
Lbl 0
Repeat K=105
Output(E,F," ")
Output(C,D,"=")
C-E:D-F
C+1-C
If C=2
  Then
  Output(Z,W," ")
  Output(G,N,"*")
  G-Z:N-W
  G+1-G
  End
  Output(8,B," ")
  Output(8,X,"+")
  X-B
  getkey-K
  If K=24:
    X-1-X
  If K=26
    X+1-X
  If X=17
   16-X
  If X=0
    1-X
  If C=9
    Goto 5
  If G=9
    Goto 1
  If C=8 and D=X
    stop
  If G=8 and N=X
    stop
End

Re: Programme en ti basic

PostPosted: 08 Oct 2007, 16:31
by Adriweb
Voici un autre code, où ya pas d'erreur :

Code: Select all
ClrHome
1X:1-B
1-E:1-F
1-Z:1-W
1-G:1-C
randInt(1,16-D
randInt(1,16-N
If N#D
Goto 0
Lbl 5
1-C
Goto 55
Lbl 1
1-G
Goto 11
Lbl 55
randInt(1,16-D
Goto 0
Lbl 11
randInt(1,16-N
If N#D
Lbl 0
Repeat K=105
If E=8:8-E
If C=8:8-C
Output(E,F,"
Output(C,D,"=
C-E:D-F
C+1-C
If C=2
Then
If Z=8:8-Z
If G=8:8-G
Output(Z,W,"
Output(G,N,"*
G-Z:N-W
G+1-G
End
Output(8,B,"
Output(8,X,"+
X-B
getKey-K
If K=24:X-1-X
If K=26:X+1-X
If X=17:16-X
If not(0:1-X
If C=9
Goto 5
If G=9
Goto 1
If C=8 and D=X
Goto 8
If G=8 and N=X
Goto 8
End
Lbl 8
ClrHome

Re: Programme en ti basic

PostPosted: 08 Oct 2007, 17:30
by Yak
Mais que c'est crade tous ces gotos... Vous me decevez.

Re: Programme en ti basic

PostPosted: 08 Oct 2007, 18:32
by tama
arg c'est clair...bon vais me pencher sur ça...pondrais du code après manger ^^

Re: Programme en ti basic

PostPosted: 08 Oct 2007, 19:00
by tama
euh y a un truc de bizarre :

Code: Select all
N#D
Lbl 0


?

Re: Programme en ti basic

PostPosted: 09 Oct 2007, 19:29
by Tiboo
merci à tous le programme marche et je suis en train d'essayer de rajouter des =

en fait ca s'interprète plutot comme ca
randInt(1,16)-N
N#D

je veux que le chiffre que la calculette choisit soit différent du premier

il y a juste deux choses que je comprend pas c'est ca:
If Z=8:8-Z
If G=8:8-G
et ca
If not(0:1-X