return lap info
This commit is contained in:
parent
a6eae7ce1c
commit
0d2ff7d563
|
@ -1 +1 @@
|
||||||
1507
|
1512
|
|
@ -54,7 +54,18 @@ switch ($_POST['act']){
|
||||||
echo '{"status":"error"}';
|
echo '{"status":"error"}';
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
$game->new_lap();
|
$lap = $game->new_lap();
|
||||||
|
if($game->get_continue()){
|
||||||
|
$continue = 1;
|
||||||
|
}else{
|
||||||
|
$continue = 0;
|
||||||
|
}
|
||||||
|
echo json_encode(array(
|
||||||
|
'gameId' => $game->getGameId(),
|
||||||
|
'continue' => $continue,
|
||||||
|
'lap' => $lap
|
||||||
|
));
|
||||||
|
die;
|
||||||
/*
|
/*
|
||||||
//make the board array
|
//make the board array
|
||||||
for ($botCount = 0; $botCount < count($bots); $botCount ++){
|
for ($botCount = 0; $botCount < count($bots); $botCount ++){
|
||||||
|
|
|
@ -169,6 +169,7 @@ class TronGame
|
||||||
if ($this->bots[$botCount]->getStatus()){
|
if ($this->bots[$botCount]->getStatus()){
|
||||||
//tester si sa réponse n'est pas sur une case déjà occupée.
|
//tester si sa réponse n'est pas sur une case déjà occupée.
|
||||||
$target = $this->bots[$botCount]->grow($responses[$botCount]['responseArr']['play']);
|
$target = $this->bots[$botCount]->grow($responses[$botCount]['responseArr']['play']);
|
||||||
|
$targetByBot[$botCount] = $target;
|
||||||
$x = $target[0];
|
$x = $target[0];
|
||||||
$y = $target[1];
|
$y = $target[1];
|
||||||
$hashTargetsList[$botCount] = $x * 1000 + $y; //wil be easyest to compare than if it was arrays
|
$hashTargetsList[$botCount] = $x * 1000 + $y; //wil be easyest to compare than if it was arrays
|
||||||
|
@ -202,20 +203,30 @@ class TronGame
|
||||||
|
|
||||||
|
|
||||||
if(count($loosers > 0)){
|
if(count($loosers > 0)){
|
||||||
|
|
||||||
//save_draw_bots
|
//save_draw_bots
|
||||||
save_draw_bots($loosers);
|
$this->save_draw_bots($loosers);
|
||||||
$winners = array();
|
$winners = array();
|
||||||
for ($botCount = 0; $botCount < $nbeBots; $botCount++){
|
for ($botCount = 0; $botCount < $nbeBots; $botCount++){
|
||||||
if ($this->bots[$botCount]->getStatus()){
|
if ($this->bots[$botCount]->getStatus()){
|
||||||
$winners[] = $this->bots[$botCount]->getId();
|
$winners[] = $this->bots[$botCount]->getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//sauver les relations winers loosers
|
||||||
|
$this->save_losers_winers($loosers,$winners);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generer un array en retour qui permettra de dessiner les modifications
|
||||||
//sauver les relations winers loosers
|
// sur la map
|
||||||
|
$arrRapport = array();
|
||||||
|
for ($botCount = 0; $botCount < $nbeBots; $botCount++){
|
||||||
|
if ($this->bots[$botCount]->getStatus()){
|
||||||
|
$arrRapport[$botCount] = $targetByBot[$botCount];
|
||||||
|
}else{
|
||||||
|
$arrRapport[$botCount] = "die";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arrRapport;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user