From ecfc59b4620a36e53c482f8480cda3345415d5b0 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Wed, 11 May 2016 10:33:32 +0200 Subject: [PATCH] init game --- html/StupidIAconnectFour.php | 3 ++ src/arenas/connectFour/act.php | 74 +++++++++++++++++++++++++++++-- src/arenas/connectFour/public.php | 2 +- 3 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 html/StupidIAconnectFour.php diff --git a/html/StupidIAconnectFour.php b/html/StupidIAconnectFour.php new file mode 100644 index 0000000..f96fdd6 --- /dev/null +++ b/html/StupidIAconnectFour.php @@ -0,0 +1,3 @@ + "connectFou"){ + erreur(500,"game non found"); + } + + //What player has to play? + if(!isset($_SESSION['currentPlayer']){ + $_SESSION['currentPlayer']=1; + $you="X"; + }else{ + if($_SESSION['currentPlayer']==1){ + $_SESSION['currentPlayer']=2; + $you="O"; + }else{ + $_SESSION['currentPlayer']=1; + $you="X"; + } + } + + //make post datas to send + $postDatas=array( + 'game' => 'conectFour', + 'match_id' => $_SESSION['matchId']. $_SESSION['currentPlayer'], + //'opponent' => $opponentName, + 'you' => $you + 'grid' => json_encode( $_SESSION['map']) + + ); + //debug + print_r($postDatas); + print_r($_SESSION['bot1']); + + + die; break; default: diff --git a/src/arenas/connectFour/public.php b/src/arenas/connectFour/public.php index aa5ed1b..852c0e9 100644 --- a/src/arenas/connectFour/public.php +++ b/src/arenas/connectFour/public.php @@ -1,7 +1,7 @@