<!doctype html>
<html>
<head>
<title>Who Am I Game - RJM Programming - July, 2018</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="author" content="jQuery Foundation - jquery.org">
<meta name="description" content="jQuery: The Write Less, Do More, JavaScript Library">
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" href="//api.jquery.com/jquery-wp-content/themes/api.jquery.com/i/favicon.ico">
<link rel="stylesheet" href="//api.jquery.com/jquery-wp-content/themes/jquery/css/base.css?v=1">
<link rel="stylesheet" href="//api.jquery.com/jquery-wp-content/themes/api.jquery.com/style.css">
<link rel="pingback" href="//api.jquery.com/xmlrpc.php" />
<!--[if lt IE 7]><link rel="stylesheet" href="css/font-awesome-ie7.min.css"><![endif]-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write(unescape('%3Cscript src="//api.jquery.com/jquery-wp-content/themes/jquery/js/jquery-1.9.1.min.js"%3E%3C/script%3E'))</script>
<script src="//api.jquery.com/jquery-wp-content/themes/jquery/js/plugins.js"></script>
<script src="//api.jquery.com/jquery-wp-content/themes/jquery/js/main.js"></script>
<script src="//use.typekit.net/wde1aof.js"></script>
<script>try{Typekit.load();}catch(e){}</script>
<script type='text/javascript' src='//api.jquery.com/wp-includes/js/comment-reply.min.js?ver=3.8'></script>
<script type='text/javascript'>
var onemoreclue='';
var z=1;
var clues=[
["Am a woman.", "I was born in 1938.","My job was as an actress.","I was a child star.","I gave birth to two children.","Those children were from different husbands.","I died in 1981.","I drowned in mysterious circumstances.","My birth name was Natalia Nikolaevna Zakharenko.","My name is Natalie Wood."],
["Am a woman.", "I was born in 1937.","I have been a politician.","I was born in the Czech Republic.","I have three children.","I emigrated to the United States in 1948.","I was first woman to have become the United States Secretary of State.","My middle names are Jana Korbel.","My name is Madeline Albright."],
["Am a man.", "I was born in 1869.","I have been a politician and studied law at the Inner Temple, London.","I had four children.","I was the leader of the Indian independence movement against British rule.","I was born and raised in a Hindu merchant caste family in coastal Gujarat, India.","I was assassinated in 1948.","My birth name was Mohandas Karamchand Gandhi.","My name is Mahatma Gandhi."],
["Am a man.", "I was born in 1879.","I was a scientist, a theoretical physicist.","I had three children.","I developed a principle of relativity.","From 1902 to 1909 I worked at the Swiss Patent Office in Bern, Switzerland.","I died in 1955 in the United States of America.","I received the 1921 Nobel Prize in Physics.","My name is Albert Einstein."]
];
var solved=false;
var ourset;
var iourset=0, jourset=0, kourset=0;
var score=0, goes=0, two=2;
var asguess=true;
var addto='origsnake1';
function get_wikipedia_information(about) {
if (about.trim() != '') {
var dp=document.URL.split(":")[0] + ":" + "//en.wikipedia.org/wiki/", dul=document.URL;
if (dul.indexOf(':') == -1) dp="//en.wikipedia.org/wiki/"; // Nelson_Mandela
var dpp=document.URL.split(":")[0] + "://www.rjmprogramming.com.au/MarkItUp/upload_audio.php?tpg=y&score=" + score + '&goes=' + goes + '&mediafile=' + encodeURIComponent(dp + about.replace(/\ /g,'_')) + '#';
$.ajax({ url: dpp + about.replace(/\ /g,'_'),
type: 'get',
success: function(output) {
var sa=0,pref='',cluetwo,versus, aclue='' + document.URL.split('#')[0].split('?')[0] + "?tpg=y&score=" + score + '&goes=' + goes + '&clue=' + encodeURIComponent('[]');
var findthis=[' class="bday">','>Children<','>Died<',' class="nickname">'];
var exclude=['','<td>','<td>',''];
var startthis=['','>','>',''];
var endthis=['-',' ','-','<'];
var startwith=["I was born in ","The number of children's ","I died in ","My birth name's "];
for (var ii=0; ii<findthis.length; ii++) {
cluetwo=output.split(findthis[ii]);
if (cluetwo.length > 1) {
versus=cluetwo[1];
if (exclude[ii] != '') versus=versus.replace(exclude[ii],'');
versus=versus.replace('"','').replace('(','');
if (startwith[ii] != '') {
cluetwo=versus.split(startwith[ii]);
if (cluetwo.length > 1) versus=cluetwo[1];
}
cluetwo=versus.split(endthis[ii]);
sa=0;
if (cluetwo[0].split('<')[0].replace('/th>','').replace(String.fromCharCode(10),'') != '') {
while (cluetwo[0].split('<')[0].replace('/th>','').replace(String.fromCharCode(10),'').substring(sa,eval(1 + sa)) < '0') {
sa++;
}
}
if (cluetwo.length >= 1) {
aclue=aclue.replace(encodeURIComponent(']'), encodeURIComponent(pref + '"' + startwith[ii] + cluetwo[0].split('<')[0].replace('/th>','').replace(String.fromCharCode(10),'') + '."').replace(String.fromCharCode(10),'').substring(sa) + encodeURIComponent(']'));
pref=',';
}
}
}
var xpref='<iframe style';
xpref+='="position:absolute;top:0px;left:0px;width:100%;height:100vh;z-index:' + eval(1 + z) + ';" src="';
xpref+=aclue;
xpref+='"></iframe>';
//alert(xpref);
document.getElementById('dtop').style.opacity='0.0';
document.getElementById('doverlay').innerHTML=xpref;
}
});
}
}
function guessas() {
var myguess=prompt('What is your guess for a first name and last name for this person (no initials please)?','');
if (myguess == null) myguess='';
if (myguess.trim() != '' && myguess.split(' ').length == 2) {
goes++;
//alert((clues[iourset][eval(-1 + kourset)] + '~').toLowerCase() + ' ... ' + ' ' + myguess.toLowerCase() + '.~');
if ((clues[iourset][eval(-1 + kourset)] + '~').toLowerCase().indexOf(' ' + myguess.toLowerCase() + '.~') != -1) {
asguess=false;
score+=Math.pow(2,kourset);
//alert('' + jourset + ' ... ' + score);
two=0;
document.getElementById(addto).click();
//alert(score);
}
document.getElementById('score').innerHTML='Score: ' + score + '/' + goes;
pickclueset();
} else {
goes++;
document.getElementById('score').innerHTML='Score: ' + score + '/' + goes;
}
}
function addthis(inputo) {
var nextto=eval(1 + eval(addto.replace('origsnake','')));
// Snake ...
// <a id='origsnake1' onclick="show('tdsnake',this);">Snake ... </a>
document.getElementById(addto).innerHTML+="</a><a title='Show me' style='text-decoration:underline;cursor:pointer;' id='origsnake" + nextto + "' onclick=\"show('tdsnake',this);\">" + inputo.value.replace(' ... ','').replace(' ...','').replace('...','') + " ... ";
addto='origsnake' + nextto;
}
function show(supervisor,curo) {
//alert("This innerHTML=" + curo.innerHTML + " and the overall table cell innerHTML=" + document.getElementById(supervisor).innerHTML);
if (two == 0) {
score-=Math.pow(2,jourset);
//alert('' + jourset + ' .+. ' + score);
jourset--;
} else {
score-=2;
guessas();
}
}
function pickclueset() {
var mourset=-1;
if (onemoreclue != '') {
score=location.search.split('score=')[1] ? eval(location.search.split('score=')[1].split('&')[0]) : 0;
goes=location.search.split('goes=')[1] ? eval(location.search.split('goes=')[1].split('&')[0]) : 0;
z=location.search.split('z=')[1] ? eval(location.search.split('z=')[1].split('&')[0]) : 1;
document.getElementById('score').innerHTML='Score: ' + score + '/' + goes;
if (parent.document) {
if (parent.document.getElementById('wname')) {
var rws=parent.document.getElementById('wname').value.split(' ');
var rwith=',"My name is ' + rws[0].substring(0,1).toUpperCase() + (rws[0] + " ").substring(1).toLowerCase().trim();
for (var irw=1; irw<rws.length; irw++) {
rwith+=" " + rws[irw].substring(0,1).toUpperCase() + (rws[irw] + " ").substring(1).toLowerCase().trim();
}
onemoreclue=onemoreclue.replace(']',rwith + '."]');
}
}
mourset=clues.length;
//alert('' + mourset);
//alert('' + ' ... ' + onemoreclue);
clues[clues.length]=eval(onemoreclue);
onemoreclue='';
iourset=mourset;
} else {
iourset=Math.floor(Math.random() * clues.length);
}
two=2;
addto='origsnake1';
document.getElementById('tdsnake').innerHTML="<a title='Show me' style='text-decoration:underline;cursor:pointer;' id='origsnake1' onclick=\"show('tdsnake',this);\"></a>";
jourset=0;
kourset=clues[iourset].length;
solved=false;
askaway();
}
function askaway() {
if (!solved) {
document.getElementById('clue').innerHTML=clues[iourset][jourset];
document.getElementById('inputo').value=clues[iourset][jourset];
jourset++;
if (jourset >= kourset) {
addthis(document.getElementById('inputo'));
alert(clues[iourset][eval(-1 + kourset)] + ' Oh well, no score there.');
solved=true;
pickclueset();
} else {
addthis(document.getElementById('inputo'));
}
}
}
</script>
</head>
<body onload="onemoreclue=location.search.split('clue=')[1] ? decodeURIComponent(location.search.split('clue=')[1]).split('&')[0] : ''; pickclueset();">
<div id=dtop>
<h1>Who Am I Game</h1>
<h3>RJM Programming - July, 2018</h3>
<h4 id=score>Score: 0/0</h4>
<table style='width:100%;' border=20>
<tr><th id=thtpg style='text-align:center;'><script type='text/javascript'>if (document.URL.indexOf('tpg=') != -1 || 1 == 1) { document.write('Asking Player Name to Look Up in <a target=_blank title=Wikipedia href=http://wikipedia.org>Wikipedia</a>'); }</script></th><th>Need Another ...</th><th>Clue</th><th>Have a Guess</th><th>Clues so Far</th></tr>
<tr><td id=tdtpg style='text-align:center;'><script type='text/javascript'>if (document.URL.indexOf('tpg=') != -1 || 1 == 1) { document.write('<input id=wname onblur=get_wikipedia_information(this.value); type=password title=Name value=></input>'); }</script></td><td style='text-align:center;'><input style='background-color:pink;' type=button value="Need Next Clue" onclick="askaway();"></input><input type=hidden id=inputo value=''></input></td><td style='text-align:center;' id=clue></td><td style='text-align:center;'> <input style='background-color:pink;' type=button value="?" onclick=" if (asguess) { guessas(); } else { asguess=true; score+=two; show('tdsnake',document.getElementById(addto)); } "></input> </td><td id='tdsnake'><a title='Show me' style='text-decoration:underline;cursor:pointer;' id='origsnake1' onclick="show('tdsnake',this);"></a></td></tr>
</table>
</div>
<div id=doverlay></div>
</body>
</html>