Lost Viking Help

Well, I was trying to do the Lost Viking Level, but

# 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 = 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:
    xpos = steps * X_PACE_LENGTH
    ypos = sideSteps * Y_PACE_LENGTH
    # Take the next step:
    self.moveXY(xpos, ypos)
    # Increment steps and sideSteps as appropriate, taking into account the special rules.
    if steps % SWITCH == 0:
         x *= -1
    
    if steps % SKIP == 0:
        x *= 2
    
    if steps - 1 % SKIP == 0 and steps != 1:
        x /= 2
    
    sideSteps += x
    
    if sideSteps > SLIDE:
        sideSteps = 1
    elif sideSteps < 1:
        sideSteps = SLIDE

    steps += 1

It keeps returning the error:

Line 25: Must move to an {x: number, y: number} position.

I’ve never gotten this error before… can anyone help me?

You don’t initialize your x variable, so it’s undefined, and when you do sideSteps += x, sideSteps becomes NaN, and then you get that error, since you have an {x: NaN, y: number} position.

What did you want x to start as?

Oh, I see! I wanted to start x at 1, and now it works. Thanks!