Issue detecting breaches

I’ve read through this (Stuck attempting to advance my code!) and have tried to implement what I thought would be a simple working version of breach detection. However, only some of the breaches are actually printed out to the console and I’m unsure why.

Here is my code in algocore.py

elif stateType == 1:
    try:
        self.detect_breaches(state["events"]["breach"][0])
    except:
        pass
    continue

And in algo_strategy.py

def detect_breaches(self,breach):
gamelib.debug_write(“TEST BREACHES TEST”,breach)

Any help that could be given resolving this issue would be greatly appreciated.

when you do this: state[“events”][“breach”][0], it gives you only one breach when there could be much more potential breaches in the list: state[“events”][“breach”].
you should go over every breach in this list.

Thanks, this worked perfectly! I can’t believe I didn’t see/think of this.

1 Like