nav: home link class selected if is selected
This commit is contained in:
parent
481ef34179
commit
7b50124f62
0
src/arenas/tictactoe/act.php
Normal file
0
src/arenas/tictactoe/act.php
Normal file
31
src/arenas/tictactoe/functions.php
Normal file
31
src/arenas/tictactoe/functions.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
function getBotsArray(){
|
||||
//Recupérer la liste des Bots
|
||||
$bots=array();
|
||||
$botsList=explode("\n",file_get_contents(__DIR__."/listOfBots.txt"));
|
||||
|
||||
foreach($botsList as $botLigne){
|
||||
if(preg_match("/\ (http|https):\/\//", $botLigne)){
|
||||
list($name,$url)=explode(" ",$botLigne);
|
||||
$bots[]=array("name" => $name, "url" =>$url);
|
||||
}
|
||||
}
|
||||
return $bots;
|
||||
}
|
||||
function getIAResponse($youChar,$iaBaseUrl,$grille){
|
||||
/*transforme la grille en parametres http GET
|
||||
* et fait la requete vers $iaBaseUrl
|
||||
* Retourne la réponse de l'IA
|
||||
*/
|
||||
$paramsGrille="";
|
||||
foreach($grille as $key => $case){
|
||||
$paramsGrille.="&".$key."=".$case;
|
||||
}
|
||||
$url=$iaBaseUrl."?you=".$youChar.$paramsGrille;
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return htmlentities($output);
|
||||
}
|
3
src/arenas/tictactoe/listOfBots.txt
Normal file
3
src/arenas/tictactoe/listOfBots.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
stupidAI http://morpionmaster.tinad.fr/stupidIa.php
|
||||
moul http://tictactoe.m.42.am/
|
||||
Gnieark http://morpionmaster.tinad.fr/gnieark.php
|
|
@ -1 +1,5 @@
|
|||
<h2> tic tac toe </h2>
|
||||
<?php
|
||||
require_once(__DIR__."/functions.php");
|
||||
|
||||
$bots=getBotsArray();
|
||||
print_r($bots);
|
Loading…
Reference in New Issue
Block a user