Code: Select all
10 input"1 or 2";a
20 if a=1 then gosub 200
30 if a=2 then gosub 210
40 print"well done!"
50 goto 10
200 print"you chose left"
205 return
210 print"you chose right"
215 return
I hope what I'm asking is clear!! Thanks in advance.
Moderator: Moderators
Code: Select all
10 input"1 or 2";a
20 if a=1 then gosub 200
30 if a=2 then gosub 210
40 print"well done!"
50 goto 10
200 print"you chose left"
205 return
210 print"you chose right"
215 return
Code: Select all
10 GOSUB 100
20 IFA$="1"THENPRINT"YOU CHOSE LEFT"
30 IFA$="2"THENPRINT"YOU CHOSE RIGHT"
40 PRINT"WELL DONE!"
50 GOTO 10
100 PRINT "1 OR 2?"
110 GETA$:IFA$="1"ORA$="2"THENRETURN
120 GOTO 110
Code: Select all
10 INPUT "1 OR 2"; A
20 IF A=1 THEN GOTO 200
30 IF A=2 THEN GOTO 210
40 PRINT "YOU CHOSE NEITHER LEFT NOR RIGHT!"
50 GOTO 10
60 PRINT "WELL DONE!"
70 GOTO 10
200 PRINT "YOU CHOSE LEFT"
205 GOTO 60
210 PRINT "YOU CHOSE RIGHT"
215 GOTO 60
Code: Select all
10 INPUT "1 OR 2"; A
20 ON A GOTO 200,210
30 PRINT "YOU CHOSE NEITHER LEFT NOR RIGHT!"
40 GOTO 10
60 PRINT "WELL DONE!"
70 GOTO 10
200 PRINT "YOU CHOSE LEFT"
205 GOTO 60
210 PRINT "YOU CHOSE RIGHT"
215 GOTO 60
Code: Select all
10 input "1 or 2";a$
15 a=val(a$):f=1
20 on a gosub 200,210
25 on f gosub 100,110
30 goto 10
100 print"you chose neither left nor right!":return
110 print"well done!":return
200 print"you chose left":f=f+1:return
210 print"you chose right":f=f+1:return
Code: Select all
10 input "1 or 2"a$
15 a=val(a$):f=1
20 on a gosub 200,210
25 if f gosub 100
30 print"well done!":return
40 goto 10
100 print"you chose neither left nor right!":return
200 print"you chose left":f=0:return
210 print"you chose right":f=0:return
... which gives you a '?SYNTAX ERROR'.Jeff-20 wrote:[...] 9 if you lose the semicolon in line 10.Code: Select all
10 input "1 or 2"a$
Right, okay, I think I follow this but I'm kinda with Jeff. I don't understand why F starts as 1 rather than the 0 which would be my assumption.Jeff-20 wrote:But if F=1 from the beginning as a fail flag, you could just say F=0 to change the fail flag and it would reset to one in the next prompt. That would 8 bytes. 9 if you lose the semicolon in line 10.
Code: Select all
10 input "1 or 2"a$ 15 a=val(a$):f=1 20 on a gosub 200,210 25 if f gosub 100 30 print"well done!":return 40 goto 10 100 print"you chose neither left nor right!":return 200 print"you chose left":f=0:return 210 print"you chose right":f=0:return
Oh, right. Stupid me. I haven't used INPUT in a long time. I thought it could be handled like PRINT.Mike wrote:... which gives you a '?SYNTAX ERROR'.Jeff-20 wrote:[...] 9 if you lose the semicolon in line 10.Code: Select all
10 input "1 or 2"a$
Code: Select all
5 tr=10:hu=10
10 print"you are followed by a troll. you have the following options:"
11 print"(1) fight the troll"
12 print"(2) flee into the forest"
13 h1=0:h2=0:input "your choice";a$
15 a=val(a$):f=1
20 on a gosub 200,210
25 on f gosub 100,110
30 hu=hu-h2:if hu>0 and tr>0 then 10
35 if tr>0 then print"the troll still stands up"
37 if hu>0 then print"you defeated the troll"
40 if tr<=0 and hu<=0 then print"both of you died!"
50 end
100 print"the troll hits you!":h2=int(rnd(1)*5)+1:return
110 tr=tr-h1:if tr>0 and rnd(1)>0.7 then 100
115 return
200 print"you hit the troll in its face!":f=f+1:h1=int(rnd(1)*5)+1:return
210 print"you escape into the bushes!":f=f+1:h1=0:return