I’m trying to get onto the Zig Zag and Zoom in the Sarven Desert, but every time I try to get on, it says that there was an infinite loop detected.

# Infinite loop for "Zig Zag and Zoom?"

there should be an option for you to click “comment out my code” or something like that. Just click it and then repair the infinite loop.

It puts in a return, but then that messes up my code and makes my hero not do anything, causing him to be killed.

There must be a problem with your code. Please copy it from the game and post it here using the </> button or a screen shot of it so we can help you. Thanks.

Okay. Here you go.

return #Commented out to stop infinite loop.

hero.findNearestEnemy() #Commented out to stop infinite loop.

# Escape from Death Valley!

# Move by with a zigzag pattern using real modulo functions.

# This function returns a value from 0 to 15:

def mod15(n):

while n >= 15:

n -= 15

return n

# This function should return a value from 0 to 9:

def mod9(n):

# While n is greater or equal to 9, subtract 9 from n:

while n > 9 or n == 9:

```
9 - n
return n
```

Sorry, I did something wrong while copying it. Here is the real one.

return #Commented out to stop infinite loop.

# Escape from Death Valley!

# Move by with a zigzag pattern using real modulo functions.

# This function returns a value from 0 to 15:

def mod15(n):

while n >= 15:

n -= 15

return n

# This function should return a value from 0 to 9:

def mod9(n):

# While n is greater or equal to 9, subtract 9 from n:

while n > 9 or n == 9:

```
9 - n
return n
```

# Don’t change the following code:

while True:

time = hero.time

if time < 30:

y = 10 + 3 * mod15(time)

else:

y = 10 + 3 * mod9(time)

x = 10 + time

hero.moveXY(x, y)

I broke out of my infinite loop, but I am still having trouble. Please help me! Here is My code now.

def mod15(n):

while n >= 15:

n -= 15

return n

# This function should return a value from 0 to 9:

def mod9(n):

# While n is greater or equal to 9, subtract 9 from n:

while n >= 9:

```
n -= 9
return n
```

# Don’t change the following code:

while True:

time = hero.time

if time < 30:

y = 10 + 3 * mod15(time)

else:

y = 10 + 3 * mod9(time)

x = 10 + time

hero.moveXY(x, y)

def mod15(n):

while n >= 15:

n -= 15

return n

# This function should return a value from 0 to 9:

def mod9(n):

# While n is greater or equal to 9, subtract 9 from n:

while n >= 9:

n = n - 9

return n

# Don’t change the following code:

while True:

time = hero.time

if time < 30:

y = 10 + 3 * mod15(time)

else:

y = 10 + 3 * mod9(time)

x = 10 + time

hero.moveXY(x, y)

```
def mod15(n):
while n >= 15:
n -= 15
return n
# This function should return a value from 0 to 9:
def mod9(n):
# While n is greater or equal to 9, subtract 9 from n:
while n >= 9:
n = n - 9
return n
# Don't change the following code:
while True:
time = hero.time
if time < 30:
y = 10 + 3 * mod15(time)
else:
y = 10 + 3 * mod9(time)
x = 10 + time
hero.moveXY(x, y)
```

You have a computational format problem. Compare the code for function mod15 to the code for function mod9. mod15 is correct, mod9 is not.

Also, did you change the code below the line where it says,

```
# Don't change the following code:
```

The reason I ask is because the computation in the else conditional,

```
y = 10 + 3 * mod9(time)
```

should be:

```
y = 20 + 3 * mod9(time)
```

thank you for helping me out. it worked

Nice. Why bother with loops, conditions, variables, and functions when you can get away with just writing two simple lines of code. LOL.

They should make the arrows deal 9001 dmg (like the plasma balls)

How much health do you have ???!!!???!!!???

I got 1shot KOed

I cheated. Don’t be like me. I’m a bad child.