Permalink
Browse files

Added a transaction guard to prevent ties by two ants simultaneously …

…killing each other

Signed-off-by: Richard Minerich <richard.minerich@gmail.com>
  • Loading branch information...
Rickasaurus committed Jun 4, 2012
1 parent c898556 commit e21f8f25060f35196351b84153a433daa518c01d
Showing with 1 addition and 1 deletion.
  1. +1 −1 AntsEverywhereLib/World.fs
@@ -123,7 +123,7 @@ let getWorldChangeTransactions actions =
[ target.WorldCell.Id, (fun oldtarget -> { oldtarget with Food = oldtarget.Food + foodToDrop });
source.Id, (fun oldcell -> { source with Ant = Some <| ant.UpdateFood(ant.FoodCarried - foodToDrop) }) ]
| DropPheromone (target, quantity) -> yield buildDependentTransaction [] [ target.WorldCell.Id, dropPheromonesInTargetCell ant.Color quantity ]
- | Attack (target) -> yield buildDependentTransaction [] [ target.WorldCell.Id, woundAntInTargetCell ]
+ | Attack (target) -> yield buildDependentTransaction [ source; target.WorldCell ] [ target.WorldCell.Id, woundAntInTargetCell ]
}

0 comments on commit e21f8f2

Please sign in to comment.