full JSON

This commit is contained in:
gnieark 2016-05-29 21:22:41 +02:00
parent 0bd456f454
commit 612265d8c6
3 changed files with 5 additions and 9 deletions

View File

@ -3,12 +3,9 @@
* stupid IA for battle ship
* choose by random a free column
*/
print_r($_POST);
/*
$grid=json_decode($_POST['grid']);
$in=file_get_contents('php://input');
$params=json_decode($in, TRUE);
$grid=$params['grid'];
$colAvailable=array();
for($i=0;$i<7;$i++){
@ -19,4 +16,3 @@ for($i=0;$i<7;$i++){
shuffle($colAvailable);
echo $colAvailable[0];
die;
*/

View File

@ -90,7 +90,7 @@ switch ($_POST['act']){
//send query
$anwserPlayer=get_IA_Response($botUrl,$postDatas);
//for test ***************************
echo $anwserPlayer; die;
//echo $anwserPlayer; die;
//vérifier la validité de la réponse
if((isset($_SESSION['map'][5][$anwserPlayer])) && ($_SESSION['map'][5][$anwserPlayer] == "")){
//reponse conforme

View File

@ -48,7 +48,7 @@ function connectFour(bot1,bot2,xd_check, newGame){
xhr.onreadystatechange = function(){if(xhr.readyState == 4){
if(xhr.status == 200) {
//for test
alert(xhr.responseText);
// alert(xhr.responseText);
try{
var reponse = JSON.parse(xhr.responseText);