From 21ef944a87e0116713e73945469801f81d9df374 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sat, 21 Sep 2019 19:49:56 +0200 Subject: Interactively set parameter to AI in interactor --- interactor/index.html | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'interactor/index.html') 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("Your turn!"); } +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){

Interactor for Chain Reaction


- +
+
+Current AI:
+Parameter setting: + - \ No newline at end of file + -- cgit v1.2.3-70-g09d2