.
This commit is contained in:
parent
4c29f1a574
commit
eeb7ab9713
|
@ -137,7 +137,7 @@ switch ($_POST['act']){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
if(!isset($anwserPlayerJson['responseArr']['boats'])){
|
if(!isset($anwserPlayerJson['responseArr']['boats'])){
|
||||||
|
|
||||||
|
@ -256,8 +256,10 @@ switch ($_POST['act']){
|
||||||
|
|
||||||
$botParamsToSend=array(
|
$botParamsToSend=array(
|
||||||
'game' => 'Battleship',
|
'game' => 'Battleship',
|
||||||
'match_id' => $_SESSION['matchId']."-".$currentPlayer,
|
'game-id' => $_SESSION['matchId']."-".$currentPlayer,
|
||||||
'act' => 'fight',
|
'action' => 'play-turn',
|
||||||
|
'player-index' => $currentPlayer - 1,
|
||||||
|
'board' => array(
|
||||||
'opponent' => $opponentName,
|
'opponent' => $opponentName,
|
||||||
'width' => $_SESSION['width'],
|
'width' => $_SESSION['width'],
|
||||||
'height' => $_SESSION['height'],
|
'height' => $_SESSION['height'],
|
||||||
|
@ -267,17 +269,24 @@ switch ($_POST['act']){
|
||||||
'ship4' => $_SESSION['ship4'],
|
'ship4' => $_SESSION['ship4'],
|
||||||
'ship5' => $_SESSION['ship5'],
|
'ship5' => $_SESSION['ship5'],
|
||||||
'ship6' => $_SESSION['ship6'],
|
'ship6' => $_SESSION['ship6'],
|
||||||
'your_strikes' => json_encode($_SESSION['strikes'][$currentPlayer]),
|
'your_strikes' => $_SESSION['strikes'][$currentPlayer],
|
||||||
'his_strikes' => json_encode($_SESSION['strikes'][$opponent])
|
'his_strikes' => $_SESSION['strikes'][$opponent]
|
||||||
|
|
||||||
);
|
);
|
||||||
$anwserPlayer=get_IA_Response($currentBot['url'],$botParamsToSend);
|
$anwserPlayerJson=get_IA_Response($currentBot['url'],$botParamsToSend);
|
||||||
|
if($fullLogs){
|
||||||
|
$fullLogs='Arena send to '.$currentBot['name'].'<em>'.htmlentities($anwserPlayerJson['messageSend']).'</em><br/>
|
||||||
|
HTTP status: <em>'.htmlentities($anwserPlayerJson['httpStatus']).'</em><br/>
|
||||||
|
Bot anwser: <em>'.htmlentities($anwserPlayerJson['response']).'</em><br/>';
|
||||||
|
}else{
|
||||||
|
$fullLogs="";
|
||||||
|
}
|
||||||
|
|
||||||
if(!preg_match('/^[0-9]+,[0-9]+$/',$anwserPlayer)){
|
|
||||||
|
if(!preg_match('/^[0-9]+,[0-9]+$/',$anwserPlayer['responseArr']['play'])){
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'target' => '',
|
'target' => '',
|
||||||
'log' => $currentBot['name']." a fait une réponse non conforme, il perd.".$anwserPlayer
|
'log' => $fullLogs.$currentBot['name']." a fait une réponse non conforme, il perd."));
|
||||||
));
|
|
||||||
save_battle('Battleship',$_SESSION['bot1']['name'],$_SESSION['bot2']['name'],$opponent);
|
save_battle('Battleship',$_SESSION['bot1']['name'],$_SESSION['bot2']['name'],$opponent);
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user