re: AoC Day 24: Immune System Simulator 20XX VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I've only done the parsing so far but it warrants a look all on its own. Reading the description I feel fully vindicated in my advocacy of parser c...
 

I got it in the end. I missed the sentence "If it cannot deal any defending groups damage, it does not choose a target". A simple extra clause in the target selection:

if (defendingGroup == null) ...

became

if (defendingGroup == null || defendingGroup.damageFrom(attackingGroup.unit.attack) == 0) ...
code of conduct - report abuse