• Infinite loop when warlord&heal vs warlord&heal

Question related to mission The Warlords


So when I tried to run the check I encounter one of the check that requires the return to be false, I thought it's because my original code didn't take out the unit at the behind row when he died due to collateral from opposite's lancer.

Now when I try to test my code, my code got caught in a infinite loop due to near the end of battle I got only warlord and healers on both side in the end (warlord deal damage to warlord, then the damaged warlord got healed by heal, cancel out the damage it received earlier).

I think the question lies on who survived at the end of battle. Anyone got an answer for that? I included my code as the text file here. Thanks and apology in advance for the mess.