Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

onqun

macrumors regular
Original poster
Oct 13, 2006
100
1
I am so confused that my creature does not stop when it is on the switch. I am sorry for this post I got frustrated.
 

Attachments

  • 17BF2BDA-47BD-4875-BB38-655C715CBFCE.png
    17BF2BDA-47BD-4875-BB38-655C715CBFCE.png
    4.3 MB · Views: 2,603

09872738

Cancelled
Feb 12, 2005
1,270
2,125
Not sure where it exactly does that and what behaviour you expect. Could you provide more information?

My code is a bit different than yours, and since I'm on the beta the code won't run any more, so I cannot try your code.

Anyway: Is it possible your issue is because of using the loop:

while !isOnOpenSwitch ?

This causes Byte to try wo walk forever. I therefore used a for (for i in 1 ... 14) loop instead, so Byte stops once the's walked the scene
 
Last edited:

09872738

Cancelled
Feb 12, 2005
1,270
2,125
Yes probably but why? It is on the open switch :(
Because it never leaves the inner loop it seems: once in the final row, after turnLeft, its stuck in the inner loop (while isBlockedLeft || isBlockedRight) because it is blocked to the right, so it never leaves the loop and therefore moves forward infinitely...

So I believe I have to correct my first post: the issue is not necessarily caused by the outer loop, but rather in the inner loop, never leaving it once in the final row
 
Last edited:

BootLoxes

macrumors 6502a
Apr 15, 2019
749
897
Here is what I used when I finished the challenge yesterday. Though my code isnt as simple as yours. I want to try and find a simpler way later on when I learn more about programming
 

Attachments

  • ABF26809-6D13-42C8-A3AB-D3F3DAFE9364.jpeg
    ABF26809-6D13-42C8-A3AB-D3F3DAFE9364.jpeg
    1,002.1 KB · Views: 1,384
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.