15d14
< border-radius: 5px;
26d24
< border-radius: 5px;
35d32
< border-radius: 5px;
45d41
< border-radius: 5px;
48,59d43
<
< #qh4 {
< font-size: 12px;
< }
<
< input {
< border-radius: 23px;
< }
<
< iframe {
< z-index: 29;
< }
71,119d54
< var dval='', wording='';
< var aurl='', burl='';
< var inas=[], jinas=0;
< var inanswer='';
<
< var inquestions=["10,22,23,9,70,126,128,139,150,149,93,36,82,138,-82,+25,+37,-138,+95,+37",
< "126,70,9,10,22,34,35,93,149,150,139,127,83,82,24,-24,+140,+196,-82,+173,+185",
< "70,72,71,180.124,+72,-61,-73,+285,-7,-68",
< "9,10,11,12,70,71,72,24,82,83,-70,+7,+68,-72,80,+136",
< "12,24,36,73.4,17.4,29.17,84.29,-287,+95,+29,-12,+84,+17",
< "70,71,82,72,83,12,24,20.7,61.7,73.7,84.20,-285,+73,+20",
< "11,12,70,126,128,139,150,149,94,83,127,71,82,23,22,-150,+117,+129,-149,+73,+84,-94,+140,+196",
< "11,35,22,34,24,36,73.4,13.4,124.73,136.73,147.95,158.95,41.37,-285,+95,+41",
< "11,35,22,34,24,36,73.4,13.4,124.73,136.73,147.95,158.95,41.37,-285,+73,+17,-286,+17,+13",
< "11,22,23,24,139,73.117,151.84,196.151,185.117,-11,+140,+185,-22,+140,+73,-23,+140,+151",
< "12,72,71,70,83,139,11,10,9,149,94,126,128,127,139,138,150,-71,+25,+37,-70,+25,+84,-83,+84,+95,-139,+95,+37"];
< var inwordings=["Get 2 rectangles to 2 squares by moving 2 matches. Which 2?",
< "Get gap at bottom left closed up and leaving 2 squares by moving 2 matches. Which 2?",
< "Turn Y-like figure upside down by moving 2 matches. Which 2?",
< "Get four equal sized rectangles from these three equal sized squares by moving 2 matches. Which 2?",
< "Get 1 parallelogram and 1 equilateral triangle by moving 2 matches. Which 2?",
< "This house can become 2 by moving 1 match. Which 1?",
< "Get 6 squares out of these 3 equal sized rectangles by moving 3 matches. Which 3?",
< "Turn the dog around by moving 1 match. Which 1?",
< "Make this dog look back by moving 2 matches. Which 2?",
< "Make this pattern into a 3d cube by moving 3 matches. Which 3?",
< "Change the L shape pattern into 4 equal sized squares by moving 4 matches. Which 4?"];
<
< function pickone(what) {
< var choice=Math.floor(Math.random() * inquestions.length);
< if (document.URL.indexOf('?') == -1) {
< location.href=document.URL.split('#')[0] + '?wording=' + encodeURIComponent(inwordings[choice]) + '&question=' + encodeURIComponent(inquestions[choice]);
< }
< return what;
< }
<
< function acl() {
< if (inas.length > 0 && inas.length > jinas) {
< if (inas[jinas].indexOf('-') != -1) {
< hrclick(document.getElementById('hr' + inas[jinas].replace('-','').replace('dr','').replace('hr','')));
< jinas++;
< setTimeout(acl, 2000);
< } else {
< hrclick(document.getElementById('hr' + inas[jinas].replace(' ','').replace('+','').replace('dr','').replace('hr','')));
< jinas++;
< setTimeout(acl, 2000);
< }
< }
< }
147,148c82,83
< //alert(document.getElementById('hr' + fhr).outerHTML + ' to ' + document.getElementById('hr' + eval(1 + eval('' + fhr))).outerHTML + ' is ' + connect(document.getElementById('hr' + fhr), document.getElementById('hr' + eval(1 + eval('' + fhr)))).replace('
//alert(document.getElementById('hr' + fhr).outerHTML + ' to ' + document.getElementById('hr' + eval(1 + eval('' + fhr))).outerHTML + ' is ' + connect(document.getElementById('hr' + fhr), document.getElementById('hr' + eval(1 + eval('' + fhr)))).replace('
document.getElementById('hrs').innerHTML+=connect(v1, v2).replace('
';
---
> document.getElementById('hrs').innerHTML+='
';
165c100
< document.getElementById('hrs').innerHTML+='
';
---
> document.getElementById('hrs').innerHTML+='
';
209,231d143
< function ina(inqs) {
< // http://localhost:8888/square_hr_tracing.htm?debug=y&wording=hdgdyt%20dfh&inquestion=10,22,23,9,70,126,128,139,150,149,93,36,82,138,-82,+25,+37,-138,+95,+37
< if (inanswer == '') {
< if (inqs.indexOf(',-') != -1 || inqs.indexOf(',+') != -1 || inqs.indexOf(', ') != -1) {
< var preurl=inqs.split(',-')[0].split(',+')[0].split(', ')[0];
< var prest=inqs.replace(preurl + ',','').replace(preurl,'').replace(/\ /g,'+');
< var ins=(preurl + '-').replace(',-','').replace('-','').split(',');
< var inandouts=prest.split(',');
< burl=pickone(document.URL);
< aurl=document.URL.split('#')[0].replace('question=','q=') + '&question=' + encodeURIComponent(preurl) + '&answer=' + encodeURIComponent(prest);
< //alert(prest + ' ... ' + aurl);
< return preurl;
< } else {
< burl=pickone(document.URL);
< aurl=document.URL;
< }
< } else {
< burl=pickone(document.URL);
< aurl=document.URL.replace('question=','q=').replace('answer=','question=');
< }
< return inqs;
< }
<
233,236d144
< if (document.URL.indexOf('?') == -1) { pickone(''); }
< wording=location.search.split('wording=')[1] ? decodeURIComponent(location.search.split('wording=')[1].split('&')[0]) : ' ';
< inanswer=location.search.split('answer=')[1] ? decodeURIComponent(location.search.split('answer=')[1].split('&')[0]) : '';
< var inquestion=location.search.split('question=')[1] ? ina(decodeURIComponent(location.search.split('question=')[1].split('&')[0])) : '';
238,239c146
< var fhr=0;
< dval='';
---
> var dval='', fhr=0;
294,315c201
< if (inquestion != '') {
< if (parent.document != document) {
< if (parent.document.getElementById('myh1')) {
< dval=dval;
< document.getElementById('myh1').innerHTML='Chinese Brain Twisters Answer';
< } else {
< if (document.getElementById('myh3').innerHTML.indexOf(' ... ') == -1) { document.getElementById('myh3').innerHTML+=' ... Thanks to Chinese Brain Twisters by Baifang ISBN: 0-471-59505-5'; }
< document.getElementById('reveal').style.display='block';
< document.getElementById('skip').style.display='block';
< document.getElementById('myh1').innerHTML='Chinese Brain Twisters Question';
< }
< } else {
< if (document.getElementById('myh3').innerHTML.indexOf(' ... ') == -1) { document.getElementById('myh3').innerHTML+=' ... Thanks to Chinese Brain Twisters by Baifang ISBN: 0-471-59505-5'; }
< document.getElementById('reveal').style.display='block';
< document.getElementById('skip').style.display='block';
< document.getElementById('myh1').innerHTML='Chinese Brain Twisters Question';
< }
< document.getElementById('qh4').innerHTML=wording;
< if (inquestion.indexOf('r') == -1) { inquestion='hr' + inquestion.replace(/\,/g,',hr'); }
< if ((inquestion + ',').indexOf('r' + hrcnt + ',') == -1) { dval="display:none;visibility:hidden;"; }
< }
< //document.getElementById('hrs').innerHTML+='
';
---
> //document.getElementById('hrs').innerHTML+='
';
317,318c203,204
< //alert(document.getElementById('hr' + fhr).outerHTML + ' to ' + document.getElementById('hr' + eval(1 + eval('' + fhr))).outerHTML + ' is ' + connect(document.getElementById('hr' + fhr), document.getElementById('hr' + eval(1 + eval('' + fhr)))).replace('
//alert(document.getElementById('hr' + fhr).outerHTML + ' to ' + document.getElementById('hr' + eval(1 + eval('' + fhr))).outerHTML + ' is ' + connect(document.getElementById('hr' + fhr), document.getElementById('hr' + eval(1 + eval('' + fhr)))).replace('
document.getElementById('hrs').innerHTML+=connect(document.getElementById('hr' + fhr), document.getElementById('hr' + eval(1 + eval('' + fhr)))).replace('
';
---
> document.getElementById('hrs').innerHTML+='
';
326,328d211
< if (inquestion != '') {
< if ((inquestion + ',').indexOf('r' + hrcnt + ',') == -1) { dval="display:none;visibility:hidden;"; }
< }
332c215
< //document.getElementById('hrs').innerHTML+='
';
---
> //document.getElementById('hrs').innerHTML+='
';
334,336d216
< if (inquestion != '') {
< if ((inquestion + ',').indexOf('r' + hrcnt + ',') == -1) { dval="display:none;visibility:hidden;"; }
< }
338,339c218,219
< //alert(document.getElementById('hr' + fhr).outerHTML + ' to ' + document.getElementById('hr' + eval(1 + eval('' + fhr))).outerHTML + ' is ' + connect(document.getElementById('hr' + fhr), document.getElementById('hr' + eval(1 + eval('' + fhr)))).replace('
//alert(document.getElementById('hr' + fhr).outerHTML + ' to ' + document.getElementById('hr' + eval(1 + eval('' + fhr))).outerHTML + ' is ' + connect(document.getElementById('hr' + fhr), document.getElementById('hr' + eval(1 + eval('' + fhr)))).replace('
document.getElementById('hrs').innerHTML+=connect(document.getElementById('hr' + eval(3 + eval('' + fhr))), document.getElementById('hr' + eval(2 + eval('' + fhr)))).replace('
';
---
> document.getElementById('hrs').innerHTML+='
';
345,347d224
< if (inquestion != '') {
< if ((inquestion + ',').indexOf('r' + hrcnt + ',') == -1) { dval="display:none;visibility:hidden;"; }
< }
355,370d231
< dval='';
<
< if (inquestion.indexOf('.') != -1) {
< var xinas=inquestion.split(',');
< for (ix=0; ix
0) {
< setTimeout(acl, 2000);
< }
405c266
< var htmlLine = "";
---
> var htmlLine = "";
414,420c275,277
<
<
Tracing Square Line Drawing
< RJM Programming - December, 2018
< Hint: Click/touch a match then two vertices to reposition that match
<
<
<
433d287
<