So my switch works at first however when it’s supposed to switch the second time and start going north again it starts one step too soon. No matter how much I look at my code I can’t seem to figure it out. Can anyone else see what I’ve done wrong?
// Increment steps and sideSteps as appropriate, taking into account the special rules.
steps++;
if(steps%(SWITCH+1) === 0){
s =- s;
}
if(s == -1){
sideSteps--;
}if(s == 1){
sideSteps++;
}
if(sideSteps - 1 < 1){
sideSteps = 10;
}else if(sideSteps + 1 > SLIDE){
sideSteps = 1;
}
if(steps%(SKIP+1) === 0 && s == -1){
sideSteps--;
}if(steps%(SKIP+1) === 0 && s == 1){
sideSteps++;
}
this.say(sideSteps);
this.say(steps);
}