Hello, I’ve been stuck on Lost Viking for a while now, I can’t seem to find out what’s wrong with my code…
I’m also having an issue with the boundary i think, I have to do sideSteps <= 1 instead of sideSteps < 1 otherwise i’ll die much sooner.
Can someone give me a few hints on what i’m doing wrong ? (Please don’t give the full answer)
# You MUST click on the HELP button to see a detailed description of this level!
# The raven will tell you what to use for your maze parameters!
slide = 9
switch = 5
skip = 7
# Used to decide if we're going up or down
goNorth = True
# How many sideSteps north of the Red X you've taken.
sideSteps = 1
# How many steps east of the Red X you've taken.
steps = 1
# Multiply this with steps to determine your X coordinate. DON'T CHANGE THIS!
X_PACE_LENGTH = 4
# Multiply this with sideSteps to determine your Y coordinate. DON'T CHANGE THIS!
Y_PACE_LENGTH = 6
# The maze is 35 steps along the X axis.
while steps <= 35:
# Increment steps and sideSteps as appropriate, taking into account the special rules.
steps += 1
#Next sidesteps
if goNorth:
sideSteps += 1
else:
sideSteps -= 1
#SWITCH
if steps % switch == 0:
if goNorth:
hero.say("Going south now")
goNorth = False
else:
hero.say("Going north now")
goNorth = True
#SKIP
if steps % skip == 0:
hero.say("Double SideStep!")
if goNorth:
sideSteps += 1
else:
sideSteps -= 1
steps += 1
# SLIDE
if sideSteps > slide:
sideSteps = 1
elif sideSteps <= 1:
sideSteps = slide
#hero.say("Going for Steps #" + steps)
#hero.say("Going for sideSteps #" + sideSteps)
hero.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH)