log init message

This commit is contained in:
Gnieark 2016-07-01 07:43:20 +02:00
parent 24373eb0dd
commit 71e6f526c0
2 changed files with 25 additions and 4 deletions

View File

@ -43,9 +43,12 @@ switch ($_POST['act']){
error (500,"missing bots"); error (500,"missing bots");
} }
$logs="";
//send init message //send init message
$gameId = get_unique_id(); $gameId = get_unique_id();
$responses = array(); $responses = array();
for ($botCount = 0; $botCount < count($bots); $botCount ++){ for ($botCount = 0; $botCount < count($bots); $botCount ++){
$messageArr = array( $messageArr = array(
'game-id' => "".$gameId, 'game-id' => "".$gameId,
@ -56,10 +59,26 @@ switch ($_POST['act']){
'player-index' => $botCount 'player-index' => $botCount
); );
$responses[] = get_IA_Response($bots[$botCount]->getURL(),$messageArr); $resp = get_IA_Response($bots[$botCount]->getURL(),$messageArr);
if($_POST['fullLogs'] == "true"){
$logs.='Arena send to '.$bots[$botCount]->getName().'<em>'.htmlentities($resp['messageSend']).'</em><br/>
HTTP status: <em>'.htmlentities($resp['httpStatus']).'</em><br/>
Bot anwser: <em>'.htmlentities($resp['response']).'</em><br/>';
}else{
$logs.="Init message send to ".$bots[$botCount]->getName()."<br/>";
} }
print_r($responses);
}
/*
if($_POST['fullLogs'] == "true"){
$fullLogs='Arena send to '.$playerName.'<em>'.htmlentities($tempPlayer['messageSend']).'</em><br/>
HTTP status: <em>'.htmlentities($tempPlayer['httpStatus']).'</em><br/>
Bot anwser: <em>'.htmlentities($tempPlayer['response']).'</em><br/>';
}else{
$fullLogs='';
}
*/
die; die;
break; break;
default: default:

View File

@ -13,7 +13,9 @@ class TronPlayer{
public function getURL(){ public function getURL(){
return $this->url; return $this->url;
} }
public function getName(){
return $this->name;
]
private function set_direction($newDir){ private function set_direction($newDir){
//can't be the opposite of the previous direction //can't be the opposite of the previous direction
if( if(