Created
May 10, 2015 04:14
-
-
Save leighghunt/de4a75989bf6f0552948 to your computer and use it in GitHub Desktop.
viking.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
# 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 | |
sideStepsIncrement = 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: | |
# Take the next step: | |
self.moveXY(steps * X_PACE_LENGTH, sideSteps * Y_PACE_LENGTH) | |
# Increment steps and sideSteps as appropriate, taking into account the special rules. | |
# Switching between sidedteps North and South | |
if steps%SWITCH==0: | |
self.say("Switch!") | |
sideStepsIncrement *= -1 | |
sideSteps += sideStepsIncrement | |
# Skip - two side steps instead of just one | |
if steps%SKIP==0: | |
self.say("Skip!") | |
sideSteps += sideStepsIncrement | |
# Slide - stay above bottom and below top. | |
if sideSteps>SLIDE: | |
self.say("Slide Down!") | |
sideSteps=1 | |
if sideSteps<1: | |
self.say("Slide Up!") | |
sideSteps = SLIDE | |
# Move along East... | |
steps += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment