Created
May 10, 2015 04:17
-
-
Save leighghunt/9dfece5f50f43b3b07ab to your computer and use it in GitHub Desktop.
matt.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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