Possible bug when reading through list

I had a bug where I would somehow build out of order of my list which was just a for loop and after failing to be able to find the issue I re-downloaded the starter-algo zip and implemented a simple for loop through a list in an algo that doesn’t spawn anything and I still got an implementation error. The for loop seems to skip positions or simple just end early without any reason. If anyone has had something like this and knows what’s going on it would help out a lot.


When comparing the outputs from the debug panel to the order of the list is shown to be printing out of order.

It is very possible I am just an incompetent coder so if that’s the case please let me know.

The output not being in order is a bug regarding the behavior of printing with gamelib.debug_write() and things not printing out in the correct order has been noticed before so I wouldn’t go by that.

A more definitive way to check regarding the order would be to output to a file what you are sending to debug_write(). Regardless of what the engine does, the order it loops through the list should be correct. You said you noticed this because it would build out of order. I’m not sure why it would build out of order, but I’ll look a bit more.

Edit:
I copied your code exactly and did not experience anything building out of order. I saw the same ordering problem regarding printing, but not with the actual building. Have you tried actually building with your example? It is my belief that the problem is likely with the logic in your main program for any building out of order. It would also explain simply not building certain things, if there was a condition or break, etc.

I will double check whether it is still building out of order with the changes I have made. I have changed a bit and have also been relying heavily on the debug panel outputs. The issue could be resolved.

This appears to be resolved.
As a note, in the future I would reccomend sharing code by

Copy pasting it and using the 
Code button that looks like this </>

Instead of sending a screenshot.

2 Likes