liste des parametres battleship
This commit is contained in:
parent
2b073d39d4
commit
ad133c5b29
|
@ -1 +1,7 @@
|
||||||
<h2>Spécification pour faire votre bot à la bataille navale</h2>
|
<h2>Initialisation de la partie</h2>
|
||||||
|
<p>Pour démarrer la partie, l'arène va envoyer une requette http(s) à votre programme contenant les paramètres POST suivants:</p>
|
||||||
|
<ul>
|
||||||
|
<li></li>
|
||||||
|
<li></li>
|
||||||
|
<li></li>
|
||||||
|
</ul>
|
|
@ -15,3 +15,30 @@ function get_Post_Params($botsCount){
|
||||||
}
|
}
|
||||||
return array('bot1' => $_POST['bot1'],'bot2' => $_POST['bot2']);
|
return array('bot1' => $_POST['bot1'],'bot2' => $_POST['bot2']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generate_numeric_select($start,$end,$selected,$name,$id){
|
||||||
|
$out="<select";
|
||||||
|
if($name !== ""){
|
||||||
|
$out.=' name="'.$name'"';
|
||||||
|
}
|
||||||
|
if($id !== ""){
|
||||||
|
$out.=' id="'.$id'"';
|
||||||
|
}
|
||||||
|
$out.=">";
|
||||||
|
|
||||||
|
if($select == -1){
|
||||||
|
for($i=$start; $i <= $end; $i++ ){
|
||||||
|
$out.='<option value="'.$i.'">'.$i.'</option>';
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
for($i=$start; $i < $selected; $i++ ){
|
||||||
|
$out.='<option value="'.$i.'">'.$i.'</option>';
|
||||||
|
}
|
||||||
|
$out.='<option value="'.$selected.'" selected="selected">'.$selected.'</option>';
|
||||||
|
for($i=$selected + 1; $i <= $end; $i++ ){
|
||||||
|
$out.='<option value="'.$i.'">'.$i.'</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $out."</select>";
|
||||||
|
|
||||||
|
}
|
|
@ -14,32 +14,45 @@ if(!$postParams){
|
||||||
?>
|
?>
|
||||||
<article>
|
<article>
|
||||||
<h2><?php echo $lang['MAKE_DUEL'];?></h2>
|
<h2><?php echo $lang['MAKE_DUEL'];?></h2>
|
||||||
<p>
|
<p><label for="widthheight">Taille de la grille</label>
|
||||||
<select name="bot1" id="bot1">
|
<em id="widthheight">largeur:
|
||||||
<?php
|
<?php echo generate_numeric_select(1,100,10,'gridWidth',''); ?>
|
||||||
for($i=0;$i<count($bots);$i++){
|
Hauteur:
|
||||||
if($i==$bot1)
|
<?php echo generate_numeric_select(1,100,10,'gridHeight',''); ?>
|
||||||
$selected='selected="selected"';
|
</em>
|
||||||
else
|
</p>
|
||||||
$selected='';
|
<p><label for="ship1">Nombre de navires de 1 case:</label><?php echo generate_numeric_select(0,10,0,'ship1','ship1'); ?></p>
|
||||||
|
<p><label for="ship2">Nombre de navires de 2 cases:</label><?php echo generate_numeric_select(0,10,1,'ship2','ship2'); ?></p>
|
||||||
echo '<option value="'.$i.'" '.$selected.'>'.$bots[$i]['name'].'</option>';
|
<p><label for="ship3">Nombre de navires de 3 cases:</label><?php echo generate_numeric_select(0,10,2,'ship3','ship3'); ?></p>
|
||||||
}
|
<p><label for="ship4">Nombre de navires de 4 cases:</label><?php echo generate_numeric_select(0,10,1,'ship4','ship4'); ?></p>
|
||||||
?>
|
<p><label for="ship5">Nombre de navires de 5 cases:</label><?php echo generate_numeric_select(0,10,1,'ship5','ship5'); ?></p>
|
||||||
</select>
|
<p><label for="ship6">Nombre de navires de 6 cases:</label><?php echo generate_numeric_select(0,10,0,'ship6','ship6'); ?></p>
|
||||||
VS
|
<p>
|
||||||
<select name="bot2" id="bot2">
|
<select name="bot1" id="bot1">
|
||||||
<?php
|
<?php
|
||||||
for($i=0;$i<count($bots);$i++){
|
for($i=0;$i<count($bots);$i++){
|
||||||
if($i==$bot2)
|
if($i==$bot1)
|
||||||
$selected='selected="selected"';
|
$selected='selected="selected"';
|
||||||
else
|
else
|
||||||
$selected='';
|
$selected='';
|
||||||
echo '<option value="'.$i.'" '.$selected.'>'.$bots[$i]['name'].'</option>';
|
|
||||||
}
|
echo '<option value="'.$i.'" '.$selected.'>'.$bots[$i]['name'].'</option>';
|
||||||
?>
|
}
|
||||||
</select>
|
?>
|
||||||
</p>
|
</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="battleship(document.getElementById('bot1').value,document.getElementById('bot2').value,'<?php echo xd_check_input(2); ?>');"></p>
|
<p><input type="button" value="<?php echo $lang['FIGHT']; ?>" onclick="battleship(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