From 858dde7c4c55acce00ecd66f35fb2d7f5642ca79 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Tue, 29 Nov 2016 19:13:09 +0100 Subject: [PATCH] fix bug --- src/arenas/tron/TronGame.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/arenas/tron/TronGame.php b/src/arenas/tron/TronGame.php index a7b8ecc..217298a 100755 --- a/src/arenas/tron/TronGame.php +++ b/src/arenas/tron/TronGame.php @@ -164,6 +164,8 @@ class TronGame } + + $lastLoosers = array(); $aliveBots = $this->getAliveBots(); //pour tous les bots encore vivants, on teste si deux d'entre eux ne cibleraient pas la même case foreach ($aliveBots as $bot1){ @@ -172,11 +174,15 @@ class TronGame if($bot1->trail->last()->addDirection($bot1->nextDir) == $bot2->trail->last()->addDirection($bot2->nextDir)){ //he loose $scoreObj-> addLoser($bot1); - $bot1->loose(); + $lastLoosers[] = $bot1; + //$bot1->loose(); break; } } } + foreach($lastLoosers as $bot){ + $bot->loose(); + } //ok, faire grossir les bots qui restent foreach($this->getAliveBots() as $bot){