Lost Viking! Please Help

My Code:

SLIDE = 10
SWITCH = 7
SKIP = 11

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:

# Take the next step:
hero.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH)
if steps % SWITCH:
    hero.moveXY(sideSteps * X_PACE_LENGTH, steps * Y_PACE_LENGTH)
if sideSteps % SWITCH:
    hero.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH)

Welcome to the forum @Cedar ! :partying_face: This is a friendly place where you can ask help on levels, report bugs, or just chat with other coders! Don’t forget to read the guidelines if you haven’t yet. Have a great time!

Would you please format your code using this button:

1 Like
SLIDE = 10
SWITCH = 7
SKIP = 11

# 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:

Take the next step:

hero.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH)
if steps % SWITCH:
hero.moveXY(sideSteps * X_PACE_LENGTH, steps * Y_PACE_LENGTH)
if sideSteps % SWITCH:
hero.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH)
````Preformatted text`

SLIDE = 10
SWITCH = 7
SKIP = 11

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:

# Take the next step:
hero.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH)
if steps % SWITCH:
    hero.moveXY(sideSteps * X_PACE_LENGTH, steps * Y_PACE_LENGTH)
if sideSteps % SWITCH:
    hero.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH)
1 Like

You need to add a s = 1 at the front.

Fix you code like this :

if steps % SWITCH == 0:
        s = -s
    if steps % SKIP == 0:
        sideSteps += s
    sideSteps += s
    if sideSteps < 1:
        sideSteps = SLIDE - 1
    if sideSteps > SLIDE:
        sideSteps = 1
    steps += 1

maybe it will help you.

it doesn’t help.(20 characters)