From 2c033e19cdf5bf349fab7907767f866416ff2502 Mon Sep 17 00:00:00 2001
From: gnieark
Date: Thu, 10 Dec 2015 20:50:19 +0100
Subject: [PATCH] start battle ship arena dev
---
src/arenas/Battleship/js.js | 26 ++++++++++++++++++
src/arenas/Battleship/public.php | 46 +++++++++++++++++++++++++++++++-
src/arenas/tictactoe/doc-fr.html | 2 +-
3 files changed, 72 insertions(+), 2 deletions(-)
create mode 100644 src/arenas/Battleship/js.js
diff --git a/src/arenas/Battleship/js.js b/src/arenas/Battleship/js.js
new file mode 100644
index 0000000..4ffd58d
--- /dev/null
+++ b/src/arenas/Battleship/js.js
@@ -0,0 +1,26 @@
+function Ajx(){
+ var request = false;
+ try {request = new ActiveXObject('Msxml2.XMLHTTP');}
+ catch (err2) {
+ try {request = new ActiveXObject('Microsoft.XMLHTTP');}
+ catch (err3) {
+ try { request = new XMLHttpRequest();}
+ catch (err1) {
+ request = false;
+ }
+ }
+ }
+ return request;
+}
+function battleship(bot1,bot2,xd_check){
+ document.getElementById('fightResult').innerHTML = 'Please wait...
';
+ var xhr = Ajx();
+ xhr.onreadystatechange = function(){if(xhr.readyState == 4){
+ if(xhr.status == 200) {
+ document.getElementById('fightResult').innerHTML = xhr.responseText;
+ }
+ }};
+ xhr.open("POST", '/Battleship', true);
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ xhr.send('act=fight&bot1=' + bot1 + '&bot2=' + bot2 + '&xd_check=' + xd_check);
+}
\ No newline at end of file
diff --git a/src/arenas/Battleship/public.php b/src/arenas/Battleship/public.php
index 61aa218..a5a20c0 100644
--- a/src/arenas/Battleship/public.php
+++ b/src/arenas/Battleship/public.php
@@ -1 +1,45 @@
-Battle ship
\ No newline at end of file
+
+
+
+
+
+ '.$bots[$i]['name'].'';
+ }
+ ?>
+
+ VS
+
+ '.$bots[$i]['name'].'';
+ }
+ ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/src/arenas/tictactoe/doc-fr.html b/src/arenas/tictactoe/doc-fr.html
index de5151a..2e5feff 100644
--- a/src/arenas/tictactoe/doc-fr.html
+++ b/src/arenas/tictactoe/doc-fr.html
@@ -32,4 +32,4 @@ avec les coordonnées d'une case déjà jouée perd la partie.
Publier votre programme pour le tester puis le lâcher dans l'arène
-Ce n'est pas encore possible. L'interface est en cours de developpement. Mais vous pouvez toujours me contacter, @gnieark sur twitter, je mettrai à la main votre bot dans l'arène.
\ No newline at end of file
+le formulaire est sur la page d'accueil du site
\ No newline at end of file