diff --git a/bofa/src/main/scala/bot/cortex/BugAI.scala b/bofa/src/main/scala/bot/cortex/BugAI.scala index 16f5db1..3af831b 100644 --- a/bofa/src/main/scala/bot/cortex/BugAI.scala +++ b/bofa/src/main/scala/bot/cortex/BugAI.scala @@ -4,6 +4,7 @@ import bot.environment.topology.Point import bot.environment.Board import bot.Game import bot.environment.topology.Grid +import bot.util.Log.dbg class BugAI extends Tactical { def evaluate(game: Game): Tactic = { @@ -12,14 +13,19 @@ class BugAI extends Tactical { val weightGrid = new Grid(board.width, board.height, 0: Int) - for ( bug <- board.bugs; point <- board.walkablePoints(bug.point) ) { - weightGrid(point).content += -1000 + board.bugs foreach { weightGrid(_) put -1000 } + + for ( bug <- board.bugs; point <- board.walkablePoints(bug.point) ) { + val field = weightGrid(point) + field put (field.content - 1000) } board.walkableDirs(game.bofaPoint) foreach { dir => tactic = tactic + {dir -> weightGrid(board.walk(game.bofaPoint)(dir)).content} } + dbg(s"$weightGrid") + tactic } } \ No newline at end of file