<!doctype html>
<html>
<head>
<title>Pontoon - RJM Programming - March, 2018</title>
<script type='text/javascript'>
var pots=[null];
var bids=[null];
var huh='', gnump=0;
var numplayers=location.search.split('numplayers=')[1] ? eval(location.search.split('numplayers=')[1].split('&')[0]) : 2;
var startwith=location.search.split('startwith=')[1] ? eval(location.search.split('startwith=')[1].split('&')[0]) : 0;
var theplayers=[], origtd='';
var ourpack, ourheap, anarray=[], aniarray=[];
var cardsinpack=['TwoOfHearts','TwoOfDiamonds','TwoOfSpades','TwoOfClubs','ThreeOfHearts','ThreeOfDiamonds','ThreeOfSpades','ThreeOfClubs','FourOfHearts','FourOfDiamonds','FourOfSpades','FourOfClubs','FiveOfHearts','FiveOfDiamonds','FiveOfSpades','FiveOfClubs','SixOfHearts','SixOfDiamonds','SixOfSpades','SixOfClubs','SevenOfHearts','SevenOfDiamonds','SevenOfSpades','SevenOfClubs','EightOfHearts','EightOfDiamonds','EightOfSpades','EightOfClubs','NineOfHearts','NineOfDiamonds','NineOfSpades','NineOfClubs','TenOfHearts','TenOfDiamonds','TenOfSpades','TenOfClubs','JackOfHearts','JackOfDiamonds','JackOfSpades','JackOfClubs','QueenOfHearts','QueenOfDiamonds','QueenOfSpades','QueenOfClubs','KingOfHearts','KingOfDiamonds','KingOfSpades','KingOfClubs','AceOfHearts','AceOfDiamonds','AceOfSpades','AceOfClubs'];
var mypictures = new Array("//www.rjmprogramming.com.au/images/02h.gif",
"//www.rjmprogramming.com.au/images/02d.gif",
"//www.rjmprogramming.com.au/images/02s.gif",
"//www.rjmprogramming.com.au/images/02c.gif",
"//www.rjmprogramming.com.au/images/03h.gif",
"//www.rjmprogramming.com.au/images/03d.gif",
"//www.rjmprogramming.com.au/images/03s.gif",
"//www.rjmprogramming.com.au/images/03c.gif",
"//www.rjmprogramming.com.au/images/04h.gif",
"//www.rjmprogramming.com.au/images/04d.gif",
"//www.rjmprogramming.com.au/images/04s.gif",
"//www.rjmprogramming.com.au/images/04c.gif",
"//www.rjmprogramming.com.au/images/05h.gif",
"//www.rjmprogramming.com.au/images/05d.gif",
"//www.rjmprogramming.com.au/images/05s.gif",
"//www.rjmprogramming.com.au/images/05c.gif",
"//www.rjmprogramming.com.au/images/06h.gif",
"//www.rjmprogramming.com.au/images/06d.gif",
"//www.rjmprogramming.com.au/images/06s.gif",
"//www.rjmprogramming.com.au/images/06c.gif",
"//www.rjmprogramming.com.au/images/07h.gif",
"//www.rjmprogramming.com.au/images/07d.gif",
"//www.rjmprogramming.com.au/images/07s.gif",
"//www.rjmprogramming.com.au/images/07c.gif",
"//www.rjmprogramming.com.au/images/08h.gif",
"//www.rjmprogramming.com.au/images/08d.gif",
"//www.rjmprogramming.com.au/images/08s.gif",
"//www.rjmprogramming.com.au/images/08c.gif",
"//www.rjmprogramming.com.au/images/09h.gif",
"//www.rjmprogramming.com.au/images/09d.gif",
"//www.rjmprogramming.com.au/images/09s.gif",
"//www.rjmprogramming.com.au/images/09c.gif",
"//www.rjmprogramming.com.au/images/10h.gif",
"//www.rjmprogramming.com.au/images/10d.gif",
"//www.rjmprogramming.com.au/images/10s.gif",
"//www.rjmprogramming.com.au/images/10c.gif",
"//www.rjmprogramming.com.au/images/11h.gif",
"//www.rjmprogramming.com.au/images/11d.gif",
"//www.rjmprogramming.com.au/images/11s.gif",
"//www.rjmprogramming.com.au/images/11c.gif",
"//www.rjmprogramming.com.au/images/12h.gif",
"//www.rjmprogramming.com.au/images/12d.gif",
"//www.rjmprogramming.com.au/images/12s.gif",
"//www.rjmprogramming.com.au/images/12c.gif",
"//www.rjmprogramming.com.au/images/13h.gif",
"//www.rjmprogramming.com.au/images/13d.gif",
"//www.rjmprogramming.com.au/images/13s.gif",
"//www.rjmprogramming.com.au/images/13c.gif",
"//www.rjmprogramming.com.au/images/01h.gif",
"//www.rjmprogramming.com.au/images/01d.gif",
"//www.rjmprogramming.com.au/images/01s.gif",
"//www.rjmprogramming.com.au/images/01c.gif"
);
function Pot(one) {
this.total=one;
this.GetTotal = function() {
return this.total;
};
this.SetTotal = function(towhat) {
this.total=towhat;
};
this.AddToTotal = function(what) {
this.total+=what;
};
}
function Bid(from, howmuch) {
this.howmuch = howmuch;
this.from = from;
this.CalculateTotal = function(thepot) {
var found=false, thetot=0;
if (thepot == null) {
if (bids[0] == null) {
return 0;
} else {
for (var iy=0; iy<bids.length; iy++) {
thetot+=bids[iy].GetBid();
}
return thetot;
}
} else {
return thepot.GetTotal();
}
thepot.SetTotal=tow;
};
this.GetBid = function() {
return this.howmuch;
};
this.SetPot = function(thepot, tow) {
var found=false;
if (thepot == null) {
try {
eval("found=(bids[0] instanceof Bid);");
} catch(eee) {
found=false;
}
if (!found) {
thepot=this.from;
}
}
thepot.SetTotal=tow;
};
this.AddToPot = function(thepot, wh) {
var found=false;
if (thepot == null) {
try {
eval("found=(bids[0] instanceof Bid);");
} catch(eee) {
found=false;
}
if (!found) {
thepot=this.from;
}
}
thepot.AddToTotal+=wh;
};
}
function Player(fullname) {
this.fullname = fullname;
this.num=theplayers.length;
this.score=0;
this.goes=0;
this.chosenottobid=false;
this.madebid=false;
this.cardtotal=0;
this.cards = new Array();
this.Bid = function(thepot, what) {
var found=false;
if (thepot == null) {
try {
eval("found=(pots[0] instanceof Pot);");
} catch(eee) {
found=false;
}
if (!found) {
pots[0]=new Pot(what);
thepot=pots[0];
this.madebid=true;
}
} else {
this.madebid=true;
thepot.AddToTotal(what);
}
};
this.SetAsNonBidder = function() {
this.chosenottobid = true;
};
this.SetAsBidder = function() {
this.madebid = true;
};
this.UnsetAsBidder = function() {
this.madebid = false;
this.chosenottobid = false;
};
this.AmBidder = function() {
return this.madebid;
};
this.AmNoBidder = function() {
return this.chosenottobid;
};
this.SetNoBidder = function() {
this.chosenottobid = true;
};
this.SetTotal = function(theplayer, tow) {
var found=false;
if (thepot == null) {
try {
eval("found=(pots[0] instanceof Pot);");
} catch(eee) {
found=false;
}
if (!found) {
pots[0]=new Pot(tow);
thepot=pots[0];
}
} else {
thepot.SetTotal(tow);
}
};
this.SetFullname = function(fn) {
this.fullname = fn;
};
this.GetFullname = function() {
return this.fullname;
};
this.GetCardTotal = function() {
return this.cardtotal;
};
this.SetScore = function(addthis) {
if (addthis != 0) {
var found=false;
if (pots[0] == null) {
try {
eval("found=(bids[0] instanceof Bid);");
} catch(eee) {
found=false;
}
if (found) {
addthis=bids[0].CalculateTotal(pots[0]);
}
} else {
addthis=pots[0].GetTotal();
}
}
this.score+=addthis;
};
this.SetGoes = function(addthis) {
this.goes+=addthis;
document.getElementById('score' + eval(1 + this.num)).innerHTML='Score: ' + this.score + '/' + this.goes;
};
this.SetCardTotal = function(addthis) {
//if (eval('' + addthis) == 0) alert(this.cardtotal);
this.cardtotal+=addthis;
};
this.Reset = function(aheap) {
for (var ju=0; ju<this.cards.length; ju++) {
aheap.Addone(this.cards[ju]);
}
pots=[null];
bids=[null];
this.cardtotal=0;
this.cards = new Array();
document.getElementById('td' + eval(1 + this.num)).innerHTML=origtd.replace(/1/g,'' + eval(1 + this.num));
};
}
function Heap() {
this.cardat = 0;
this.cardpile = new Array();
this.Addone = function(onecard) {
this.cardpile.push(onecard);
};
this.Redeal = function(playerarr, numperplayer, apack) {
//for (var ju=0; ju<playerarr.length; ju++) {
// playerarr[ju].Reset(ourheap);
//}
var startat=0;
var howmany=this.cardpile.length;
if (numperplayer > 0) howmany=eval(this.cardat + playerarr.length * numperplayer);
for (var iu=this.cardat; iu<howmany; iu++) {
playerarr[startat].cards.push(this.cardpile[iu]);
playerarr[startat].SetCardTotal(playerarr[startat].cards[eval(-1 + playerarr[startat].cards.length)].ScorePontoon(playerarr[startat].GetCardTotal()));
document.getElementById('mydiv' + eval(1 + startat)).innerHTML+='<img style=visibility:hidden; id=i_' + eval(1 + startat) + '_' + Math.floor(Math.random() * 123456) + ' src=' + apack.GetNameImageUrl(this.cardpile[iu].GetName()) + '></img>';
startat++;
if (startat >= playerarr.length) startat=0;
}
this.cardat=howmany;
};
this.Another = function(apack,playerarr,playernum) {
playerarr[playernum].cards.push(this.cardpile[this.cardat]);
playerarr[playernum].SetCardTotal(playerarr[playernum].cards[eval(-1 + playerarr[playernum].cards.length)].ScorePontoon(playerarr[playernum].GetCardTotal()));
document.getElementById('mydiv' + eval(1 + playernum)).innerHTML+='<img id=i_' + eval(1 + playernum) + '_' + Math.floor(Math.random() * 123456) + ' src=' + apack.GetNameImageUrl(this.cardpile[this.cardat].GetName()) + '></img>';
this.cardat++;
};
}
function Pack(names, imageurls, shuffle, startwith) {
if (names.length == 0) {
if (shuffle) {
var sofar=',', ii;
var choice=Math.floor(Math.random() * cardsinpack.length);
var firstchoice=choice;
for (ii=0; ii<cardsinpack.length; ii++) {
while (sofar.indexOf(',' + cardsinpack[choice] + ',') != -1) {
choice=Math.floor(Math.random() * cardsinpack.length);
}
eval("names.push(new " + cardsinpack[choice] + "('" + cardsinpack[choice] + "'));");
imageurls.push(mypictures[choice]);
sofar+=(cardsinpack[choice] + ',');
choice=firstchoice;
}
} else {
for (ii=0; ii<cardsinpack.length; ii++) {
eval("names.push(new " + cardsinpack[ii] + "('" + cardsinpack[ii] + "'));");
imageurls.push(mypictures[ii]);
}
}
}
this.names = names;
this.imageurls = imageurls;
this.startwith = startwith;
this.GetNameImageUrl = function(acardname) {
for (var ip=0; ip<this.names.length; ip++) {
if (acardname == this.names[ip].GetName()) return this.imageurls[ip];
}
return '';
};
this.Deal = function(playerarr, numperplayer) {
var startat=0;
var howmany=this.names.length;
if (numperplayer > 0) howmany=eval(playerarr.length * numperplayer);
for (var iu=0; iu<howmany; iu++) {
playerarr[startat].cards.push(this.names[iu]);
playerarr[startat].SetCardTotal(playerarr[startat].cards[eval(-1 + playerarr[startat].cards.length)].ScorePontoon(playerarr[startat].GetCardTotal()));
document.getElementById('mydiv' + eval(1 + startat)).innerHTML+='<img style=visibility:hidden; id=i_' + eval(1 + startat) + '_' + iu + ' src=' + this.imageurls[iu] + '></img>';
startat++;
if (startat >= playerarr.length) startat=0;
}
for (var iiu=howmany; iiu<this.names.length; iiu++) {
ourheap.Addone(this.names[iiu]);
}
};
}
function Card(name) {
this.name = name;
this.GetName = function() {
return this.name;
};
this.ScorePontoon = function(scoresofar) {
if (this.name.toLowerCase().indexOf('ace') != -1 && scoresofar > 10) {
return 1;
} else if (this.name.toLowerCase().indexOf('ace') != -1) {
return 11;
} else if (this.name.toLowerCase().indexOf('king') != -1) {
return 10;
} else if (this.name.toLowerCase().indexOf('queen') != -1) {
return 10;
} else if (this.name.toLowerCase().indexOf('jack') != -1) {
return 10;
} else if (this.name.toLowerCase().indexOf('ten') != -1) {
return 10;
} else if (this.name.toLowerCase().indexOf('nine') != -1) {
return 9;
} else if (this.name.toLowerCase().indexOf('eight') != -1) {
return 8;
} else if (this.name.toLowerCase().indexOf('seven') != -1) {
return 7;
} else if (this.name.toLowerCase().indexOf('six') != -1) {
return 6;
} else if (this.name.toLowerCase().indexOf('five') != -1) {
return 5;
} else if (this.name.toLowerCase().indexOf('four') != -1) {
return 4;
} else if (this.name.toLowerCase().indexOf('three') != -1) {
return 3;
} else if (this.name.toLowerCase().indexOf('two') != -1) {
return 2;
}
};
this.IsPicture = function() {
if (this.name.toLowerCase().indexOf('ace') != -1) {
return 4;
} else if (this.name.toLowerCase().indexOf('king') != -1) {
return 3;
} else if (this.name.toLowerCase().indexOf('queen') != -1) {
return 2;
} else if (this.name.toLowerCase().indexOf('jack') != -1) {
return 1;
}
return 0;
};
this.IsBlack = function() {
if (this.name.toLowerCase().replace('spades','clubs').indexOf('clubs') != -1) {
return true;
}
return false;
};
this.IsRed = function() {
if (this.name.toLowerCase().replace('hearts','diamonds').indexOf('diamonds') != -1) {
return true;
}
return false;
};
}
function TwoOfHearts(name) {
Card.call(this, name);
}
function TwoOfDiamonds(name) {
Card.call(this, name);
}
function TwoOfSpades(name) {
Card.call(this, name);
}
function TwoOfClubs(name) {
Card.call(this, name);
}
function ThreeOfHearts(name) {
Card.call(this, name);
}
function ThreeOfDiamonds(name) {
Card.call(this, name);
}
function ThreeOfSpades(name) {
Card.call(this, name);
}
function ThreeOfClubs(name) {
Card.call(this, name);
}
function FourOfHearts(name) {
Card.call(this, name);
}
function FourOfDiamonds(name) {
Card.call(this, name);
}
function FourOfSpades(name) {
Card.call(this, name);
}
function FourOfClubs(name) {
Card.call(this, name);
}
function FiveOfHearts(name) {
Card.call(this, name);
}
function FiveOfDiamonds(name) {
Card.call(this, name);
}
function FiveOfSpades(name) {
Card.call(this, name);
}
function FiveOfClubs(name) {
Card.call(this, name);
}
function SixOfHearts(name) {
Card.call(this, name);
}
function SixOfDiamonds(name) {
Card.call(this, name);
}
function SixOfSpades(name) {
Card.call(this, name);
}
function SixOfClubs(name) {
Card.call(this, name);
}
function SevenOfHearts(name) {
Card.call(this, name);
}
function SevenOfDiamonds(name) {
Card.call(this, name);
}
function SevenOfSpades(name) {
Card.call(this, name);
}
function SevenOfClubs(name) {
Card.call(this, name);
}
function EightOfHearts(name) {
Card.call(this, name);
}
function EightOfDiamonds(name) {
Card.call(this, name);
}
function EightOfSpades(name) {
Card.call(this, name);
}
function EightOfClubs(name) {
Card.call(this, name);
}
function NineOfHearts(name) {
Card.call(this, name);
}
function NineOfDiamonds(name) {
Card.call(this, name);
}
function NineOfSpades(name) {
Card.call(this, name);
}
function NineOfClubs(name) {
Card.call(this, name);
}
function TenOfHearts(name) {
Card.call(this, name);
}
function TenOfDiamonds(name) {
Card.call(this, name);
}
function TenOfSpades(name) {
Card.call(this, name);
}
function TenOfClubs(name) {
Card.call(this, name);
}
function JackOfHearts(name) {
Card.call(this, name);
}
function JackOfDiamonds(name) {
Card.call(this, name);
}
function JackOfSpades(name) {
Card.call(this, name);
}
function JackOfClubs(name) {
Card.call(this, name);
}
function QueenOfHearts(name) {
Card.call(this, name);
}
function QueenOfDiamonds(name) {
Card.call(this, name);
}
function QueenOfSpades(name) {
Card.call(this, name);
}
function QueenOfClubs(name) {
Card.call(this, name);
}
function KingOfHearts(name) {
Card.call(this, name);
}
function KingOfDiamonds(name) {
Card.call(this, name);
}
function KingOfSpades(name) {
Card.call(this, name);
}
function KingOfClubs(name) {
Card.call(this, name);
}
function AceOfHearts(name) {
Card.call(this, name);
}
function AceOfDiamonds(name) {
Card.call(this, name);
}
function AceOfSpades(name) {
Card.call(this, name);
}
function AceOfClubs(name) {
Card.call(this, name);
}
function ol() {
document.getElementById('mynums').value='' + numplayers;
var startat=0, found=true;
var origth=document.getElementById('th1').innerHTML;
origtd=document.getElementById('td1').innerHTML;
for (var iii=1; iii<=numplayers; iii++) {
if (iii > 2) {
document.getElementById('tr1').innerHTML+='<th style=display:inline-cell;>' + origth.replace(/1/g,'' + iii) + '</th>';
document.getElementById('tr2').innerHTML+='<td style=display:inline-cell; id=td' + iii + '>' + origtd.replace(/1/g,'' + iii) + '</td>';
}
theplayers.push(new Player('Player' + iii));
}
ourpack=new Pack(anarray,aniarray,true,startwith);
ourheap=new Heap();
ourpack.Deal(theplayers,2); // for pontoon vs 0);
for (var iiii=0; iiii<numplayers; iiii++) {
theplayers[iiii].SetCardTotal(0);
}
}
function bidfor(nump, islast) {
var hm=null,ca, iiii;
if (!islast) {
if (pots[0] == null) {
hm=prompt(theplayers[eval(0 + nump)].GetFullname() + ", what's your bid?", "1");
} else if ("we_like_verb_bid" == "we_like_verb_bid" || 1 == 1) {
if (theplayers[eval(0 + nump)].AmBidder() == false && theplayers[eval(0 + nump)].AmNoBidder() == false) {
ca=confirm(theplayers[eval(0 + nump)].GetFullname() + ", do you agree to see the earlier bid of " + eval(pots[0].GetTotal() / numplayers) + "?");
if (ca == true) {
theplayers[eval(0 + nump)].SetAsBidder();
} else {
theplayers[eval(0 + nump)].SetAsNonBidder();
}
}
}
} else if ("we_like_verb_bid" == "we_like_verb_bid" || 1 == 1) {
if (pots[0]) {
var ims=document.getElementsByTagName('img');
for (var ifw=0; ifw<ims.length; ifw++) {
ims[ifw].style.visibility='hidden';
}
for (iiii=0; iiii<numplayers; iiii++) {
if (theplayers[iiii].AmBidder() == false && theplayers[iiii].AmNoBidder() == false) {
ca=confirm(theplayers[iiii].GetFullname() + ", do you agree to see the earlier bid of " + eval(pots[0].GetTotal() / numplayers) + "?");
if (ca == true) {
theplayers[iiii].SetAsBidder();
} else {
theplayers[iiii].SetAsNonBidder();
}
}
}
}
}
if (hm != null) {
if ("we_like_verb_bid" == "we_like_verb_bid") { // Player "verb" bidding approach
theplayers[eval(0 + nump)].Bid(pots[0], eval(eval('' + hm) * numplayers));
theplayers[eval(0 + nump)].SetAsBidder();
//alert('' + nump + ' is ' + theplayers[nump].AmBidder());
} else { // Bid "noun" bidding approach
if (bids.length == 1) {
if (bids[0] == null) {
bids[0] = new Bid(theplayers[eval(0 + nump)].GetFullname(), eval('' + hm));
} else {
bids[0] = new Bid(theplayers[eval(0 + nump)].GetFullname(), eval('' + hm));
}
theplayers[eval(0 + nump)].SetAsBidder();
} else {
bids.push(new Bid(theplayers[eval(0 + nump)].GetFullname(), eval('' + hm)));
theplayers[eval(0 + nump)].SetAsBidder();
}
if (!pots[0]) pots[0] = new Pot(eval(eval('' + hm) * numplayers));
}
}
}
function lockedin(nump) {
gnump=nump;
if (document.getElementById('tinstructions').innerHTML.indexOf(theplayers[nump].GetFullname() + ' is locked in.') == -1) {
document.getElementById('tinstructions').innerHTML+=theplayers[nump].GetFullname() + ' is locked in.';
document.getElementById('mydiv' + eval(1 + nump)).style.display='none';
if (document.getElementById('tinstructions').innerHTML.split('<br>').length < numplayers) {
document.getElementById('tinstructions').innerHTML+='<br>';
} else {
var ims=document.getElementsByTagName('img');
for (ifw=0; ifw<ims.length; ifw++) {
ims[ifw].style.visibility='hidden';
}
setTimeout(postlockedin,500);
}
}
}
function postlockedin() {
var nump=gnump;
var ifw;
var ims=document.getElementsByTagName('img');
for (ifw=0; ifw<ims.length; ifw++) {
ims[ifw].style.visibility='hidden';
}
bidfor(nump,true);
for (ifw=0; ifw<ims.length; ifw++) {
ims[ifw].style.visibility='visible';
}
huh='No winners on this round.', huhd='';
var winner=-1, winningscore=-1;
for (var iiii=0; iiii<numplayers; iiii++) {
document.getElementById('mydiv' + eval(1 + iiii)).style.display='block';
if (theplayers[iiii].GetCardTotal() > 21) {
theplayers[iiii].SetCardTotal(-999);
}
}
for (var iii=0; iii<numplayers; iii++) {
if (theplayers[iii].GetCardTotal() >= winningscore) {
huh='Congratulations to';
winningscore=theplayers[iii].GetCardTotal();
}
}
for (var ii=0; ii<numplayers; ii++) {
if (theplayers[ii].GetCardTotal() == winningscore) {
if (theplayers[ii].AmBidder() == true || !pots[0]) {
huh+=huhd + ' ' + theplayers[ii].GetFullname();
huhd=',';
theplayers[ii].SetScore(1);
} else {
huh+=huhd + ' ' + theplayers[ii].GetFullname() + " (except that you did not join the bidding)";
huhd=',';
theplayers[ii].SetScore(0);
}
}
}
for (var i=0; i<numplayers; i++) {
theplayers[i].SetGoes(1);
}
if (1 == 1) {
setTimeout(andthen,2000);
} else {
alert(huh);
for (var i=0; i<numplayers; i++) {
theplayers[i].Reset(ourheap);
}
document.getElementById('tinstructions').innerHTML='';
ourheap.Redeal(theplayers,2,ourpack); // for pontoon vs 0);
}
}
function andprethen() {
var nump=gnump;
}
function andthen() {
var nump=gnump;
alert(huh);
for (var i=0; i<numplayers; i++) {
theplayers[i].Reset(ourheap);
theplayers[i].UnsetAsBidder();
}
document.getElementById('tinstructions').innerHTML='';
ourheap.Redeal(theplayers,2,ourpack); // for pontoon vs 0);
}
function reveal(iwhat) {
var cfw=iwhat.id.replace('ib','');
var ifw,fw='i_' + iwhat.id.replace('ib','') + '_';
var ims=document.getElementsByTagName('img');
if (iwhat.value.indexOf('Reveal') != -1) {
for (ifw=0; ifw<ims.length; ifw++) {
if (ims[ifw].id.indexOf(fw) != -1) ims[ifw].style.visibility='visible';
}
document.getElementById('div' + iwhat.id.replace('ib','')).innerHTML+='<input onclick=ourheap.Another(ourpack,theplayers,' + eval(-1 + eval(iwhat.id.replace('ib',''))) + '); value=Add type=button style=background-color:yellow;></input> <input onclick=bidfor(' + eval(-1 + eval(iwhat.id.replace('ib',''))) + ',false); value=Bid type=button style=background-color:yellow;></input> <input onclick=lockedin(' + eval(-1 + eval(iwhat.id.replace('ib',''))) + '); value=Finished type=button style=background-color:yellow;></input>';
document.getElementById('ib' + cfw).value=document.getElementById('ib' + cfw).value.replace('Reveal','Hide');
//alert(document.getElementById('ib' + cfw).value);
} else {
for (ifw=0; ifw<ims.length; ifw++) {
if (ims[ifw].id.indexOf(fw) != -1) ims[ifw].style.visibility='hidden';
}
iwhat.value=iwhat.value.replace('Hide','Reveal');
}
}
function changen(od) {
var cfw=od.id.replace('dname','');
theplayers[eval(-1 + eval('' + cfw))].SetFullname(od.innerHTML);
}
</script>
</head>
<body onload="ol();">
<h1>Pontoon Card Game <select id=mynums onchange="location.href=document.URL.split('#')[0].split('?')[0] + '?numplayers=' + this.value;"><option value=2>for 2</option><option value=3>for 3</option><option value=4>for 4</option><option value=5>for 5</option><option value=6>for 6</option><option value=7>for 7</option><option value=8>for 8</option><option value=9>for 9</option></select></h1>
<h3>RJM Programming - March, 2018</h3><br>
<table id=mytable style='width:100%' border=50>
<tbody id=mytbody>
<tr id=tr1><th id=th1><div onblur=changen(this); id=dname1 contenteditable=true>Player1</div> <div id=score1>Score: 0/0</div></th><th>Information</th><th><div onblur=changen(this); id=dname2 contenteditable=true>Player2</div> <div id=score2>Score: 0/0</div></th></tr>
<tr id=tr2><td id=td1>
<div id=div1><input type=button onclick=reveal(this); id=ib1 value='Reveal Cards, out of view' style=background-color:yellow;></input></div>
<div id='mydiv1' style='float:left;'></div>
</td><td id=tinstructions></td><td id=td2>
<div id=div2><input type=button onclick=reveal(this); id=ib2 value='Reveal Cards, out of view' style=background-color:yellow;></input></div>
<div id='mydiv2' style='float:left;'></div>
</td></tr>
</tbody>
</table>
</body>
</html>