4c4 < Vertical Riddle - RJM Programming - April, 2017 ... thanks to Science Puzzles for Young Einsteins by Helene Hovanec page 73 --- > Scientific Research - RJM Programming - April, 2017 ... thanks to Science Puzzles for Young Einsteins by Helene Hovanec page 71 7d6 < var overallanswer=''; 10c9 < var vsnw=[0]; --- > var vsnw=[0,0,0,0]; 12a12 > var clue_heading="Scientist"; 14,22c14,18 < function Vertical_Riddle(clue, answer, darray) { < this.clue = clue; < this.answer = answer; < this.clues = []; < this.answers = []; < for (var iid=0; iid function Scientific_Research(name, darray) { > this.name = name; > this.clues = [darray[0].split('|')[0]]; > this.answers = [darray[0].split('|')[1]]; > this.numletters = eval(darray[0].split('|')[0].length - darray[0].split('|')[1].length); 26,28c22,38 < new Vertical_Riddle("What is an astronaut's favourite place on a computer?","thespace bar",['as_eroid|asteroid','black_ole|blackhole','n_bula|nebula','univer_e|universe','_lanet|planet','gal_xy|galaxy','_omet|comet','met_orite|meteorite',' ','or_it|orbit','s_tellite|satellite','c_ater|crater']), < new Vertical_Riddle("What kind of jokes did Einstein make?","wisecracks",['ans_ers|answers','shr_vel|shrivel','bli_ter|blister','pal_tte|palette','knu_kle|knuckle','imp_ove|improve','fan_tic|fanatic','tea_her|teacher','man_ind|mankind','pea_ant|peasant']), < new Vertical_Riddle("What snack food do geologists like?","rock candy",['eme_ald|emerald','dep_sit|deposit','wel_ome|welcome','boo_let|booklet',' ','hat_het|hatchet','adv_nce|advance','gra_ite|granite','san_bar|sandbar','cop_cat|copycat']) --- > new Scientific_Research('Smart person',['brattain|brain']), > new Scientific_Research('Secret agent',['sperry|spy']), > new Scientific_Research('Rabbit',['harvey|hare']), > new Scientific_Research('Price',['cousteau|cost']), > new Scientific_Research('Shade of colour',['hubble|hue']), > new Scientific_Research('Swimming place',['leakey|lake']), > new Scientific_Research('Ache',['pauling|pain']), > new Scientific_Research('Face part',['chapin|chin']), > new Scientific_Research('Adult male',['marconi|man']), > new Scientific_Research('Iced or hot drink',['tesla|tea']), > new Scientific_Research('Veggie on the cob',['copernicus|corn']), > new Scientific_Research('Fib',['lister|lie']), > new Scientific_Research('Squiggly fish',['zeppelin|eel']), > new Scientific_Research('Half of twenty',['einstein|ten']), > new Scientific_Research('Measles symptom',['eratosthenes|rash']), > new Scientific_Research('Grassy area',['lawrence|lawn']), > new Scientific_Research('Car fuel',['goethals|gas']) 31c41 < var defsel=''; --- > var defsel=''; 35c45 < var mores = (location.search.split('vrclues=')[1] ? decodeURIComponent(location.search.split('vrclues=')[1].split('&')[0]) : ''); --- > var mores = (location.search.split('srclues=')[1] ? decodeURIComponent(location.search.split('srclues=')[1].split('&')[0]) : ''); 39c49 < function vr_setCookie(thisg) { // thanks to JavaScript and Ajax by Tom Negrino and Dori Smith --- > function sr_setCookie(thisg) { // thanks to JavaScript and Ajax by Tom Negrino and Dori Smith 54,55c64,65 < if (("vrclues=" + encodeURIComponent(prefix + thisg) + "; expires=" + expireDate.toGMTString()).length < ninehundred) { < document.cookie = "vrclues=" + encodeURIComponent(prefix + thisg) + "; expires=" + expireDate.toGMTString(); --- > if (("srclues=" + encodeURIComponent(prefix + thisg) + "; expires=" + expireDate.toGMTString()).length < ninehundred) { > document.cookie = "srclues=" + encodeURIComponent(prefix + thisg) + "; expires=" + expireDate.toGMTString(); 59c69 < function vr_deleteCookie() { // thanks to JavaScript and Ajax by Tom Negrino and Dori Smith --- > function sr_deleteCookie() { // thanks to JavaScript and Ajax by Tom Negrino and Dori Smith 62c72 < document.cookie = "vrclues=; expires=" + expireDate.toGMTString(); --- > document.cookie = "srclues=; expires=" + expireDate.toGMTString(); 65c75 < function vr_cookieVal(firstcall) { --- > function sr_cookieVal(firstcall) { 69c79 < vr_setCookie(mores); --- > sr_setCookie(mores); 76c86 < if ("vrclues" == tCookie[j].split("=")[0]) { --- > if ("srclues" == tCookie[j].split("=")[0]) { 104,105c114,121 < var hm=what.innerHTML.split(' title=')[1].split('>')[1].split('<')[0]; < if (what.value.trim() != "") { --- > var hm=what.innerHTML.split(' selecte')[1].split('>')[1].split('<')[0]; > if (what.value == " ") { > alert("Answer was " + thedefaults[which].answers[whichrow]); > vsnw[0]=0; > which=-1; > pickobject(); > vsnw[0]=thedefaults[which].numletters; > } else if (what.value == "") { 109c125 < wcol=eval(document.getElementById('whatisleft').innerHTML.length) - eval(wcol); --- > wcol=eval(document.getElementById('whatisleft' + eval(1 + whichrow)).innerHTML.length) - eval(wcol); 111,112c127,128 < if (document.getElementById('whatisleft').innerHTML.length > wcol && whichcol > 0) { < if (document.getElementById('whatisleft').innerHTML.substring(wcol).indexOf(hm) != -1) { --- > if (document.getElementById('whatisleft' + eval(1 + whichrow)).innerHTML.length > wcol && whichcol > 0) { > if (document.getElementById('whatisleft' + eval(1 + whichrow)).innerHTML.substring(wcol).indexOf(hm) != -1) { 114c130 < document.getElementById('whatisleft').innerHTML=document.getElementById('whatisleft').innerHTML.substring(0,wcol) + document.getElementById('whatisleft').innerHTML.substring(wcol).replace(what.value,""); --- > document.getElementById('whatisleft' + eval(1 + whichrow)).innerHTML=document.getElementById('whatisleft' + eval(1 + whichrow)).innerHTML.substring(0,wcol) + document.getElementById('whatisleft' + eval(1 + whichrow)).innerHTML.substring(wcol).replace(hm,""); 118,121c134,137 < if (!dosub) document.getElementById('whatisleft').innerHTML=document.getElementById('whatisleft').innerHTML.replace(what.value,""); < //what.innerHTML=what.innerHTML.replace("Reject this letter"," ").replace("Give up"," "); < //what.value=hm; < //what.style.display='none'; --- > if (!dosub) document.getElementById('whatisleft' + eval(1 + whichrow)).innerHTML=document.getElementById('whatisleft' + eval(1 + whichrow)).innerHTML.replace(hm,""); > what.innerHTML=what.innerHTML.replace("Reject this letter"," ").replace("Give up"," "); > what.value=""; > what.style.display='none'; 123d138 < //alert(vsnw[0] + ' ... ' + document.getElementById('whatisleft').innerHTML.trim()); 127c142 < if (document.getElementById('whatisleft').innerHTML.trim() == '') { --- > if (document.getElementById('whatisleft' + eval(1 + whichrow)).innerHTML == thedefaults[which].answers[whichrow]) { 145c160 < alert('Bad luck. Answer is ' + thedefaults[which].answer); --- > alert('Bad luck. Answer is ' + thedefaults[which].answers[whichrow]); 151a167 > vsnw[0]=thedefaults[which].numletters; 154c170 < document.getElementById('whatisleft').innerHTML=document.getElementById('whatisleft').innerHTML.replace(hm,what.value); --- > document.getElementById('whatisleft' + eval(1 + whichrow)).innerHTML=document.getElementById('whatisleft' + eval(1 + whichrow)).innerHTML.replace(hm,what.value); 159,161c175 < var trbits='',j,k,xextras,ixextras; < var myh="Vertical Riddle"; < --- > var tdbit='',j,k,xextras,ixextras; 173c187 < vr_setCookie(extras); --- > sr_setCookie(extras); 183c197 < vr_setCookie(mores); --- > sr_setCookie(mores); 189,190c203,204 < } else if (afirstcall && document.URL.indexOf('vrclues=') == -1) { < vr_cookieVal(afirstcall); --- > } else if (afirstcall && document.URL.indexOf('srclues=') == -1) { > sr_cookieVal(afirstcall); 193a208 > if (document.getElementById('col1').innerHTML == "") document.getElementById('col1').innerHTML=clue_heading; 197,202c212,213 < numrowsingame=thedefaults[which].answer.length; < //alert(thedefaults[which].answer + ' via ' + numrowsingame); < vsnw[0]=eval(0 + numrowsingame); //thedefaults[which].numletters; < trbits=''; < overallanswer=''; < document.getElementById('whatisleft').innerHTML=thedefaults[which].answer; --- > document.getElementById('nameof').innerHTML=thedefaults[which].name; > vsnw[0]=thedefaults[which].numletters; 204,207c215,217 < overallanswer+=' '; < //document.getElementById('clue' + eval(1 + j)).innerHTML=thedefaults[which].clues[j]; < //document.getElementById('whatisleft' + eval(1 + j)).innerHTML=thedefaults[which].answer; < trbits+="
"; --- > tdbit=''; > document.getElementById('clue' + eval(1 + j)).innerHTML=thedefaults[which].clues[j]; > document.getElementById('whatisleft' + eval(1 + j)).innerHTML=thedefaults[which].clues[j]; 209d218 < //if (k == 0) alert(thedefaults[which].clues[j].substring(k, eval(1 + k))); 211,216c220 < vsnw[0]--; < //alert(65); < trbits+=""; //""; < trbits+="
 
"; < } else if (thedefaults[which].clues[j].substring(k, eval(1 + k)) == "_") { < trbits+="
" + defsel.replace('?', 'ans_' + eval(1 + j) + '_' + eval(1 + k)).replace(">" + thedefaults[which].answers[j].substring(k, eval(1 + k)) + "<"," title=' '>" + thedefaults[which].answers[j].substring(k, eval(1 + k)) + "<") + "
"; --- > tdbit+=""; 218c222 < trbits+=""; --- > tdbit+=defsel.replace('?', 'ans_' + eval(1 + j) + '_' + eval(1 + k)).replace(">" + thedefaults[which].clues[j].substring(k, eval(1 + k)) + "<"," selected>" + thedefaults[which].clues[j].substring(k, eval(1 + k)) + "<").replace(">" + thedefaults[which].answers[j].substring(k, eval(1 + k)) + "<"," title=' '>" + thedefaults[which].answers[j].substring(k, eval(1 + k)) + "<"); 221,222c225 < trbits+="
"; < //document.getElementById('answer' + eval(1 + j)).innerHTML=trbits; --- > document.getElementById('answer' + eval(1 + j)).innerHTML=tdbit; 224,225c227 < document.getElementById('mytbody').innerHTML=myh + trbits; < document.getElementById('vris').innerHTML=thedefaults[which].clue; --- > 229a232,257 > var firsttheone=theone.split(',')[0] + ','; > var yourone=('new Scientific_Research("' + firsttheone + theone.replace(firsttheone,'').toLowerCase().replace(/\'/g,'').replace(/\"/g,'') + '"])').replace(',','"~["').replace(/,/g,'"~"').replace(/~/g,","); > var huhs=(firsttheone + theone.replace(firsttheone,'').toLowerCase()).split('|'); > var jwords,jdiff=0,iwords,awords,cwords, ananswer="", aclue=huhs[0].split(',')[eval(-1 + huhs[0].split(',').length)]; > for (var iclue=0; iclue<1; iclue++) { > ananswer=huhs[eval(1 + iclue)]; > cwords=aclue.split('$#@!'); > awords=ananswer.split('$#@!'); > for (iwords=0; iwords if (eval(awords[iwords].length) >= eval(cwords[iwords].length)) { > isok=false; > alert('Sorry, but "' + theone + '" does not suit the game rules because the clue word length is less than or equal to the corresponding answer word length.'); > return false; > } > startwith=cwords[iwords].toLowerCase(); > for (jwords=0; jwords if (startwith.indexOf(awords[iwords].substring(jwords, eval(1 + jwords)).toLowerCase()) != -1) { > startwith=startwith.replace(awords[iwords].substring(jwords, eval(1 + jwords)).toLowerCase(),''); > } else { > alert('Sorry, but "' + theone + '" does not suit the game rules the answer does not have all the letters of the clue.'); > return false; > } > } > } > } > if (!isok) alert('Sorry, but "' + theone + '" does not suit the game rules.'); 234c262 < var theone=null, yourone="", pretheone,ipre,lpre=1,theones, realask=false, firsttheone='', secondtheone=''; --- > var theone=null, yourone="", pretheone,ipre,lpre=1,theones, realask=false, firsttheone=''; 244,245c272 < < pretheone=prompt(inadd + "Enter your however many comma separated entry that goes ... Clue for Sharp Tool, Answer of saw, an_wer1|answer1,_nswer2|answer2,ans_er1|answer3 ... and to do more than one at a time, separate by ! ... and to clear the cookie data regarding this enter a blank string (or one or more space characters only to avoid being prompted again)", "What do they eat on Mars?,earth bar,ast_roid|asteroid,s_tellite|satellite,unive_se|universe,plane_|planet,black_ole|blackhole, ,or_it|orbit,gal_xy|galaxy,c_ater|crater"); --- > pretheone=prompt(inadd + "Enter your two comma separated entry (where you reject letters from clue to derive answer) that goes ... Clue, scientistnamealwayslongerthananswer1|answer1 ... and to do more than one at a time, separate by ! ... and to clear the cookie data regarding this enter a blank string (or one or more space characters only to avoid being prompted again)", "Female Chicken,heisenberg|hen"); 250c277 < vr_deleteCookie(); --- > sr_deleteCookie(); 254c281 < pretheone=prompt("Enter your however many comma separated entry that goes ... Clue for Sharp Tool, Answer of saw, an_wer1|answer1,_nswer2|answer2,ans_er1|answer3 ... and to do more than one at a time, separate by !", "What do they eat on Mars?,earth bar,ast_roid|asteroid,s_tellite|satellite,unive_se|universe,plane_|planet,black_ole|blackhole, ,or_it|orbit,gal_xy|galaxy,c_ater|crater"); --- > pretheone=prompt("Enter your two comma separated entry (where you reject letters from clue to derive answer) that goes ... Clue, scientistnamealwayslongerthananswer1|answer1 ... and to do more than one at a time, separate by !", "Female Chicken,heisenberg|hen"); 273,275d299 < if (theone != null) { < numrowsingame=eval(-1 + theone.split('|').length); < } 281c305 < } else if (eval(theone.split(',').length) == eval(3 + numrowsingame) && eval(theone.split('|').length) == eval(1 + numrowsingame)) { --- > } else if (theone.split(',').length == eval(1 + numrowsingame) && theone.split('|').length == eval(1 + numrowsingame)) { 286d309 < //alert(extras); 290,295c313 < secondtheone=theone.split(',')[1] + ','; < //alert(firsttheone); < //alert(secondtheone); < //alert(theone.replace((firsttheone + secondtheone),'').toLowerCase()); < yourone=('new Vertical_Riddle("' + firsttheone.replace(',','@') + secondtheone + theone.replace((firsttheone + secondtheone),'').toLowerCase().replace(/\'/g,'').replace(/\"/g,'') + '"])').replace(',','"~["').replace(/,/g,'"~"').replace(/~/g,",").replace('@','","'); < //alert(yourone); --- > yourone=('new Scientific_Research("' + firsttheone + theone.replace(firsttheone,'').toLowerCase().replace(/\'/g,'').replace(/\"/g,'') + '"])').replace(',','"~["').replace(/,/g,'"~"').replace(/~/g,","); 298c316 < if (inadd == "" || document.URL.indexOf('vrclues=') != -1) { --- > if (inadd == "" || document.URL.indexOf('srclues=') != -1) { 307c325 < } else if (eval(theone.split(',').length) == eval(3 + numrowsingame)) { --- > } else if (theone.split(',').length == eval(1 + numrowsingame)) { 311,312c329,330 < } else if (eval(theone.split('|').length) == eval(1 + numrowsingame)) { < alert('Sorry, but "' + theone + '" does not suit the game rules because the number of data fields is wrong.'); --- > } else if (theone.split('|').length == eval(1 + numrowsingame)) { > alert('Sorry, but "' + theone + '" does not suit the game rules because the number of data fields is wrong, perhaps because you have forgotten the Category field.'); 341c359 < suffix="?vrclues=&prevscore=" + encodeURIComponent(document.getElementById('score').innerHTML.split(" versus ")[0]) + "&prevlist=" + encodeURIComponent(thislist); --- > suffix="?srclues=&prevscore=" + encodeURIComponent(document.getElementById('score').innerHTML.split(" versus ")[0]) + "&prevlist=" + encodeURIComponent(thislist); 354c372 < document.getElementById('vrclues').value=extras; --- > document.getElementById('srclues').value=extras; 361c379 < if (andsend) vr_setCookie(extras); --- > if (andsend) sr_setCookie(extras); 365,366c383,384 < if (!andsend || (prefix[0] + 'body=' + encodeURIComponent(nofile(document.URL).split('#')[0].split('?')[0] + '?vrclues=' + encodeURIComponent(extras) + suffix)).length < ninehundred) { < document.getElementById('aemail').href=prefix[0] + 'body=' + encodeURIComponent(nofile(document.URL).split('#')[0].split('?')[0] + '?vrclues=' + encodeURIComponent(extras) + suffix); --- > if (!andsend || (prefix[0] + 'body=' + encodeURIComponent(nofile(document.URL).split('#')[0].split('?')[0] + '?srclues=' + encodeURIComponent(extras) + suffix)).length < ninehundred) { > document.getElementById('aemail').href=prefix[0] + 'body=' + encodeURIComponent(nofile(document.URL).split('#')[0].split('?')[0] + '?srclues=' + encodeURIComponent(extras) + suffix); 377c395 < document.getElementById('vrclues').value=extras; --- > document.getElementById('srclues').value=extras; 398c416 < vr_setCookie(extras); --- > sr_setCookie(extras); 442c460 < --- > 445,446c463,464 < < --- > > 450c468 <

Vertical Riddle 📧 

--- >

Scientific Research 📧 

455c473 <

Pick letters in centre dropdowns to spell out words answering the clue shown, or add your own into the mix.

--- >

Reject letters in dropdown Scientist Name words to be words answering the clues shown, or add your own into the mix.

459,461c477,480 < < < --- >
PrefixVertical RiddleSuffix
> > > 466,468c485,486 < < < --- > >
Answer So Far