summaryrefslogtreecommitdiff
path: root/interactor/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'interactor/index.html')
-rw-r--r--interactor/index.html20
1 files changed, 17 insertions, 3 deletions
diff --git a/interactor/index.html b/interactor/index.html
index 4593974..46df00f 100644
--- a/interactor/index.html
+++ b/interactor/index.html
@@ -10,7 +10,7 @@ var CVSH=500;
var COLOURS=["#00F","#F00","#0CC"];
-var socket=io();
+var socket=io(location.href);
var CELLSZ=~~(CVSH/(H+1));
var CVSW=CELLSZ*(W+1);
var CELL0X=~~(CVSW/2-W/2*CELLSZ)+.5,CELL0Y=~~(CVSH/2-H/2*CELLSZ)+.5;
@@ -184,6 +184,11 @@ function getusermove(){
setstatustext("<b>Your turn!</b>");
}
+function newgameparameter(){
+ var parameter=document.getElementById("parameter").value;
+ location.href=location.pathname+"?parameter="+encodeURIComponent(parameter);
+}
+
function setstatustext(text){
var elem=document.getElementById("statustext");
elem.innerHTML=text;
@@ -192,6 +197,11 @@ function setstatustext(text){
function assert(cond){if(!cond)throw new Error("Assertion failed");}
+socket.on("ainame",function(name){
+ var span=document.getElementById("ai_name");
+ span.innerHTML="";
+ span.appendChild(document.createTextNode(name));
+});
socket.on("emptyboard",function(){
bd=emptyboard();
});
@@ -223,6 +233,10 @@ socket.on("win",function(player){
<body onload="init()">
<h3>Interactor for Chain Reaction</h3>
<canvas id="cvs"></canvas><br>
-<span id="statustext"></span>
+<span id="statustext"></span><br>
+<br>
+Current AI: <span id="ai_name"></span><br>
+Parameter setting: <input id="parameter" type="text">
+<input type="button" onclick="newgameparameter()" value="New game with this parameter">
</body>
-</html> \ No newline at end of file
+</html>