Simon says game from reved

golfnut

Member
Hi, I have made a kit from reved, a simon says game...
I have an impatient daughter wanting to give it a try!!!.
I attempted a download of the simon says.bas from the samples folder of the picaxe suite and the sytax checker informs me there is a bug in the code..

It says this.. and wont let me program the board..


loop: if pin7 = 1 then pushed0
^

Error: Loop without Do

It is from this section of the code..

' *** Section 4 *****************************************
' *** This section detects the players reply sequence ***
' *******************************************************

' now the user responds
' reset the players position to 1
playerstep = 1

gameloop:
' if playerstep is greater than topstep then all done
if playerstep > topstep then success

' get the correct key value is supposed to hit
' from the EEPROM memory
read playerstep,value

' now wait for switch to be pressed
loop: if pin7 = 1 then pushed0
if pin0 = 1 then pushed1
if pin1 = 1 then pushed2
if pin6 = 1 then pushed3
goto loop

' switch pressed so check it is the correct one
' if it is make a beep sound and then continue
' else fail the game
pushed0:
if value <> 0 then fail
let playerstep = playerstep + 1
gosub beep
goto gameloop

pushed1:
if value <> 1 then fail
let playerstep = playerstep + 1
gosub beep
goto gameloop

pushed2:
if value <> 2 then fail
let playerstep = playerstep + 1
gosub beep
goto gameloop

pushed3:
if value <> 3 then fail
let playerstep = playerstep + 1
gosub beep
goto gameloop

' *** Failed so make noise and jump back to start ***
' failed so make failed noise, switch off all LEDs
' and go back to start
fail:
let pins = %0000000 ' all LEDs off
sound 7,(80,100) ' make a noise
sound 7,(50,100)
goto init ' back to start
Any takers on a fix . The daughter frankly has already wrote this off, nice one dad...not
 

hippy

Ex-Staff (retired)
Simply rename all occurances of "loop" to "mainloop" and it should work.

"loop" used to be a name anyone could use in their programs but later versions of the compilers take that for themselves as a 'reserved word' ( for the DO-LOOP commands ). The programs are being updated to work with the latest compilers.

Hopefully your daughter will gain her interest again once she sees the LED's flashing, happiness will again reign, Dad will gain his respect back.
 

golfnut

Member
All leds are on?

Hi called loop --- loopy, and all syntax ok.

When I program, do I use 18m or 18X part in programmer.

When code runs on game all leds are on from reset is this right ?

Golfnut..
 
Top