Is it that I am not allowed to write functions in this level or I am not writing or defining them correctly?
Source 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!
var SLIDE = 10;
var SWITCH = 7;
var SKIP = 11;
// How many sideSteps north of the Red X you've taken.
var sideSteps = 1;
// How many steps east of the Red X you've taken.
var steps = 1;
// Multiply this with steps to determine your X coordinate. DON'T CHANGE THIS!
var X_PACE_LENGTH = 4;
// Multiply this with sideSteps to determine your Y coordinate. DON'T CHANGE THIS!
var Y_PACE_LENGTH = 6;
var modSWITCH = (steps - 1) % SWITCH;
var modSKIP = (steps - 1) % SKIP;
var normal = function () {
this.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH);
steps++;
sideSteps++;
};
var Switch = function () {
sideSteps--;
this.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH);
steps++;
};
var Skip = function () {
sideSteps -= 2;
this.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH);
steps++;
};
var Slide = function () {
if (sideSteps >= 10) {
sideSteps = 1;
this.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH);
steps++;
} else if (sideSteps <= 1) {
sideSteps = 10;
this.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH); // error occurs here
steps++;
}
};
// The maze is 35 steps along the X axis.
while(steps <= 35) {
if (modSWITCH === 0 && this.pos.x > 6) {
Switch();
} else if (modSKIP === 0 && this.pos.x > 6) {
Skip();
} else {
Slide();
normal();
}
}