From 71e6f526c06184e81ba45c22b996584a880d3682 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Fri, 1 Jul 2016 07:43:20 +0200 Subject: [PATCH] log init message --- src/arenas/tron/act.php | 25 ++++++++++++++++++++++--- src/arenas/tron/functions.php | 4 +++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/arenas/tron/act.php b/src/arenas/tron/act.php index c1c8424..b3783cb 100644 --- a/src/arenas/tron/act.php +++ b/src/arenas/tron/act.php @@ -42,10 +42,13 @@ switch ($_POST['act']){ 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, @@ -56,10 +59,26 @@ switch ($_POST['act']){ '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().''.htmlentities($resp['messageSend']).'
+ HTTP status: '.htmlentities($resp['httpStatus']).'
+ Bot anwser: '.htmlentities($resp['response']).'
'; + }else{ + $logs.="Init message send to ".$bots[$botCount]->getName()."
"; + } + } - print_r($responses); - + /* + if($_POST['fullLogs'] == "true"){ + $fullLogs='Arena send to '.$playerName.''.htmlentities($tempPlayer['messageSend']).'
+ HTTP status: '.htmlentities($tempPlayer['httpStatus']).'
+ Bot anwser: '.htmlentities($tempPlayer['response']).'
'; + + }else{ + $fullLogs=''; + } + */ die; break; default: diff --git a/src/arenas/tron/functions.php b/src/arenas/tron/functions.php index ff1ba92..13cb484 100644 --- a/src/arenas/tron/functions.php +++ b/src/arenas/tron/functions.php @@ -13,7 +13,9 @@ class TronPlayer{ public function getURL(){ return $this->url; } - + public function getName(){ + return $this->name; + ] private function set_direction($newDir){ //can't be the opposite of the previous direction if(