This commit is contained in:
Gnieark 2016-06-19 20:46:37 +02:00
parent 2892d62519
commit f9913ae183

View File

@ -137,9 +137,11 @@ switch ($_POST['act']){
$boatsPlayer = json_decode( html_entity_decode($anwserPlayer)); ;
if(!$boatsPlayer){
echo $currentBot['name']." a fait une réponse non conforme, il perd.".$anwserPlayer; if(!isset($anwserPlayerJson['boats'])){
echo $fullLogs.$currentBot['name']." a fait une réponse non conforme, il perd.".$anwserPlayer;
if($player==1){ if($player==1){
save_battle('Battleship',$bot1['name'],$bot2['name'],2); save_battle('Battleship',$bot1['name'],$bot2['name'],2);
}else{ }else{
@ -148,6 +150,8 @@ switch ($_POST['act']){
die; die;
} }
$boatsPlayer = $anwserPlayerJson['boats']
//init grid //init grid
for($y = 0; $y < $postValues['gridHeight']; $y++){ for($y = 0; $y < $postValues['gridHeight']; $y++){
for($x = 0; $x < $postValues['gridWidth']; $x++){ for($x = 0; $x < $postValues['gridWidth']; $x++){
@ -209,7 +213,7 @@ switch ($_POST['act']){
} }
foreach($nbBoatsIwant as $nb){ foreach($nbBoatsIwant as $nb){
if($nb <> 0){ if($nb <> 0){
echo $currentBot['name']." n'a pas placé le bon nombre de bateaux. Il perd."; echo $fullLogs.$currentBot['name']." n'a pas placé le bon nombre de bateaux. Il perd.";
if($player==1){ if($player==1){
save_battle('Battleship',$bot1['name'],$bot2['name'],2); save_battle('Battleship',$bot1['name'],$bot2['name'],2);
}else{ }else{