commit
404309613f
14
README.md
14
README.md
|
@ -19,6 +19,20 @@ I'd better like you to help me to improve [bot's Arena](https://botsarena.tinad.
|
||||||
* Apache/tomcat document root starts at ./html
|
* Apache/tomcat document root starts at ./html
|
||||||
* copy src/config.php.empty to src/config.php
|
* copy src/config.php.empty to src/config.php
|
||||||
|
|
||||||
|
Apache RewriteRules are given on the file html/.htaccess
|
||||||
|
|
||||||
|
For nginx in server directive:
|
||||||
|
|
||||||
|
rewrite '^/([a-zA-Z]{1,})/doc-([a-z]{2})$' /index.php?doc=$1&lang=$2 last;
|
||||||
|
rewrite '^/p/([a-zA-Z]{1,})/(.*)-([a-z]{2})$' /index.php?page=$1¶ms=$2&lang=$3 last;
|
||||||
|
rewrite '^/p/([a-zA-Z]{1,})/(.*)$' /index.php?page=$1¶ms=$2 last;
|
||||||
|
rewrite '^/p/(.*)-([a-z]{2})$' /index.php?page=$1&lang=$2 last;
|
||||||
|
rewrite '^/p/(.*)$' index.php?page=$1 last;
|
||||||
|
rewrite '^/([a-zA-Z]{1,})/scores$' /index.php?scores=$1 last;
|
||||||
|
rewrite '^/([a-zA-Z]{1,})-([a-z]{2})$' /index.php?arena=$1&lang=$2 last;
|
||||||
|
rewrite '^/([a-zA-Z]{1,})/doc$' /index.php?doc=$1 last;
|
||||||
|
rewrite '^/([a-zA-Z]{1,})$' /index.php?arena=$1 last;
|
||||||
|
|
||||||
# License
|
# License
|
||||||
Bot's Arena , Website for Artificials intelligences duels.
|
Bot's Arena , Website for Artificials intelligences duels.
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1836
|
1845
|
|
@ -73,7 +73,7 @@ function createPlayerForm(index){
|
||||||
divForm.appendChild(select);
|
divForm.appendChild(select);
|
||||||
|
|
||||||
//url
|
//url
|
||||||
var inputUrl = createElem("input", {"id","botUrl" + index, "type": "text", "value":"jljfhglfsghf", "placeholder":"http://Bot.url" });
|
var inputUrl = createElem("input", {"id":"botUrl" + index, "type": "text", "value":"", "placeholder":"http://Bot.url" });
|
||||||
divForm.appendChild(inputUrl);
|
divForm.appendChild(inputUrl);
|
||||||
|
|
||||||
|
|
||||||
|
|
10
src/DUEL.php
10
src/DUEL.php
|
@ -31,16 +31,6 @@ class DUEL{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ELO
|
class ELO
|
||||||
{
|
{
|
||||||
public $rank = 1500; //default rank
|
public $rank = 1500; //default rank
|
||||||
|
|
|
@ -100,7 +100,6 @@ switch($_POST['act']){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "editBot":
|
case "editBot":
|
||||||
|
@ -194,9 +193,6 @@ switch($_POST['act']){
|
||||||
} else {
|
} else {
|
||||||
//echo "Message sent!";
|
//echo "Message sent!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -12,18 +12,13 @@ class Coords{
|
||||||
error_log("a bot out of limits");
|
error_log("a bot out of limits");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->x = $x;
|
$this->x = $x;
|
||||||
$this->y = $y;
|
$this->y = $y;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString(){
|
public function __toString(){
|
||||||
return $this->x.",".$this->y;
|
return $this->x.",".$this->y;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addDirection(Direction $dir){
|
public function addDirection(Direction $dir){
|
||||||
return new Coords(
|
return new Coords(
|
||||||
$this->x + $dir->deltaX,
|
$this->x + $dir->deltaX,
|
||||||
|
|
|
@ -106,6 +106,7 @@ class TronGame
|
||||||
curl_setopt($ch[$i], CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch[$i], CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt($ch[$i], CURLOPT_POSTFIELDS, $data_string);
|
curl_setopt($ch[$i], CURLOPT_POSTFIELDS, $data_string);
|
||||||
curl_setopt($ch[$i], CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch[$i], CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch[$i], CURLOPT_CONNECTTIMEOUT, 10);
|
||||||
curl_setopt($ch[$i], CURLOPT_HTTPHEADER, array(
|
curl_setopt($ch[$i], CURLOPT_HTTPHEADER, array(
|
||||||
'Content-Type: application/json',
|
'Content-Type: application/json',
|
||||||
'Content-Length: ' . strlen($data_string))
|
'Content-Length: ' . strlen($data_string))
|
||||||
|
|
|
@ -35,9 +35,12 @@ function changeSelect(number,botId){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function show_bot_panel(number){
|
function show_bot_panel(number){
|
||||||
|
|
||||||
|
var botsColor = ['cyan','darkmagenta','darkred','darkslategrey','deeppink','dodgerblue','goldenrod','grey','indigo','lightgreen','mediumslateblue','midnightblue'];
|
||||||
|
|
||||||
//configurePlayers
|
//configurePlayers
|
||||||
var fieldset = createElem('fieldset',{'class':'botFormulaire'});
|
var fieldset = createElem('fieldset',{'class':'botFormulaire'});
|
||||||
var legend = createElem('legend',{});
|
var legend = createElem('legend',{"style": "color: " + botsColor[number] +'; font-weight: bold;'});
|
||||||
legend.innerHTML = 'bot ' + number;
|
legend.innerHTML = 'bot ' + number;
|
||||||
fieldset.appendChild(legend);
|
fieldset.appendChild(legend);
|
||||||
var p=createElem('p');
|
var p=createElem('p');
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
#configurePlayers{width: 100%;}
|
#configurePlayers{width: 100%;}
|
||||||
#configurePlayers fieldset{display: block; width: 100px; float:left;}
|
#configurePlayers fieldset{display: block; width: 100px; float:left;}
|
||||||
#logs{display:block;padding-left:10px; height: 200px; overflow-y: scroll;}
|
#logs{display:block;padding-left:10px; height: 200px; overflow-y: scroll;}
|
||||||
#logs p em {color: grey; font-size: 70%; test-transform:italic;}
|
#logs p em {color: grey; font-size: 70%; font-style:italic;}
|
||||||
code{font-family: monospace;}
|
code{font-family: monospace;}
|
|
@ -271,6 +271,7 @@ function save_battle($game,$bot1,$bot2,$result,$nameOrIds = 'name'){
|
||||||
'1')
|
'1')
|
||||||
ON DUPLICATE KEY UPDATE ".$field." = ".$field." + 1;
|
ON DUPLICATE KEY UPDATE ".$field." = ".$field." + 1;
|
||||||
");
|
");
|
||||||
|
|
||||||
}
|
}
|
||||||
function get_unique_id(){
|
function get_unique_id(){
|
||||||
//increment the number
|
//increment the number
|
||||||
|
@ -345,6 +346,7 @@ function get_IA_Response($iaUrl,$postParams){
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||||
'Content-Type: application/json',
|
'Content-Type: application/json',
|
||||||
'Content-Length: ' . strlen($data_string))
|
'Content-Length: ' . strlen($data_string))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user