|
|
|
@ -1,5 +1,22 @@
|
|
|
|
|
<?php
|
|
|
|
|
function getBotsArray(){
|
|
|
|
|
function get_Post_Params(){
|
|
|
|
|
$keysBots=array('bot1','bot2');
|
|
|
|
|
foreach($keysBots as $botKey){
|
|
|
|
|
if(!isset($_POST[$botKey])){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if(!is_numeric(($_POST[$botKey]))){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(($_POST[$botKey] < 0) OR ($_POST[$botKey] > 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
|
|
|
|
|