getStatus() === false){
unset($bots[$botCount]);
}else{
$botCount++;
}
}
$players = $botCount;
if ($botCount < 2){
error (500,"missing bots");
}
$logs="";
//send init message
$gameId = get_unique_id();
$responses = array();
for ($botCount = 0; $botCount < count($bots); $botCount ++){
$messageArr = array(
'game-id' => "".$gameId,
'action' => 'init',
'game' => 'tron',
'board' => '',
'players' => $players,
'player-index' => $botCount
);
$resp = get_IA_Response($bots[$botCount]->getURL(),$messageArr);
if($_POST['fullLogs'] == "true"){
$logs.='Arena send to '.$bots[$botCount]->getName().''.htmlentities($resp['messageSend']).'
HTTP status: '.htmlentities($resp['httpStatus']).'
Bot anwser: '.htmlentities($resp['response']).'
';
}else{
$logs.="Init message send to ".$bots[$botCount]->getName()."
";
}
}
return json_encode(array(
'status' => 'OK',
'logs' => $logs
));
die;
break;
default:
break;
}