From 37fcc72e567d19c1853637bc38ef0f903312ee3b Mon Sep 17 00:00:00 2001 From: Gnieark Date: Sat, 28 Nov 2015 14:26:11 +0100 Subject: [PATCH] tictactoe public --- src/arenas/tictactoe/functions.php | 21 +++++++++++++-- src/arenas/tictactoe/public.php | 42 +++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/arenas/tictactoe/functions.php b/src/arenas/tictactoe/functions.php index 722dab6..1545141 100644 --- a/src/arenas/tictactoe/functions.php +++ b/src/arenas/tictactoe/functions.php @@ -1,5 +1,22 @@ count($bots))){ + error(400,"wrong parameters"); + die; + } + } + return array('bot1' => $_POST['bot1'],'bot2' => $_POST['bot2']); +} + +function get_Bots_Array(){ //Recupérer la liste des Bots $bots=array(); $botsList=explode("\n",file_get_contents(__DIR__."/listOfBots.txt")); @@ -12,7 +29,7 @@ function getBotsArray(){ } return $bots; } -function getIAResponse($youChar,$iaBaseUrl,$grille){ +function get_IA_Response($youChar,$iaBaseUrl,$grille){ /*transforme la grille en parametres http GET * et fait la requete vers $iaBaseUrl * Retourne la réponse de l'IA diff --git a/src/arenas/tictactoe/public.php b/src/arenas/tictactoe/public.php index 377d9a0..5e6fc62 100644 --- a/src/arenas/tictactoe/public.php +++ b/src/arenas/tictactoe/public.php @@ -2,4 +2,44 @@ require_once(__DIR__."/functions.php"); $bots=getBotsArray(); -print_r($bots); \ No newline at end of file +$postParams=get_Post_Params(); +if(!$postParams){ + $bot1=""; + $bot2=""; +}else{ + $bot1=$postParams['bot1']; + $bot2=$postParams['bot2']; +} + +?> +
+

Lancer un combat

+

+ +  VS  + +

+

+
+
\ No newline at end of file