<!doctype html>
<html>
<head>
<title>Scrabbling Snakes - RJM Programming - July, 2015</title>
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<style>
#td { border: 3px solid green; }
body { background-color: yellow; }
td { background-color: white; }
#td1-1 { background-color: red; }
#td1-8 { background-color: red; }
#td1-15 { background-color: red; }
#td15-1 { background-color: red; }
#td15-8 { background-color: red; }
#td15-15 { background-color: red; }
#td8-1 { background-color: red; }
#td8-15 { background-color: red; }
#td1-4 { background-color: lightblue; }
#td1-12 { background-color: lightblue; }
#td15-4 { background-color: lightblue; }
#td15-12 { background-color: lightblue; }
#td3-7 { background-color: lightblue; }
#td3-9 { background-color: lightblue; }
#td13-7 { background-color: lightblue; }
#td13-9 { background-color: lightblue; }
#td4-1 { background-color: lightblue; }
#td4-8 { background-color: lightblue; }
#td4-15 { background-color: lightblue; }
#td12-1 { background-color: lightblue; }
#td12-8 { background-color: lightblue; }
#td12-15 { background-color: lightblue; }
#td7-3 { background-color: lightblue; }
#td7-7 { background-color: lightblue; }
#td7-9 { background-color: lightblue; }
#td7-13 { background-color: lightblue; }
#td9-3 { background-color: lightblue; }
#td9-7 { background-color: lightblue; }
#td9-9 { background-color: lightblue; }
#td9-13 { background-color: lightblue; }
#td8-4 { background-color: lightblue; }
#td8-12 { background-color: lightblue; }
#td2-2 { background-color: pink; }
#td2-14 { background-color: pink; }
#td14-2 { background-color: pink; }
#td14-14 { background-color: pink; }
#td3-3 { background-color: pink; }
#td3-13 { background-color: pink; }
#td13-3 { background-color: pink; }
#td13-13 { background-color: pink; }
#td4-4 { background-color: pink; }
#td4-12 { background-color: pink; }
#td12-4 { background-color: pink; }
#td12-12 { background-color: pink; }
#td5-5 { background-color: pink; }
#td5-11 { background-color: pink; }
#td11-5 { background-color: pink; }
#td11-11 { background-color: pink; }
#td8-8 { background-color: pink; }
#td2-6 { background-color: blue; }
#td2-10 { background-color: blue; }
#td14-6 { background-color: blue; }
#td14-10 { background-color: blue; }
#td6-2 { background-color: blue; }
#td6-6 { background-color: blue; }
#td6-10 { background-color: blue; }
#td6-14 { background-color: blue; }
#td10-2 { background-color: blue; }
#td10-6 { background-color: blue; }
#td10-10 { background-color: blue; }
#td10-14 { background-color: blue; }
</style>
<script type='text/javascript'>
var snakestuff="8px ridge orange";
var emailp=encodeURIComponent("?p=");
var remailp="?p=";
var emailprest="";
var score=0;
var goes=0;
var smallh3="";
var smallh4="0,0";
var overalllist="";
var curlist=";";
var lastid="";
var prevlastid="";
var wdelim="";
var plist="Player1";
var aplist=['Player1'];
var nplay=1;
var cols; //=lastid.split("-");
var rows; //=cols[0].replace("td", "");
var tcols; //=tdi.split("-");
var trows; //=tcols[0].replace("td", "");
var banright=false;
var banleft=false;
var bantop=false;
var banbottom=false;
var acols=['black','blue','purple','navy','teal','lime','fuchsia','olive','maroon','gray','green'];
var kcol=0;
var direction="";
var prevdirection="";
var curfactor=1;
var curscore=0;
var curtotal=0;
var totsecs=0;
var curlen=0;
var curword="";
var twentysix=26;
var gsofar=";";
var prerework="";
var aguess=new Array('','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
var clicks=new Array();
var score=new Array('0');
var goes=new Array('0');
var okcnt=0;
var nth="";
var dhdr="";
var ok=false;
var divcontent="";
var evalmda="mda=[]";
var delim="", mda; //=new Array();
var xmda=[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]];
var groupings=new Array("");
var ctable="<table border=5 cellpadding=5><tbody></tbody></table>";
var crow="";
twentysix=15;
for (var jjrow=1; jjrow<=twentysix; jjrow++) {
crow="<tr>";
for (var jjcol=1; jjcol<=twentysix; jjcol++) {
crow+="<td onclick='assess(this,this.innerHTML,this.id);' id='td" + jjrow + eval(-jjcol) + "'> </td>";
}
crow+="</tr>";
ctable=ctable.replace("</tbody>", crow + "</tbody>");
}
function csv(ainc) {
var retc=ainc[0], delim=',';
for (var ijk=1; ijk<ainc.length; ijk++) {
retc += (delim + " <font color=" + acols[ijk] + ">" + ainc[ijk] + "</font>");
}
return retc;
}
function fwb(newkcol) {
var ainc=plist.split(","), objk;
for (var ijk=0; ijk<ainc.length; ijk++) {
objk=document.getElementById('f' + ijk);
if (objk != null) {
if (eval(ijk) == eval(newkcol)) {
//alert(newkcol);
objk.style.fontWeight = 'bold';
} else {
objk.style.fontWeight = 'normal';
}
}
}
return newkcol;
}
function ocsv(inc, pref) {
//alert(inc);
var ainc=inc.split(",");
var retc="<font color=" + acols[0] + ">" + ainc[0] + "</font>", delim=',';
if (pref != "") retc=retc.replace("font color", "font id='" + pref + "0' style='font-weight:normal' color");
for (var ijk=1; ijk<ainc.length; ijk++) {
if (pref != "") {
retc += (delim + " <font style='font-weight:normal' id='" + pref + ijk + "' color=" + acols[ijk] + ">" + ainc[ijk] + "</font>");
} else {
retc += (delim + " <font color=" + acols[ijk] + ">" + ainc[ijk] + "</font>");
}
}
return retc;
}
function checkword() {
if (eval(curlen) > 0) {
if (1 == 2 && lastid != "") {
tcols=lastid.split("-");
trows=tcols[0].replace("td", "");
dosnake(1);
}
var isok=false;
var resp=document.getElementById('heldword');
var oxcihw=document.getElementById('iheldword');
if (eval(curlen) < 3) {
isok=isok;
} else if (document.title.indexOf(" " + curword.replace(/ /g,"").toUpperCase() + " ") != -1) {
isok=true;
//alert(999);
} else {
//alert("*" + resp.value + "*");
if (resp.value != "") isok=true;
if (resp.value.indexOf(" ") != -1) {
var yy = (oxcihw.contentWindow || oxcihw.contentDocument);
if (yy.document) { yy = yy.document; }
//alert("*" + yy.body.innerHTML + "*");
if (yy.innerHTML.indexOf(" ") != -1 || yy.body.innerHTML == "" || yy.body.innerHTML == " ") {
isok=false;
} else {
isok=true;
}
}
//isok=confirm("Word to check is " + curword + "(" + curtotal + ")");
//if (isok == null) isok=false;
}
var xcihw=oxcihw.src.split("?");
//document.getElementById('iheldword').src=xcihw[0];
resp.value='';
if (document.title.indexOf(" " + curword.replace(/ /g,"").toUpperCase() + " ") != -1) isok=true;
if (document.title.indexOf(" NOWAYJOSE ") != -1) isok=false;
document.title="Scrabbling Snakes - RJM Programming - July, 2015";
if (isok) {
var mht=document.getElementById('myh3');
mht.innerHTML = mht.innerHTML + wdelim + " <font color=" + acols[kcol] + ">" + curword + "</font>";
smallh3+=((wdelim + curword).replace(/ /g, ""));
wdelim=", ";
overalllist+=curlist;
if (lastid != "") {
tcols=lastid.split("-");
trows=tcols[0].replace("td", "");
dosnake(1);
}
} else {
var ids=curlist.split(";");
for (var jid=0; jid<ids.length; jid++) {
if (ids[jid] != "") {
document.getElementById(ids[jid]).style.borderTop="";
document.getElementById(ids[jid]).style.borderBottom="";
document.getElementById(ids[jid]).style.borderLeft="";
document.getElementById(ids[jid]).style.borderRight="";
document.getElementById(ids[jid]).style.borderTopLeftRadius="";
document.getElementById(ids[jid]).style.borderTopRightRadius="";
document.getElementById(ids[jid]).style.borderBottomLeftRadius="";
document.getElementById(ids[jid]).style.borderBottomLeftRadius="";
document.getElementById(ids[jid]).style.borderLeftTopRadius="";
document.getElementById(ids[jid]).style.borderRightTopRadius="";
document.getElementById(ids[jid]).style.borderLeftBottomRadius="";
document.getElementById(ids[jid]).style.borderLeftBottomRadius="";
document.getElementById(ids[jid]).style.boxShadow="";
document.getElementById(ids[jid]).innerHTML=document.getElementById(ids[jid]).innerHTML.replace(/orange/g, "black");
}
}
}
goes[kcol] = eval(goes[kcol] + 1);
if (isok) score[kcol] = eval(score[kcol] + eval(curtotal));
curscore=0;
curfactor=1;
curtotal=0;
document.getElementById('myh4').innerHTML = "Score: " + ocsv(score.join(','), "") + " Goes: " + ocsv(goes.join(','), "");
kcol=fwb(eval(((kcol + 1) % eval(nplay + 0)) + 0));
var ooae=document.getElementById('aemail');
emailprest = encodeURIComponent("~" + plist.replace(/ /g,"%20") + "~" + smallh3 + "~" + score.join(',') + "!" + goes.join(',') + "~" + kcol + "~" + clicks.join(','));
ooae.href="mailto:?subject=Scrabbling%20Snakes%20snapshot&body=http://www.rjmprogramming.com.au/HTMLCSS/word_jumble.html" + emailp + emailprest;
ooae=document.getElementById('remail');
ooae.href="http://www.rjmprogramming.com.au/HTMLCSS/word_jumble.html" + remailp + emailprest;
//if (ooae.href.indexOf(encodeURIComponent("?p=")) == -1) {
//ooae.href=ooae.href.replace(".html", ".html" + emailp + emailprest);
//} else if (ooae.href.indexOf(emailp) != -1 && emailprest != "" && ooae.href.indexOf(encodeURIComponent(emailprest)) == -1) {
//ooae.href=ooae.href + encodeURIComponent(emailprest);
//}
direction="";
prevdirection="";
curlist=";";
curlen=0;
curword="";
lastid="";
prevlastid="";
curscore=0;
curfactor=1;
curtotal=0;
} else if (curlen < 0) {
totsecs++;
document.title="." + " " + document.title;
if (eval(totsecs) >= 5) {
if (document.title.indexOf(" " + curword.replace(/ /g,"").toUpperCase() + " ") != -1) {
document.getElementById('heldword').value=curword.replace(/ /g,"").toUpperCase();
curlen=eval(-curlen);
if (lastid != "") {
tcols=lastid.split("-");
trows=tcols[0].replace("td", "");
dosnake(1);
}
//alert(curlen);
} else if (document.title.indexOf(" NOWAYJOSE ") != -1) {
document.getElementById('heldword').value="";
curlen=eval(-curlen);
if (lastid != "") {
tcols=lastid.split("-");
trows=tcols[0].replace("td", "");
dosnake(1);
}
//alert(curlen);
} else if (totsecs == 38) {
if (lastid != "") {
tcols=lastid.split("-");
trows=tcols[0].replace("td", "");
dosnake(1);
}
curlen=eval(-curlen);
} else if (document.getElementById('heldword').value.indexOf(" ") == -1) {
if (lastid != "") {
tcols=lastid.split("-");
trows=tcols[0].replace("td", "");
dosnake(1);
}
curlen=eval(-curlen);
}
setTimeout(checkword, 1000); //1000);
} else {
if (totsecs == 3) {
var cihw=document.getElementById('iheldword').src.split("?");
if (curword.length > 2) {
document.getElementById('heldword').value=curword + " ";
document.title=" " + curword + " " + document.title;
var omn=document.getElementById('myh4');
if (plist.indexOf(",") != -1) {
omn.innerHTML+=' ... please wait while we validate "' + curword + '" for ' + aplist[kcol];
} else {
omn.innerHTML+=' ... please wait while we validate "' + curword + '"';
}
document.getElementById('iheldword').src=cihw[0] + "?theword=" + encodeURIComponent(curword.replace(/ /g,""));
} else {
totsecs = 1;
}
//alert(cihw[0] + "?theword=" + encodeURIComponent(curword) + "*");
}
setTimeout(checkword, 1000); //1000);
}
}
}
function assess(tdo, tdh, tdi) {
var huhs, scol, ourscol="white", ourval=1, ourletter="", posok=true, thislastid="";
if (lastid != "") {
cols=lastid.split("-");
rows=cols[0].replace("td", "");
tcols=tdi.split("-");
trows=tcols[0].replace("td", "");
if (Math.abs(eval(cols[1]) - eval(tcols[1])) <= 1 && Math.abs(eval(rows) - eval(trows)) <= 1 && eval(Math.abs(eval(cols[1]) - eval(tcols[1])) + Math.abs(eval(rows) - eval(trows))) <= 2) {
if (curlist.indexOf(";" + tdi + ";") == -1) thislastid=tdi;
} else {
posok=false;
}
} else if (curword == "") {
thislastid=tdi;
}
if (curlist.indexOf(";" + tdi + ";") == -1 && overalllist.indexOf(";" + tdi + ";") == -1 && posok) {
clicks.push(tdi);
if (tdh.indexOf("</font></sub></div>") != -1) {
//alert(99);
huhs=tdh.split("</font></sub></div>");
if (huhs.length == 2) {
//alert(98 + " " + huhs[0]);
scol=huhs[0].split(">");
if (scol.length > 1) {
//alert(scol.length + " " + 97 + " " + scol[0] + " " + scol[1]);
//alert(scol[0] + " ... " + scol[eval(scol.length - 1)] + " via " + huhs[1]);
ourval=scol[eval(scol.length - 1)];
//alert(ourval);
//scol=huhs[0].split(">");
if (scol.length >= 4) ourletter=scol[3].replace("</b", "").replace(/ /g, "");
}
}
}
if (dhdr.indexOf("#" + tdi + " ") != -1) {
huhs=dhdr.split("#" + tdi + " ");
if (huhs.length == 2) {
//alert(99);
scol=huhs[1].split("}");
if (scol.length > 1) {
//alert(98);
ourscol=scol[0].replace(/ /g, "").replace("{", "").replace(";", "").replace("background-color:", "");
//alert(ourscol + " " + ourval + " " + ourletter + " ... " + tdh);
}
}
//alert(huhs.length);
}
//alert("#" + tdi + " " + dhdr);
if (ourletter != "") {
if (curword != "" && 2 == 3) alert("tdi=" + tdi + " lastid=" + lastid + " thislastid=" + thislastid);
if (lastid == tdi || curword == "") {
if (1 == 2) alert("First letter lastid=" + thislastid);
} else {
dosnake(0);
}
//tdo.style.border=snakestuff;
prevlastid=lastid;
lastid=thislastid;
curlist += (tdi + ";");
curfactor = eval(eval(curfactor) * eval(ourscol.replace("white","1").replace("red","3").replace("pink","2").replace("lightblue","1").replace("blue","1")));
curscore += eval(eval(ourval) * eval(ourscol.replace("white","1").replace("red","1").replace("pink","1").replace("lightblue","2").replace("blue","3")));
curtotal=eval(eval(curscore) * eval(curfactor));
//alert("curfactor=" + curfactor + " curscore=" + curscore + " curtotal=" + curtotal);
tdo.innerHTML=tdo.innerHTML.replace(/black/g, "orange");
if (curword == "") {
totsecs=0;
curword=ourletter;
curlen=-1;
//alert(ourletter);
//setTimeout(checkword, 1000); //1000);
checkword();
} else {
totsecs=0;
curword+=ourletter;
curlen--;
//alert(curword + " " + curlen);
}
}
}
}
function dosnake(atend) {
prevdirection=direction;
if (atend == 0) {
direction="";
if (eval(rows) > eval(trows)) { // this one is south of last
direction+="north";
} else if (eval(rows) < eval(trows)) { // this one is north of last
direction+="south";
}
if (eval(cols[1]) > eval(tcols[1])) { // this one is west of last
direction+="west";
} else if (eval(cols[1]) < eval(tcols[1])) { // this one is east of last
direction+="east";
}
}
//alert(direction);
var tdospare=document.getElementById(lastid);
tdospare.style.borderTopLeftRadius="10px";
tdospare.style.borderTopRightRadius="10px";
tdospare.style.borderBottomLeftRadius="10px";
tdospare.style.borderBottomLeftRadius="10px";
tdospare.style.borderLeftTopRadius="10px";
tdospare.style.borderRightTopRadius="10px";
tdospare.style.borderLeftBottomRadius="10px";
tdospare.style.borderLeftBottomRadius="10px";
tdospare.style.boxShadow="2px 2px 2px 2px rgba(0,0,0,0.3); ";
if (direction.length > 5) {
if (!banleft) tdospare.style.borderLeft=snakestuff;
if (!bantop) tdospare.style.borderTop=snakestuff;
//if (!bantop) tdospare.style.borderTopLeftRadius="10px";
//if (!bantop) tdospare.style.borderTopRightRadius="10px";
//if (!bantop) tdospare.style.boxShadow="2px 2px 2px 2px rgba(0,0,0,0.3); ";
if (!banbottom) tdospare.style.borderBottom=snakestuff;
//if (!banbottom) tdospare.style.borderBottomLeftRadius="10px";
//if (!banbottom) tdospare.style.borderBottomRightRadius="10px";
//if (!banbottom) tdospare.style.boxShadow="2px 2px 2px 2px rgba(0,0,0,0.3); ";
if (!banright) tdospare.style.borderRight=snakestuff;
banright=false;
banleft=false;
bantop=false;
banbottom=false;
} else if (direction == "east") {
if (curlen == -1 && atend == 0 && !banleft) tdospare.style.borderLeft=snakestuff;
if (atend != 0 && !banright) tdospare.style.borderRight=snakestuff;
if (prevdirection != "south") {
if (!bantop) tdospare.style.borderTop=snakestuff;
if (prevdirection.indexOf("south") != 1 && prevdirection.length > 5 && !banleft) tdospare.style.borderLeft=snakestuff;
} else {
if (!banleft) tdospare.style.borderLeft=snakestuff;
}
if (prevdirection != "north") {
if (!banbottom) tdospare.style.borderBottom=snakestuff;
if (prevdirection.indexOf("north") != 1 && prevdirection.length > 5 && !banleft) tdospare.style.borderLeft=snakestuff;
} else {
if (!banleft) tdospare.style.borderLeft=snakestuff;
}
banright=false;
banleft=false;
bantop=false;
banbottom=false;
// ?
if (prevlastid != "" && lastid != "" && prevdirection == "southwest") {
document.getElementById(prevlastid).style.borderBottom="";
bantop=true;
//alert(98);
}
if (prevlastid != "" && lastid != "" && prevdirection == "southeast") {
document.getElementById(prevlastid).style.borderTop="";
banbottom=true;
//alert(99);
}
} else if (direction == "west") {
if (curlen == -1 && atend == 0 && !banright) tdospare.style.borderRight=snakestuff;
if (atend != 0 && !banleft) tdospare.style.borderLeft=snakestuff;
if (prevdirection != "south") {
if (!bantop) tdospare.style.borderTop=snakestuff;
if (prevdirection.indexOf("south") != 1 && prevdirection.length > 5 && !banright) tdospare.style.borderRight=snakestuff;
} else {
if (!banright) tdospare.style.borderRight=snakestuff;
}
if (prevdirection != "north") {
if (!banbottom) tdospare.style.borderBottom=snakestuff;
if (prevdirection.indexOf("north") != 1 && prevdirection.length > 5 && !banright) tdospare.style.borderRight=snakestuff;
} else {
if (!banright) tdospare.style.borderRight=snakestuff;
}
banright=false;
banleft=false;
bantop=false;
banbottom=false;
// ?
if (prevlastid != "" && lastid != "" && prevdirection == "northwest") {
document.getElementById(prevlastid).style.borderBottom="";
bantop=true;
//alert(98);
}
if (prevlastid != "" && lastid != "" && prevdirection == "northeast") {
document.getElementById(prevlastid).style.borderTop="";
banbottom=true;
//alert(99);
}
} else if (direction == "north") {
//document.getElementById('myh1').innerHTML = prevlastid + "." + lastid + ":" + prevdirection + "-" + direction;
if (curlen == -1 && atend == 0 && !banbottom) tdospare.style.borderBottom=snakestuff;
if (atend != 0 && !bantop) tdospare.style.borderTop=snakestuff;
if (prevdirection != "east") {
if (!banleft) tdospare.style.borderLeft=snakestuff;
if (prevdirection.indexOf("east") != 1 && prevdirection.length > 5 && !banbottom) tdospare.style.borderBottom=snakestuff;
} else {
if (!banbottom) tdospare.style.borderBottom=snakestuff;
}
if (prevdirection != "west") {
if (!banright) tdospare.style.borderRight=snakestuff;
if (prevdirection.indexOf("west") != 1 && prevdirection.length > 5 && !banbottom) tdospare.style.borderBottom=snakestuff;
} else {
if (!banbottom) tdospare.style.borderBottom=snakestuff;
}
banright=false;
banleft=false;
bantop=false;
banbottom=false;
if (prevlastid != "" && lastid != "" && prevdirection == "southwest") {
document.getElementById(prevlastid).style.borderLeft="";
banright=true;
}
if (prevlastid != "" && lastid != "" && prevdirection == "southeast") {
document.getElementById(prevlastid).style.borderRight="";
banleft=true;
}
} else if (direction == "south") {
if (curlen == -1 && atend == 0 && !bantop) tdospare.style.borderTop=snakestuff;
if (atend != 0 && !banbottom) tdospare.style.borderBottom=snakestuff;
if (prevdirection != "east") {
if (!banleft) tdospare.style.borderLeft=snakestuff;
if (prevdirection.indexOf("east") != 1 && prevdirection.length > 5 && !bantop) tdospare.style.borderTop=snakestuff;
} else {
if (!bantop) tdospare.style.borderTop=snakestuff;
}
if (prevdirection != "west") {
if (!banright) tdospare.style.borderRight=snakestuff;
if (prevdirection.indexOf("west") != 1 && prevdirection.length > 5 && !bantop) tdospare.style.borderTop=snakestuff;
} else {
if (!bantop) tdospare.style.borderTop=snakestuff;
}
banright=false;
banleft=false;
bantop=false;
banbottom=false;
if (prevlastid != "" && lastid != "" && prevdirection == "northeast") {
document.getElementById(prevlastid).style.borderRight="";
banleft=true;
}
if (prevlastid != "" && lastid != "" && prevdirection == "northwest") {
document.getElementById(prevlastid).style.borderLeft="";
banright=true;
}
}
}
function getcalled(inpar) {
var icol=0, ik=0, guess="a", tdo;
var parts=inpar.split("~");
var ooae=document.getElementById('aemail');
ooae.href="mailto:?subject=Scrabbling%20Snakes%20snapshot&body=http://www.rjmprogramming.com.au/HTMLCSS/word_jumble.html" + encodeURIComponent("?p=") + inpar;
ooae=document.getElementById('remail');
ooae.href="http://www.rjmprogramming.com.au/HTMLCSS/word_jumble.html" + "?p=" + inpar;
emailp=encodeURIComponent("?p=") + parts[0];
remailp="?p=" + parts[0];
for (var irow=1; irow<=twentysix; irow++) {
for (var iicol=1; iicol<=twentysix; iicol++) {
icol=eval(-iicol);
tdo=document.getElementById('td' + eval(irow) + eval(icol));
guess=parts[0].substring(ik, eval(ik + 1));
//alert(guess + " " + ik);
tdo.innerHTML="<div align='center'><font size=3 id='f" + eval(irow - 1) + eval(icol + 1) + "' style='display:inline;'>" + valueis(guess) + "</div>";
ik++;
}
}
if (parts.length > 1) {
//alert(parts.length);
plist=parts[1];
//alert(plist);
document.getElementById('plist').value=plist;
uplayl(plist);
if (parts.length > 2) {
//alert(parts[2]);
smallh3=parts[2];
var words=parts[2].split(","), wwdelim="", kkcol=0, kkkcol=0;
var mht=document.getElementById('myh3');
smallh3="";
for (kkcol=0; kkcol<words.length; kkcol++) {
wdelim=", ";
kkkcol=(eval((kkcol % eval(nplay + 0)) + 0));
mht.innerHTML = mht.innerHTML + wwdelim + " <font color=" + acols[kkkcol] + ">" + words[kkcol] + "</font>";
smallh3+=((wwdelim + words[kkcol]).replace(/ /g, ""));
wwdelim=", ";
}
//document.getElementById('myh3').innerHTML=parts[2];
if (parts.length > 3) {
//alert(parts[3]);
var subparts=parts[3].split("!");
//document.getElementById('myh4').innerHTML=parts[3];
if (parts.length > 4) {
//alert(parts[4]);
kcol=fwb(eval(parts[4]));
var subs=subparts[0].split(","), isubs=0;
for (isubs=0; isubs<subs.length; isubs++) score[isubs] = eval(subs[isubs]);
subs=subparts[1].split(",")
for (isubs=0; isubs<subs.length; isubs++) goes[isubs] = eval(subs[isubs]);
document.getElementById('myh4').innerHTML = "Score: " + ocsv(subparts[0], "") + " Goes: " + ocsv(subparts[1], "");
if (parts.length > 5) {
//alert(parts[5]);
var tiles=parts[5].split(","), atile;
for (itile=0; itile<tiles.length; itile++) {
curlist += (tiles[itile] + ";");
clicks.push(tiles[itile]);
atile=document.getElementById(tiles[itile]);
atile.innerHTML=atile.innerHTML.replace(/black/g, "orange");
}
}
}
}
}
}
return true;
}
function populate() {
//var aguess=['','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
var tdo, tdospare, sofar=";;", guess="", krow, cnt=0, retval=true, tdoinnerhtml="", icol=0;
if (divcontent == "") {
analyzeaguess();
var params = location.search.split('p=')[1] ? location.search.split('p=')[1].split('&')[0] : "";
dhdr=document.head.innerHTML;
divcontent=document.getElementById('mydiv').innerHTML;
//alert(xmda[2,2]);
//alert("xmda[2,2]=" + xmda[2,2]);
var cjrow='', cjcol='';
for (var jrow=0; jrow<twentysix; jrow++) {
for (var jcol=0; jcol<twentysix; jcol++) {
if (eval(jcol % 2) == eval(1 - 1*1)) {
//mda.push(['','']);
evalmda=evalmda.replace("=[", "=[['" + cjrow + "','" + cjcol + "']" + delim);
delim=",";
//alert(evalmda);
}
}
}
//alert(evalmda.length);
//var mda=[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]];
eval(evalmda);
//alert("mda[24,24]=" + mda[24,24]);
//alert("mda[27,27]=" + mda[27,27]);
//alert("mda[0,0]=" + mda[0,0]);
if (params != "") return getcalled(decodeURIComponent(params));
} else {
document.getElementById('mydiv').innerHTML=divcontent;
}
emailp=encodeURIComponent("?p=");
remailp="?p=";
okcnt=0;
document.title+=".";
for (var irow=1; irow<=twentysix; irow++) {
sofar=";;";
guess="";
for (var iicol=1; iicol<=twentysix; iicol++) {
icol=eval(-iicol);
//alert('td' + eval(irow) + eval(icol));
tdo=document.getElementById('td' + eval(irow) + eval(icol));
cnt=0;
ok=false;
while (!ok) {
while (sofar.indexOf(";" + guess + ";") != -1) {
guess=aguess[eval(Math.floor(Math.random() * eval(aguess.length - 1)) + 1)];
}
//alert("guess=" + guess);
ok=true;
if (irow > 1) {
ok=true;
for (krow=1; krow<irow; krow++) {
tdospare=document.getElementById('td' + + eval(krow) + eval(icol));
if (tdospare.innerHTML.indexOf(">" + guess + "<") != -1) {
cnt++;
//alert(guess + " " + sofar + ":" + tdospare.innerHTML);
ok=false;
if (cnt == 30) {
if (1 == 2) return false;
guess=aguess[eval(Math.floor(Math.random() * eval(aguess.length - 1)) + 1)];
ok=true;
cnt=0;
}
}
}
}
if (!ok) guess=aguess[eval(Math.floor(Math.random() * eval(aguess.length - 1)) + 1)];
}
//alert(96);
tdo.innerHTML="<div align='center'><font size=3 id='f" + eval(irow - 1) + eval(icol + 1) + "' style='display:inline;'>" + valueis(guess) + "</div>";
//alert(97 + guess);
mda[eval(irow - 1),eval(icol + 1)] = guess;
emailp+=guess;
remailp+=guess;
//alert(98);
sofar+=(guess + ";");
//alert(99);
}
}
if (retval) {
document.getElementById('myh4').innerHTML = "Score: " + ocsv(score.join(','), "") + " Goes: " + ocsv(goes.join(','), "");
var oae=document.getElementById('aemail');
if (oae.href.indexOf(encodeURIComponent("?p=")) == -1) {
oae.href=oae.href.replace(".html", ".html" + emailp);
}
oae=document.getElementById('remail');
if (oae.href.indexOf("?p=") == -1) {
oae.href=oae.href.replace(".html", ".html" + remailp);
}
}
return retval;
}
function analyzeaguess() {
var valis=1, alet='a', blet='0', ijh=0;
var llist="abcdefghijklmnopqrstuvwxyz";
var vlist="1332142418513113x11114484x";
if (aguess.length <= 27) {
for (var ilet=0; ilet<llist.length; ilet++) {
alet=llist.substring(ilet, eval(ilet + 1));
blet=vlist.substring(ilet, eval(ilet + 1)).replace('x','10');
for (ijh=0; ijh<eval(10 - eval(blet)); ijh++) {
aguess.push(alet);
}
}
}
}
function valueis(inc) {
var valis=1;
var llist="abcdefghijklmnopqrstuvwxyz";
var vlist="1332142418513113x11114484x";
return "<b style='color:black;'> " + inc + " </b></font><sub><font size=0 color=black>" + vlist.substring(eval(llist.indexOf(inc)),eval(1 + llist.indexOf(inc))).replace("x", "10") + "</font></sub>";
}
function makesel(iwhich, isup) {
if (isup != "-" && isup != "*" && isup != "/" && isup != "+") {
okcnt++;
return ('<select onchange=" if (eval(this.value) != ' + iwhich + ') { this.value=' + iwhich + '; } else { okcnt=okcnt; } "><option></option><option value=1>1</option><option value=2>2</option><option value=3>3</option><option value=4>4</option><option value=5>5</option><option value=6>6</option></select>').replace(' value=' + isup, ' value=' + isup + ' selected');
}
return '<select onchange=" if (eval(this.value) != ' + iwhich + ') { this.value=nth; } else { okcnt++; } "><option></option><option value=1>1</option><option value=2>2</option><option value=3>3</option><option value=4>4</option><option value=5>5</option><option value=6>6</option></select>';
}
function uplayl(ins) {
plist=ins;
aplist=plist.split(",");
for (var iy=nplay; iy<aplist.length; iy++) {
score.push('0');
goes.push('0');
}
nplay=aplist.length;
var omht=document.getElementById('myh3');
var omhtv=omht.innerHTML;
var opdiv=document.getElementById('pdiv');
var aopdiv=opdiv.innerHTML.split("</b>");
opdiv.innerHTML=aopdiv[0].replace(" (optional comma separated list)", "") + "</b>" + ocsv(ins, "f") + " <h3 id='myh3' align='center'>" + omhtv + "</h3>";
var okcol=document.getElementById('f' + kcol);
if (okcol != null) {
okcol.style.fontWeight='bold';
}
}
</script>
<style>
sup { color: red; }
</style>
</head>
<body onload=" twentysix=15; while (!populate()) { ok=ok; } ">
<h1 id='myh1' align='center' title='Double click up, down, diagonally to make words 3 or more long ... if tile word does not turn orange on click, use a double click.'>Scrabbling Snakes <a style='text-decoration:none;' target=_blank title='Scrabbling Snakes new game' href='./word_jumble.html'>-</a> RJM Programming <a style='text-decoration:none;' id='remail' href='http://www.rjmprogramming.com.au/HTMLCSS/word_jumble.html' title='Refresh this game'>-</a> July, 2015</h1>
<div id='pdiv' align='center'><b>Play<a id='aemail' href='mailto:?subject=Scrabbling%20Snakes%20snapshot&body=http://www.rjmprogramming.com.au/HTMLCSS/word_jumble.html' title='Email snapshot'>e</a>rs (optional comma separated list): </b><input onblur='uplayl(this.value);' type='text' id='plist' value='Player1' title='Comma separated player list'></input> <h3 id='myh3' align='center'>Words: </h3></div>
<h4 id='myh4' align='center'>Score: 0 Goes: 0</h4>
<input type='hidden' id='heldword' name='heldword' value=''></input>
<iframe style='display:none;' id='iheldword' src='word_jumble.php'></iframe>
<div align='center' id='mydiv'>
<script type='text/javascript'>
document.write(ctable);
</script>
</div>
</body>
</html>