<html>
<head>
<title>Big Number (Starts at 1/1/1970) Date and Time Guessing via Seconds Since Game - RJM Programming - March, 2022</title>
<style>
input:not([type=button]) { width:10%; background-color:#f0f0f0; }
input[type=button] { background-color:yellow; }
select { background-color:#f0f0f0; }
.spananswer { color: blue; }
.goes { color: purple; }
</style>
<script type='text/javascript'>
var numplayers=location.search.split('numplayers=')[1] ? eval(decodeURIComponent(location.search.split('numplayers=')[1].split('&')[0])) : 1;
var restdone=true;
if (numplayers > 1) { restdone=false; }
var zero=0;
var thecurrentone='';
var im=0;
var dow=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
var dowm=['January','February','March','April','May','June','July','August','September','October','November','December'];
var nts=1970;
var adate = null;
var bdate = null;
var his, mis, sis, daym, monthm, yearm;
var now = new Date();
nts=eval('' + now.getFullYear());
var utcMilllisecondsSinceEpoch = now.getTime() - (now.getTimezoneOffset() * 60 * 1000);
var utcSecondsSinceEpoch = Math.round(utcMilllisecondsSinceEpoch / 1000);
var tzo=(' +' + eval(eval('' + now.getTimezoneOffset()) / 60)).replace('+-', '-');
var score=[eval(73000 * 24 * 60 * 60)];
var goes=[0];
var tz=['GMT'];
var blurb='';
var myr=[eval(Math.floor(Math.random() * 56) + 1)];
nts++;
for (im=0; im<myr[0]; im++) {
nts++;
utcSecondsSinceEpoch+=eval(24 * 60 * 60);
}
var myantiguess=[eval(Math.floor(Math.random() * utcSecondsSinceEpoch) + 0)];
for (im=1; im<numplayers; im++) {
score.push(score[0]);
goes.push(goes[0]);
myr.push(myr[0]);
tz.push(tz[0]);
myantiguess.push(eval(Math.floor(Math.random() * utcSecondsSinceEpoch) + 0));
}
var reducedval=-1;
var reducedvalblurb='';
var tzn=('' + Intl.DateTimeFormat().resolvedOptions().timeZone).replace(/^undefined$/g,'').replace(/^null$/g,'')
function display() {
document.getElementById('score' + thecurrentone).innerHTML='' + score[zero];
document.getElementById('goes' + thecurrentone).innerHTML='' + goes[zero];
//alert('' + myantiguess);
document.getElementById('spananswer' + thecurrentone).innerHTML='' + myantiguess[zero];
adate=new Date(eval(eval('' + myantiguess[zero]) * 1000));
yearm=eval('' + adate.getFullYear());
monthm=dowm[eval(0 + eval('' + adate.getMonth()))];
daym=eval(0 + eval('' + adate.getDate()));
his=eval('' + adate.getHours());
mis=eval('' + adate.getMinutes());
sis=eval('' + adate.getSeconds());
//blurb='';
//document.getElementById('asp').title='';
if (!restdone) { restdone=true; dorest(); }
}
function dorest() {
var ccellone=document.getElementById('cell1').innerHTML;
var acellarr=ccellone.split(' id="');
var newtdis=acellarr[0];
document.getElementById('mythead').innerHTML+='<tr id=row0><th><div id=div1 contenteditable=true>Player 1</div></th></tr>';
for (var ii=2; ii<=numplayers; ii++) {
for (var jj=1; jj<acellarr.length; jj++) {
newtdis+=' id="' + acellarr[jj].split('"')[0] + ii + acellarr[jj].replace(acellarr[jj].split('"')[0], '');
}
document.getElementById('mythead').innerHTML=document.getElementById('mythead').innerHTML.replace('</tr>','<th><div id=div' + ii + ' contenteditable=true>Player ' + ii + '</div></th></tr>');
document.getElementById('row1').innerHTML+='<td id=cell' + ii + '>' + newtdis + '</td>';
document.getElementById('spananswer' + ii).innerHTML='' + myantiguess[eval(-1 + ii)];
newtdis=acellarr[0];
}
}
function reduce(invl) {
var retval=0, ij=0;
var cinvl='' + invl;
var xcinvl='';
for (ij=0; ij<cinvl.length; ij++) {
if (cinvl.substring(ij).substring(0,1) != '-') {
retval+=eval(cinvl.substring(ij).substring(0,1));
}
}
xcinvl='' + retval;
while (xcinvl.length > 1) {
retval=0;
for (ij=0; ij<xcinvl.length; ij++) {
if (xcinvl.substring(ij).substring(0,1) != '-') {
retval+=eval(xcinvl.substring(ij).substring(0,1));
}
}
xcinvl='' + retval;
}
reducedval=retval;
reducedvalblurb=' If date you entered represents a birthdate(time) (GMT?) please know the ' + invl + ' numerical date equivalent reduces to a ' + reducedval + ' lucky number for that person. ';
return retval;
}
function checkanswer(buto) {
zero=0;
thecurrentone=('' + buto.id).replace('mybut','');
if (thecurrentone != '') { zero=eval(-1 + eval('' + thecurrentone)); }
adate=new Date(eval(eval('' + myantiguess[zero]) * 1000));
yearm=eval('' + adate.getFullYear());
monthm=dowm[eval(0 + eval('' + adate.getMonth()))];
daym=eval(0 + eval('' + adate.getDate()));
his=eval('' + adate.getHours());
mis=eval('' + adate.getMinutes());
sis=eval('' + adate.getSeconds());
document.getElementById('asp').title='Best answer to ' + myantiguess[zero] + ' seconds since 1/1/1970 was what date';
var bdate = new Date(document.getElementById('syear' + thecurrentone).value, eval(-1 + eval('' + document.getElementById('smonth' + thecurrentone).value)), document.getElementById('sday' + thecurrentone).value, document.getElementById('shour' + thecurrentone).value, document.getElementById('sminute' + thecurrentone).value, document.getElementById('ssecond' + thecurrentone).value);
var butcMilllisecondsSinceEpoch = bdate.getTime(); // - (bdate.getTimezoneOffset() * 60 * 1000); // + (bdate.getTimezoneOffset() * 60 * 1000);
if (tz[zero] == 'GMT') {
butcMilllisecondsSinceEpoch-=(bdate.getTimezoneOffset() * 60 * 1000);
}
reduce(butcMilllisecondsSinceEpoch);
var butcSecondsSinceEpoch = Math.round(butcMilllisecondsSinceEpoch / 1000);
blurb = 'Perfect last answer for ' + myantiguess[zero] + ' was ' + ('0' + daym).slice(-2) + '/' + monthm + '/' + yearm + ' ' + ('0' + his).slice(-2) + ':' + ('0' + mis).slice(-2) + ':' + ('0' + sis).slice(-2) + ' GMT whereas you lost ' + Math.abs(eval(eval(butcSecondsSinceEpoch) - eval(myantiguess[zero]))) + ' points with your answer. ' + reducedvalblurb.replace('numerical date', 'numerical ' + document.getElementById('sday' + thecurrentone).value + '/' + dowm[eval(-1 + eval('' + document.getElementById('smonth' + thecurrentone).value))] + '/' + document.getElementById('syear' + thecurrentone).value + ' ' + document.getElementById('shour' + thecurrentone).value + ':' + document.getElementById('sminute' + thecurrentone).value + ':' + document.getElementById('ssecond' + thecurrentone).value + ' ' + document.getElementById('sgmt' + thecurrentone).innerHTML + ' date');
if (('' + score[zero]).indexOf('-') == -1) {
goes[zero]++;
} else if (eval('' + goes[zero]) >= 0.0000001) {
goes[zero]-=0.0000001;
} else {
goes[zero]+=0.0000001;
}
score[zero]-=Math.abs(eval(eval(butcSecondsSinceEpoch) - eval(myantiguess[zero])));
document.getElementById('score' + thecurrentone).innerHTML='' + score[zero];
document.getElementById('goes' + thecurrentone).innerHTML='' + goes[zero];
if (document.getElementById('score' + thecurrentone).innerHTML.replace(/^0$/g,'-1').indexOf('-') != -1) {
if (numplayers == 1) {
alert('You survived until go number ' + goes[zero]);
location.href=document.URL;
}
} else {
myantiguess[zero]=eval(Math.floor(Math.random() * utcSecondsSinceEpoch) + 0);
display();
}
}
function showperfect() {
if (blurb != '') {
alert(blurb);
}
}
function fixitzero(iniis, imin, imax) {
var minustwo=-2;
var premin='0';
if (('' + imin).length == 4) {
minustwo=-4;
premin='';
}
if (iniis.value.length == 1) {
if ((premin + iniis.value) >= (premin + imin).slice(minustwo) && (premin + iniis.value) <= (premin + imax).slice(minustwo)) {
iniis.value=premin + iniis.value;
} else {
iniis.value=(premin + imin).slice(-4);
}
} else if (iniis.value.length == eval(0 - eval('' + minustwo))) {
if (('' + iniis.value) >= (premin + imin).slice(minustwo) && ('' + iniis.value) <= (premin + imax).slice(minustwo)) {
iniis.value='' + iniis.value;
} else {
iniis.value=(premin + imin).slice(-4);
}
} else {
iniis.value=(premin + imin).slice(-4);
}
}
function startcalculatory(spano) {
zero=0;
thecurrentone=('' + spano.id).replace('spananswer','');
if (thecurrentone != '') { zero=eval(-1 + eval('' + thecurrentone)); }
document.getElementById('icalculator' + thecurrentone).style.display='block';
document.getElementById('icalculator' + thecurrentone).src=document.getElementById('icalculator' + thecurrentone).src.split('#')[0].split('?')[0] + '?clientfirstnum=' + spano.innerHTML + '&clientoper=' + encodeURIComponent('/') + '&clientsecnum=' + eval(24 * 60 * 60 * 365.25) + '.0#firstnum';
}
function startcalculatord(spano) {
zero=0;
thecurrentone=('' + spano.id).replace('spananswer','');
if (thecurrentone != '') { zero=eval(-1 + eval('' + thecurrentone)); }
document.getElementById('icalculator' + thecurrentone).style.display='block';
document.getElementById('icalculator' + thecurrentone).src=document.getElementById('icalculator' + thecurrentone).src.split('#')[0].split('?')[0] + '?clientfirstnum=' + spano.innerHTML + '&clientoper=' + encodeURIComponent('/') + '&clientsecnum=' + eval(24 * 60 * 60) + '.0#firstnum';
}
function tzit(selo) {
zero=0;
thecurrentone=('' + selo.id).replace('seltz','');
if (thecurrentone != '') { zero=eval(-1 + eval('' + thecurrentone)); }
tz[zero]='' + selo.value;
if (selo.value == 'GMT') {
document.getElementById('sgmt' + thecurrentone).innerHTML=selo.value;
document.getElementById('tspec' + thecurrentone).innerHTML='';
} else {
if (tzn != '') {
document.getElementById('sgmt' + thecurrentone).innerHTML=tzn;
} else {
document.getElementById('sgmt' + thecurrentone).innerHTML=selo.value;
}
document.getElementById('tspec' + thecurrentone).innerHTML=' GMT';
}
}
</script>
</head>
<body onload="document.getElementById('inumplayers').value='' + numplayers; document.getElementById('olocal').value+=tzo; document.getElementById('olocal').innerHTML+=tzo; display();">
<h1>Big Number (Starts at 1/1/1970) Date and Time Guessing via Seconds Since Game for <input id=inumplayers style=display:inline-block;width:35px; type=number step=1 min=1 max=9 onblur="if (eval(this.value) > 1 || document.URL.indexOf('numplayers=') != -1) { location.href=document.URL.split('#')[0].split('?')[0] + '?numplayers=' + this.value; }" value=1></input> Player(s)</h1>
<h3>RJM Programming <a style=cursor:pointer;text-decoration:underline; onclick=showperfect(); title='Best answer to ? seconds since 1/1/1970 was ...' id=asp>-</a> March, 2022</h3>
<table id=outertable><thead id=mythead></thead><tbody id=mytbody><tr id=row1><td id=cell1>
<table border=20>
<tr><th id=thscore>Points left: <span class=score id=score></span> Survival count: <span class=goes id=goes></span></th></tr>
<tr><th id=secanswer>Seconds since 1/1/1970<span id=tspec></span>: <span title='Click for year count calculator and double click for day count calculator' onclick=startcalculatory(this); ondblclick=startcalculatord(this); style=cursor:pointer;text-decoration:none; class=spananswer id=spananswer></span> ... try to match <span id=sgmt>GMT</span> datetime closely below, else lose points</th></tr>
<tr><td style=text-align:center;><br><form>
<input style=display:inline-block;min-width:28px; onblur=fixitzero(this,1,31); onchange=fixitzero(this,1,31); type="text" title="Date" id="sday" name="sday" value="01"></input>/<select style=display:inline-block; id="smonth" name="smonth" title="Month"><option value="01">January</option><option value="02">February</option><option value="03">March</option><option value="04">April</option><option value="05">May</option><option value="06">June</option><option value="07">July</option><option value="08">August</option><option value="09">September</option><option value="10">October</option><option value="11">November</option><option value="12">December</option></select>/<input style=display:inline-block;min-width:55px; onblur=fixitzero(this,1970,nts); onchange=fixitzero(this,1970,nts); step=1 min=1970 type="number" id="syear" name="syear" value="1970" title="Year"></input> <input onblur=fixitzero(this,0,23); onchange=fixitzero(this,0,23); style=display:inline-block;min-width:28px; type="text" id="shour" name="shour" value="00" title="Hours"></input>:<input onblur=fixitzero(this,0,59); onchange=fixitzero(this,0,59); title="Minutes" style=display:inline-block;min-width:28px; type="text" id="sminute" name="sminute" value="00"></input>:<input onblur=fixitzero(this,0,59); onchange=fixitzero(this,0,59); title="Seconds" style=display:inline-block;min-width:28px; type="text" id="ssecond" name="ssecond" value="00"></input><span> <select style=display:inline-block; id=seltz onchange=tzit(this);><option value=GMT>GMT</option><option id=olocal value=Local>Local</option></select></span><br>
</form><br></td></tr>
<tr><td style=text-align:center;><br><input class=mybut id=mybut type=button onclick=checkanswer(this); value='Check my Datetime Above'></input><br><br><iframe style=display:none; id=icalculator src='/PHP/calculator.php' style='width:100%;height:200px;'></iframe></td></tr>
</table>
</td></tr></tbody></table>
</body>
</html>