From 68caf7b55fa64ba2d43868161cd4dce940f11211 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:25:40 +0100 Subject: [PATCH 01/27] . --- src/arenas/Battleship/act.php | 23 +++++++++++++++++++++++ src/arenas/Battleship/functions.php | 11 +++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 0a69db6..c18a81f 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -60,6 +60,29 @@ switch ($_POST['act']){ //vars checked, lets init the initGame $_SESSION['matchId']=get_unique_id(); + + + + // get_IA_Response($iaUrl,$postParams) + //array à envoyer au bot 1 + + $bot1ParamsToSend=array( + 'game' => 'Battleship', + 'act' => 'init', + 'match_id' => $_SESSION['matchId']."-1", + 'opponent' => $bot2['name'], + 'width' => $postValues['gridWidth'], + 'height' => $postValues['height'], + 'ship1' => $postValues['ship1'], + 'ship2' => $postValues['ship2'] + 'ship3' => $postValues['ship3'] + 'ship4' => $postValues['ship4'] + 'ship5' => $postValues['ship5'] + 'ship6' => $postValues['ship6'] + + ); + + $anwserPlayer1 = get_IA_Response($bot1['url'],$bot1ParamsToSend); break; diff --git a/src/arenas/Battleship/functions.php b/src/arenas/Battleship/functions.php index f57cd56..e570ee1 100644 --- a/src/arenas/Battleship/functions.php +++ b/src/arenas/Battleship/functions.php @@ -41,4 +41,15 @@ function generate_numeric_select($start,$end,$selected,$name,$id){ } return $out.""; +} + +function get_IA_Response($iaUrl,$postParams){ + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $iaUrl); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + $output = curl_exec($ch); + curl_close($ch); + return htmlentities($output); } \ No newline at end of file From 18a378754598389b13b51a3617d192bcbf8e7093 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:33:33 +0100 Subject: [PATCH 02/27] debog communication --- html/StupidIABattleship.php | 2 ++ src/arenas/Battleship/act.php | 2 +- src/arenas/Battleship/js.js | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 html/StupidIABattleship.php diff --git a/html/StupidIABattleship.php b/html/StupidIABattleship.php new file mode 100644 index 0000000..25e4a71 --- /dev/null +++ b/html/StupidIABattleship.php @@ -0,0 +1,2 @@ + Date: Sat, 12 Dec 2015 10:34:45 +0100 Subject: [PATCH 03/27] fix PHP parse error --- src/arenas/Battleship/act.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 621e970..2519f84 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -54,7 +54,7 @@ switch ($_POST['act']){ } } if ((!$bot1Exists) OR (!$bot2Exists)){ - error (500,"missing parameter"; + error (500,"missing parameter"); } //vars checked, lets init the initGame From c1850f3713f9f94d059ff37b78efcb4c93a6632c Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:35:27 +0100 Subject: [PATCH 04/27] fix PHP parse error --- src/arenas/Battleship/act.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 2519f84..1184ccd 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -74,10 +74,10 @@ switch ($_POST['act']){ 'width' => $postValues['gridWidth'], 'height' => $postValues['height'], 'ship1' => $postValues['ship1'], - 'ship2' => $postValues['ship2'] - 'ship3' => $postValues['ship3'] - 'ship4' => $postValues['ship4'] - 'ship5' => $postValues['ship5'] + 'ship2' => $postValues['ship2'], + 'ship3' => $postValues['ship3'], + 'ship4' => $postValues['ship4'], + 'ship5' => $postValues['ship5'], 'ship6' => $postValues['ship6'] ); From 29e6ee4530a7ad408b5d5172e859a389c74bc53a Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:36:33 +0100 Subject: [PATCH 05/27] fix PHP parse error --- src/arenas/Battleship/act.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 1184ccd..91b8742 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -31,7 +31,7 @@ switch ($_POST['act']){ OR ($value > $p[2]) ) { - error(500,'wrong parameters'); + error(500,'wrong parameters 1'); die; } $postValues[$p[0]]=$value; From a3aa846bc17eb3c668c4a1d1bb6cfd71bf7909ad Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:37:57 +0100 Subject: [PATCH 06/27] fix PHP parse error --- src/arenas/Battleship/act.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 91b8742..88ab340 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -3,6 +3,7 @@ $bots=get_Bots_Array('Battleship'); switch ($_POST['act']){ case "initGame": + print_r($_POST); //verifier parametres POST $postParamsWanted=array( // key,min,max From f0405c615e135b52b492d89f36770ddfe11a2f50 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:39:00 +0100 Subject: [PATCH 07/27] fix PHP parse error --- src/arenas/Battleship/act.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 88ab340..844dd12 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -3,12 +3,9 @@ $bots=get_Bots_Array('Battleship'); switch ($_POST['act']){ case "initGame": - print_r($_POST); //verifier parametres POST $postParamsWanted=array( // key,min,max - array('bot1',1,999), - array('bot2',1,999), array('gridWidth',1,100), array('gridHeight',1,100), array('ship1',1,10), From 84b26ec926997f35431e59428a3d328ae2621b6d Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:41:35 +0100 Subject: [PATCH 08/27] debog --- src/arenas/Battleship/act.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 844dd12..0d4f886 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -29,7 +29,7 @@ switch ($_POST['act']){ OR ($value > $p[2]) ) { - error(500,'wrong parameters 1'); + error(500,'wrong parameters'); die; } $postValues[$p[0]]=$value; @@ -40,6 +40,7 @@ switch ($_POST['act']){ $bot2Exists = false; foreach($bots as $bot){ if($bot['id'] == $_POST['bot1']){ + echo $bot['id']."|".$_POST['bot1']."\n"; $bot1 = $bot; $bot1Exists =true; } From 268cfddd3eb7410741248fc8e41360745c9a612a Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:42:33 +0100 Subject: [PATCH 09/27] debog --- src/arenas/Battleship/act.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 0d4f886..5d3787d 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -1,6 +1,6 @@ Date: Sat, 12 Dec 2015 10:46:38 +0100 Subject: [PATCH 10/27] correct bot id --- src/arenas/Battleship/public.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arenas/Battleship/public.php b/src/arenas/Battleship/public.php index f62943a..7914490 100644 --- a/src/arenas/Battleship/public.php +++ b/src/arenas/Battleship/public.php @@ -31,7 +31,7 @@ if(!$postParams){ else $selected=''; - echo ''; + echo ''; } ?> @@ -44,7 +44,7 @@ if(!$postParams){ else $selected=''; - echo ''; + echo ''; } ?> From 5c93d4da2f7abf6b96af8d00bbe4bd40524aa6d5 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:49:01 +0100 Subject: [PATCH 11/27] correct bot id --- src/arenas/Battleship/js.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arenas/Battleship/js.js b/src/arenas/Battleship/js.js index 50ee1c3..a6b8098 100644 --- a/src/arenas/Battleship/js.js +++ b/src/arenas/Battleship/js.js @@ -68,8 +68,8 @@ function battleship(bot1,bot2,gridWidth,gridHeight,nbShip1,nbShip2,nbShip3,nbShi xhr.open("POST", '/Battleship', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send( - 'act=initGame&bot1=' + bot1 - + '&bot2=' + bot2 + 'act=initGame&bot1=' + bot1IdName[0] + + '&bot2=' + bot2IdName[0] + '&gridWidth=' + gridWidth + '&gridHeight=' + gridHeight + '&nbShip1=' + nbShip1 From ec5e7109d4c42ec546d0dd0d85a5c55c89195cba Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:50:44 +0100 Subject: [PATCH 12/27] debog --- src/arenas/Battleship/act.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 5d3787d..4131bc1 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -39,8 +39,9 @@ switch ($_POST['act']){ $bot1Exists = false; $bot2Exists = false; foreach($bots as $bot){ + echo $bot['id']."|".$_POST['bot1']."\n"; if($bot['id'] == $_POST['bot1']){ - echo $bot['id']."|".$_POST['bot1']."\n"; + $bot1 = $bot; $bot1Exists =true; } From 76080ea5bf0c6e72075fc4922f807877145b3f98 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:52:14 +0100 Subject: [PATCH 13/27] debog --- src/arenas/Battleship/act.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 4131bc1..27124c1 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -18,7 +18,7 @@ switch ($_POST['act']){ foreach($postParamsWanted as $p){ if(!isset($_POST[$p[0]])){ - error (500,'missing parameter'); + error (500,'missing parameter 1'); die; }else{ $value=$_POST[$p[0]]; @@ -39,7 +39,6 @@ switch ($_POST['act']){ $bot1Exists = false; $bot2Exists = false; foreach($bots as $bot){ - echo $bot['id']."|".$_POST['bot1']."\n"; if($bot['id'] == $_POST['bot1']){ $bot1 = $bot; @@ -54,7 +53,7 @@ switch ($_POST['act']){ } } if ((!$bot1Exists) OR (!$bot2Exists)){ - error (500,"missing parameter"); + error (500,"missing parameter 2"); } //vars checked, lets init the initGame From 8bace3c4e184aa5256af215b7e95549f3f566828 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:53:29 +0100 Subject: [PATCH 14/27] fix js parameter --- src/arenas/Battleship/js.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arenas/Battleship/js.js b/src/arenas/Battleship/js.js index a6b8098..1d07041 100644 --- a/src/arenas/Battleship/js.js +++ b/src/arenas/Battleship/js.js @@ -73,7 +73,7 @@ function battleship(bot1,bot2,gridWidth,gridHeight,nbShip1,nbShip2,nbShip3,nbShi + '&gridWidth=' + gridWidth + '&gridHeight=' + gridHeight + '&nbShip1=' + nbShip1 - + '&nbShip1=' + nbShip2 + + '&nbShip2=' + nbShip2 + '&nbShip3=' + nbShip3 + '&nbShip4=' + nbShip4 + '&nbShip5=' + nbShip5 From 019cd7da07f9f69f5dc157c06952c52f2c3f382d Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:56:00 +0100 Subject: [PATCH 15/27] fix js parameter --- src/arenas/Battleship/act.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 27124c1..0b7bb9f 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -8,12 +8,12 @@ switch ($_POST['act']){ // key,min,max array('gridWidth',1,100), array('gridHeight',1,100), - array('ship1',1,10), - array('ship2',1,10), - array('ship3',1,10), - array('ship4',1,10), - array('ship5',1,10), - array('ship6',1,10) + array('nbShip1',1,10), + array('nbShip2',1,10), + array('nbShip3',1,10), + array('nbShip4',1,10), + array('nbShip5',1,10), + array('nbShip6',1,10) ); foreach($postParamsWanted as $p){ From c9238dcf91cba60fa4d24f37c06f905e980ed7bd Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:57:03 +0100 Subject: [PATCH 16/27] fix non strict comparaisons --- src/arenas/Battleship/act.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 0b7bb9f..1be2919 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -25,8 +25,8 @@ switch ($_POST['act']){ } if ( (!is_numeric($value)) - OR ($value < $p[1]) - OR ($value > $p[2]) + OR ($value <= $p[1]) + OR ($value >= $p[2]) ) { error(500,'wrong parameters'); From db3c92e8ff42bac56d247ddb4926034a4f68d4bc Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:57:57 +0100 Subject: [PATCH 17/27] debog --- src/arenas/Battleship/act.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 1be2919..2eb3ada 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -25,11 +25,11 @@ switch ($_POST['act']){ } if ( (!is_numeric($value)) - OR ($value <= $p[1]) + OR ( <= $p[1]) OR ($value >= $p[2]) ) { - error(500,'wrong parameters'); + error(500,'wrong parameters'.$p[0]); die; } $postValues[$p[0]]=$value; From e6f9958a4662e98158f8122e8b8dc82f66882626 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 10:58:58 +0100 Subject: [PATCH 18/27] debog --- src/arenas/Battleship/act.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 2eb3ada..ac182bc 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -25,7 +25,7 @@ switch ($_POST['act']){ } if ( (!is_numeric($value)) - OR ( <= $p[1]) + OR ($value <= $p[1]) OR ($value >= $p[2]) ) { From d0f2ae64b8b23306d3a58f15631d92219cc579c8 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 11:00:35 +0100 Subject: [PATCH 19/27] debog --- src/arenas/Battleship/act.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index ac182bc..df35b9e 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -8,12 +8,12 @@ switch ($_POST['act']){ // key,min,max array('gridWidth',1,100), array('gridHeight',1,100), - array('nbShip1',1,10), - array('nbShip2',1,10), - array('nbShip3',1,10), - array('nbShip4',1,10), - array('nbShip5',1,10), - array('nbShip6',1,10) + array('nbShip1',0,10), + array('nbShip2',0,10), + array('nbShip3',0,10), + array('nbShip4',0,10), + array('nbShip5',0,10), + array('nbShip6',0,10) ); foreach($postParamsWanted as $p){ @@ -29,7 +29,7 @@ switch ($_POST['act']){ OR ($value >= $p[2]) ) { - error(500,'wrong parameters'.$p[0]); + error(500,'wrong parameters '.$p[0]); die; } $postValues[$p[0]]=$value; From 57b0fbd1ba39eac1b5031a3529c41d172f975798 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 11:01:10 +0100 Subject: [PATCH 20/27] debog --- src/arenas/Battleship/act.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index df35b9e..7426642 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -25,8 +25,8 @@ switch ($_POST['act']){ } if ( (!is_numeric($value)) - OR ($value <= $p[1]) - OR ($value >= $p[2]) + OR ($value < $p[1]) + OR ($value > $p[2]) ) { error(500,'wrong parameters '.$p[0]); From c980003db7608d03553cb21919f2630900f24ccf Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 11:03:46 +0100 Subject: [PATCH 21/27] debog --- src/arenas/Battleship/act.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 7426642..837fb0c 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -72,12 +72,12 @@ switch ($_POST['act']){ 'opponent' => $bot2['name'], 'width' => $postValues['gridWidth'], 'height' => $postValues['height'], - 'ship1' => $postValues['ship1'], - 'ship2' => $postValues['ship2'], - 'ship3' => $postValues['ship3'], - 'ship4' => $postValues['ship4'], - 'ship5' => $postValues['ship5'], - 'ship6' => $postValues['ship6'] + 'ship1' => $postValues['nbShip1'], + 'ship2' => $postValues['nbShip2'], + 'ship3' => $postValues['nbShip3'], + 'ship4' => $postValues['nbShip4'], + 'ship5' => $postValues['nbShip5'], + 'ship6' => $postValues['nbShip6'] ); From 89a6a6d44b474b5c4b6c079909e50b2c9580c80c Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 11:05:54 +0100 Subject: [PATCH 22/27] debog --- src/arenas/Battleship/act.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 837fb0c..ca088f0 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -1,6 +1,7 @@ Date: Sat, 12 Dec 2015 11:06:26 +0100 Subject: [PATCH 23/27] debog --- src/arenas/Battleship/act.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index ca088f0..30d440f 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -1,5 +1,5 @@ Date: Sat, 12 Dec 2015 11:16:07 +0100 Subject: [PATCH 24/27] debog --- src/functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/functions.php b/src/functions.php index fb776da..aab8218 100644 --- a/src/functions.php +++ b/src/functions.php @@ -214,7 +214,8 @@ function save_battle($game,$bot1,$bot2,$resultat){ ON DUPLICATE KEY UPDATE ".$field." = ".$field." + 1;"); } function get_unique_id(){ - $fp = fopen(__DIR__.'countBattles.txt', 'c+'); + + $fp = fopen(__DIR__.'/countBattles.txt', 'c+'); flock($fp, LOCK_EX); $count = (int)fread($fp, filesize('count.txt')); From 2754cd17ee3e0d141593df57b3fbea96fcfa4aec Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 11:16:54 +0100 Subject: [PATCH 25/27] debog --- src/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/functions.php b/src/functions.php index aab8218..5956461 100644 --- a/src/functions.php +++ b/src/functions.php @@ -218,7 +218,7 @@ function get_unique_id(){ $fp = fopen(__DIR__.'/countBattles.txt', 'c+'); flock($fp, LOCK_EX); - $count = (int)fread($fp, filesize('count.txt')); + $count = (int)fread($fp, filesize(__DIR__.'/count.txt')); ftruncate($fp, 0); fseek($fp, 0); fwrite($fp, $count + 1); From 5f73af4fefdc737eb83fdd88217d0b5d8fd0d5de Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 11:20:33 +0100 Subject: [PATCH 26/27] . --- src/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/functions.php b/src/functions.php index 5956461..3d55215 100644 --- a/src/functions.php +++ b/src/functions.php @@ -215,10 +215,10 @@ function save_battle($game,$bot1,$bot2,$resultat){ } function get_unique_id(){ - $fp = fopen(__DIR__.'/countBattles.txt', 'c+'); + $fp = fopen(__DIR__.'/../countBattles.txt', 'c+'); flock($fp, LOCK_EX); - $count = (int)fread($fp, filesize(__DIR__.'/count.txt')); + $count = (int)fread($fp, filesize(__DIR__.'/../countBattles.txt')); ftruncate($fp, 0); fseek($fp, 0); fwrite($fp, $count + 1); From 533f7cf530d11174fd9d8435bbbd8658531f2e70 Mon Sep 17 00:00:00 2001 From: gnieark Date: Sat, 12 Dec 2015 11:22:04 +0100 Subject: [PATCH 27/27] . --- src/arenas/Battleship/act.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index 30d440f..23e91e7 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -72,7 +72,7 @@ switch ($_POST['act']){ 'match_id' => $_SESSION['matchId']."-1", 'opponent' => $bot2['name'], 'width' => $postValues['gridWidth'], - 'height' => $postValues['height'], + 'height' => $postValues['gridHeight'], 'ship1' => $postValues['nbShip1'], 'ship2' => $postValues['nbShip2'], 'ship3' => $postValues['nbShip3'],