botsArena/src/arenas/tictactoe/public.php

45 lines
1.1 KiB
PHP
Raw Normal View History

<?php
require_once(__DIR__."/functions.php");
2015-11-28 14:27:39 +01:00
$bots=get_Bots_Array();
2015-11-28 14:26:11 +01:00
$postParams=get_Post_Params();
if(!$postParams){
$bot1="";
$bot2="";
}else{
$bot1=$postParams['bot1'];
$bot2=$postParams['bot2'];
}
?>
<article>
<h2>Lancer un combat</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>
&nbsp;VS&nbsp;
<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>
2015-11-28 15:23:49 +01:00
<p><input type="button" value="Fight!" onclick="tictactoe(document.getElementById('bot1').value,document.getElementById('bot2').value,'<?php echo xd_check_input(2); ?>');"></p>
2015-11-28 14:26:11 +01:00
</article>
<article id="fightResult"></article>