plop
This commit is contained in:
parent
48f063f8ef
commit
651371ef27
|
@ -1,4 +1,4 @@
|
||||||
<h2>Fonctionnement des duels de puisaance 4</h2>
|
<h2>Fonctionnement des duels de puisance 4</h2>
|
||||||
<h3>La grille</h3>
|
<h3>La grille</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>largeur: 7 cases</li>
|
<li>largeur: 7 cases</li>
|
||||||
|
@ -43,3 +43,4 @@ L'arène fait une requête http(s) avec les parametres POST suivants vers v
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3>Réponse de votre bot</h3>
|
<h3>Réponse de votre bot</h3>
|
||||||
|
<p>Il indique la colonne dans laquelle vous souhaitez jouer 0 à 7</p>
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
function get_Post_Params($botsCount){
|
||||||
|
$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] > $botsCount)){
|
||||||
|
error(400,"wrong parameters");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array('bot1' => $_POST['bot1'],'bot2' => $_POST['bot2']);
|
||||||
|
}
|
|
@ -2,10 +2,44 @@
|
||||||
require_once(__DIR__."/functions.php");
|
require_once(__DIR__."/functions.php");
|
||||||
|
|
||||||
$bots=get_Bots_Array('connectFour');
|
$bots=get_Bots_Array('connectFour');
|
||||||
|
$postParams=get_Post_Params(count($bots));
|
||||||
|
if(!$postParams){
|
||||||
|
$bot1="";
|
||||||
|
$bot2="";
|
||||||
|
}else{
|
||||||
|
$bot1=$postParams['bot1'];
|
||||||
|
$bot2=$postParams['bot2'];
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<article>
|
<article>
|
||||||
<h2>Connect Four</div>
|
<h2><?php echo $lang['MAKE_DUEL'];?></h2>
|
||||||
|
<p>
|
||||||
|
<select name="bot1" id="bot1">
|
||||||
|
<?php
|
||||||
|
for($i=0;$i<count($bots);$i++){
|
||||||
|
if($i==$bot1)
|
||||||
|
$selected='selected="selected"';
|
||||||
|
else
|
||||||
|
$selected='';
|
||||||
|
|
||||||
|
echo '<option value="'.$i.'" '.$selected.'>'.$bots[$i]['name'].'</option>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
VS
|
||||||
|
<select name="bot2" id="bot2">
|
||||||
|
<?php
|
||||||
|
for($i=0;$i<count($bots);$i++){
|
||||||
|
if($i==$bot2)
|
||||||
|
$selected='selected="selected"';
|
||||||
|
else
|
||||||
|
$selected='';
|
||||||
|
echo '<option value="'.$i.'" '.$selected.'>'.$bots[$i]['name'].'</option>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
<p><input type="button" value="<?php echo $lang['FIGHT']; ?>" onclick="tictactoe(document.getElementById('bot1').value,document.getElementById('bot2').value,'<?php echo xd_check_input(2); ?>');"></p>
|
||||||
<div id="fightResult"></div>
|
<div id="fightResult"></div>
|
||||||
</article>
|
</article>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user