Help with lost viking


#1

I cant seem to get it right this is my code

# 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
# How many sideSteps north of the Red X you've taken.
sideSteps = 5

# How many steps east of the Red X you've taken.
steps = 5

# 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:
    
    # Take the next step:
    hero.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH)
    
    # Increment steps and sideSteps as appropriate, taking into account the special rules.
    steps += 1

#2

I have a new code but the switch isnt working

# 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
# How many sideSteps north of the Red X you've taken.
sideSteps = 5


# How many steps east of the Red X you've taken.
steps = 5

# 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:
    
    # Take the next step:
    hero.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH)
    
    # Increment steps and sideSteps as appropriate, taking into account the special rules.switch += -2
    
    steps += 1
    sideSteps += -1    


#3

try looking at the hints


#4

what does it say is the problem


#5

it doesn’t i just wind up walking into a mine remember Slide=9 switch=5 skip=7


#6

What errors is it giving you. A screenshot would help


#7

i don’t have errors I’m just dieing


#8

Your code may be too long…


#9

It is hard to answer your question without giving away anything but there are two ways you can do this:

  1. Use the find hazard function in a loop

  2. If you need to move down add side but subtract sideStep, and if you need to move up, add side and add sideStep.

Lost Viking is basically a trial and error game. Keep on testing and improving your code!

Best of Luck!


#10

I only had to use trial and error moveXY to beat it


#11

Ok but the purpose of the level is to build up your skill, not go the easy way.