Skip to content

Instantly share code, notes, and snippets.

@leighghunt
Created May 10, 2015 04:17
Show Gist options
  • Save leighghunt/9dfece5f50f43b3b07ab to your computer and use it in GitHub Desktop.
Save leighghunt/9dfece5f50f43b3b07ab to your computer and use it in GitHub Desktop.
matt.py
// The maze is 35 steps along the X axis.
//take the values here from the raven
var slide=9;
//had to use switchh as switch is a keyword
var switchh=5;
var skip=7;
//do we move up of down, start off going up
var ymove = 1;
while(steps <= 35) {
// Take the next step:
this.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH);
// Increment steps and sideSteps as appropriate, taking into account the special rules.
//change to moving in the other direction (up or down)
if (steps % switchh === 0) {
ymove = ymove*-1;
}
sideSteps=sideSteps+ymove;
//double sideStep if on skip
if (steps % skip ===0) {
sideSteps=sideSteps+ymove;
}
//deal with the boundaries (slide)
if (sideSteps>slide) {
sideSteps = 1;
}
if (sideSteps<1) {
sideSteps = slide;
}
steps++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment