   damage: (i, amt) ->
     prev = this.units[i]
     this.units[i] -= amt
-    this.log.push([i, prev ])
+    this.logIndex.push(i)
+    this.logValues.push(prev)
 
   undo: ->
-    [i, val] = this.log.pop()
-    this.units[i] = val
+    this.units[this.logIndex.pop()] = this.logValues.pop()
 
 class ProbabilityAggregator
   constructor: (units) ->

    else
      agg.addResults(state.units, probability)
  explore(0, 1)
  return agg
    this.myIndex = enemyUnits.length # Index of first player unit
    for u in myUnits
      this.units.push u
    this.logIndex = []
    this.logValues = []

  each: (includeFriendly, callback) ->
    len = (if includeFriendly then this.units.length else this.myIndex)
