function blink(selector){ $(selector).fadeOut('slow', function(){ $(this).fadeIn('slow', function(){ blink(this); }); }); } counter = 0 preferSlices = 0 // 0=z, 1=y, 2=x function beep() { var snd = new Audio( "data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtxYBYYZdifkUDgzzXaXn98Z0oi9ILU5mBjFANmRwlVJ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AyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=" ); snd.play(); } function introMusic(counter) { //var snd = new Audio('https://math.hawaii.edu/~bjoern/scripts/labbymusic.mp3'); if (counter % 5 == 1) { snd = new Audio('https://math.hawaii.edu/~bjoern/scripts/one.mp3'); } if (counter % 5 == 2) { snd = new Audio('https://math.hawaii.edu/~bjoern/scripts/two.mp3'); } if (counter % 5 == 3) { snd = new Audio('https://math.hawaii.edu/~bjoern/scripts/three.mp3'); } if (counter % 5 == 4) { snd = new Audio('https://math.hawaii.edu/~bjoern/scripts/four.mp3'); } if (counter % 5 == 0) { snd = new Audio('https://math.hawaii.edu/~bjoern/scripts/five.mp3'); } snd.play(); } function yay() { var snd = new Audio('https://math.hawaii.edu/~bjoern/scripts/labby.mp3'); snd.play(); } function makeId(x1, y1, z1) { return 'labby' + x1.toString() + "_" + y1.toString() + "_" + z1.toString(); } function makeJQueryId(x1, y1, z1) { //return '#labby' + x1.toString() + "\\," + y1.toString() + "\\," + z1.toString(); return '#labby' + x1.toString() + "_" + y1.toString() + "_" + z1.toString(); } function close3D(x1, y1, z1, x2, y2, z2) { if (x1==x2 && y1==y2 && z1 == z2 - 1) { return true } if (x1==x2 && y1==y2 && z1 == z2 + 1) { return true } if (x1==x2 && y1==y2 + 1 && z1 == z2) { return true } if (x1==x2 && y1==y2 - 1 && z1 == z2) { return true } if (x1==x2 + 1 && y1==y2 && z1 == z2) { return true } if (x1==x2 - 1 && y1==y2 && z1 == z2) { return true } return false } function prevSheet(theSheet) { return theSheet; /* if (theSheet == 0) { return 0; } else { return theSheet - 1; } */ } function close(i,j,k,l) { // are positions (i,j) and (k,l) at a Hamming distance of 1. return ( (i == k+1 && j == l) || (i == k && j == l+1) || (i == k && j == l-1) || (i == k-1 && j == l) ) } x = 0; y = 0; theSheet = 0; keyCaps = [ "0️⃣","1️⃣","2️⃣","3️⃣","4️⃣","5️⃣","6️⃣","7️⃣","8️⃣","9️⃣", "🅰️","🅱️","🇨","🇩","🇪","🇫","🇬","🇭","🇮","🇯", "🇰","🇱","🇲","🇳","🅾️","🇵","🇶","🇷","🇸","🇹", "🇺","🇻","🇼","❌","🇾","🇿","🕐","🕑","🕒","🕓", "🕔","🕕","🕖","🕗","🕘","🕙","🕚", "0️⃣" //,"1️⃣" //,"2️⃣","3️⃣","4️⃣","5️⃣","6️⃣","7️⃣","8️⃣","9️⃣" ] //"🅿" //If we reuse letters then for instance the 1 will become turd when sweeping for turds. //Solution: if it's the last of all letters and connected to a next-to-last then leave it alone //but that's just a band-aid as we can only add one /*keyCaps = [ "0️⃣","1️⃣","2️⃣","3️⃣","4️⃣","5️⃣","6️⃣","7️⃣","8️⃣","9️⃣","🔟" // could use ① but then would need to font-size: 128px; vertical-align: middle; ]*/ // less confusing in the 3D case //keyCaps = [keyCaps[0],keyCaps[1],keyCaps[2]]; // temporarily while debugging // Can Labby find his way using DFA by the rightmost wall method (Wall-follower algorithm)? does it even work in 3D? does nfa=dfa in 2d but not in 3d? // well no ``is there an island'' is probably in nfa\dfa even in 2d? well, no: ``is there a bounded size island'' is in dfa if we can freely fly over the land, // and ``is there an arbitrary sized island'' is not even in nfa, since how do we know when we have completely circled the island? function handle_keypress_or_onclick(xs,ys,sheets,theKey) { //blink('.blink'); counter += 1; introMusic(counter); //introMusic(theSheet + 1); // Nina didn't like this way. // erase old markings: for (x1 = 0; x1 < xs; x1++) { for (y1 = 0; y1 < ys; y1++) { for (z1 = 0; z1 < sheets; z1++) { someId = makeId(x1,y1,z1); for (cap = 0; cap <= keyCaps.length+1; cap++) { if ( (document.getElementById(someId).innerHTML == keyCaps[cap]) || (document.getElementById(someId).innerHTML == "🍋")// "💩") ) { document.getElementById(someId).innerHTML = "#️⃣";//"🍞"; // $("." + someId).html("#️⃣"); // this is supposed to update the y-slices as well /* Okay so this works, can be combined with wall follower algorithm: someJQueryId = makeJQueryId(x1,y1,z1); $(someJQueryId).addClass('blink'); */ //document.getElementById(someId).class="blink"; //document.getElementById(someId).style = "background-color: #92a8d1;"; } } } } } document.getElementById('moves_made').innerHTML += theKey; document.getElementById('num_moves').innerHTML = document.getElementById('moves_made').innerHTML.length.toString(); labbyId = makeId(x,y,theSheet); document.getElementById(labbyId).innerHTML = "#️⃣"; // "💩"; that usage is passe $("." + labbyId).html("#️⃣"); // this is supposed to update the y-slices as well //alert("Sorry for the debugging... you are at " + x.toString() + ", " + y.toString() + " on sheet "+theSheet.toString()) oldX = x oldY = y oldTheSheet = theSheet if (theKey == "w") { y -= 1; if (y < 0) {y=0;} } if (theKey == "a") { x -= 1; if (x<0) {x = 0;} } if (theKey == "s") { y += 1; if (y>= ys) {y=ys - 1;} } if (theKey == "d") { x += 1; if (x>xs - 1) {x=xs - 1;} } if (theKey == "f") { theSheet += 1; if (theSheet > sheets - 1) {theSheet = sheets - 1;} } if (theKey == "e") { theSheet -= 1; if (theSheet <0) {theSheet = 0;} } $(".coords").html("       (" + x.toString() + ", " + y.toString() + ", " + theSheet.toString() + ")"); labbyId = makeId(x,y,theSheet); jQueryLabbyId = makeJQueryId(x,y,theSheet); if ( $(jQueryLabbyId).html() != "🦠" && $(jQueryLabbyId).html() != "❤️" ) { $(jQueryLabbyId).html("😈"); // 🤣😈 $("." + labbyId).html("😈");// to make yslices work too //location = "#sheet" + sheet.toString(); if (preferSlices == 0) { // z-slices document.getElementById('sheet'+prevSheet(theSheet).toString()).scrollIntoView( { behavior: 'smooth' }); } if (preferSlices == 1) { // y-slices document.getElementById('yslice'+y.toString()).scrollIntoView( { behavior: 'smooth' }); } if (preferSlices == 2) { // x-slices document.getElementById('xslice'+x.toString()).scrollIntoView( { behavior: 'smooth' }); } } //$(jQueryLabbyId).css({"animation": "blinker", "animation": "1s", "animation": "linear", "animation": "infinite"}); if ($(jQueryLabbyId).html() == "❤️") { document.getElementById('you_did_it').innerHTML = ("

Mission complete

"); document.getElementById('you_did_it').scrollIntoView( { behavior: 'smooth' }); yay(); //window.location.reload(); } if ($(jQueryLabbyId).html() == "🦠") { //$(labbyId).html() == "🦠" /* If we want to penalize mistakes: $(jQueryLabbyId).html("💥"); alert( "You crashed into the coronavirus. You are at " + x.toString() + ", " + y.toString() + " on sheet " + theSheet.toString() ); location.reload();*/ //If we want to be nice, just undo any changes: beep(); x = oldX y = oldY theSheet = oldTheSheet labbyId = makeId(x,y,theSheet); document.getElementById(labbyId).innerHTML = "😈"; $("." + labbyId).html("😈"); // this is supposed to update the y-slices as well } if ((theKey) == "r") { // rotate perspective preferSlices = (preferSlices + 1) % 3 if (preferSlices == 0) { // z-slices document.getElementById('sheet'+prevSheet(theSheet).toString()).scrollIntoView( { behavior: 'smooth' }); } if (preferSlices == 1) { // y-slices document.getElementById('yslice'+y.toString()).scrollIntoView( { behavior: 'smooth' }); } if (preferSlices == 2) { // x-slices document.getElementById('xslice'+x.toString()).scrollIntoView( { behavior: 'smooth' }); } } if (theKey == "q") { // compute a Hamming sphere... can fix later for (x1 = 0; x1 < xs; x1++) { //$(".q").html("    Computing "+(x1+1).toString() + "/" + xs.toString()); //not helpful for (y1 = 0; y1 < ys; y1++) { for (z1 = 0; z1 < sheets; z1++) { someId = makeId(x1,y1,z1); someJQueryId = makeJQueryId(x1,y1,z1); if ( ( ($(someJQueryId).html() == "#️⃣") ||($(someJQueryId).html() == "✅") ||($(someJQueryId).html() == "🍋") //"💩" ) && close3D(x1,y1,z1,x,y,theSheet) ) { $(someJQueryId).html("1️⃣"); $("." + someId).html("1️⃣"); // to make yslices work too //alert("Set a 1 for " + someId + " to be " + $(someJQueryId).html()); Testing shows it does happen, but screen only updates later. } } } } for (cap = 1; cap < keyCaps.length - 1; cap++) { //alert(cap); oldDoc = document.cloneNode(true) canGoThatFar = false for (x1 = 0; x1 < xs; x1++) { for (y1 = 0; y1 < ys; y1++) { for (z1 = 0; z1 < sheets; z1++) { oneId = makeId(x1,y1,z1); if (document.getElementById(oneId).innerHTML == keyCaps[cap]) { //alert("Found a 1!"); if (close3D(x1,y1,z1,xs-1,ys-1,sheets-1)) { continue// this was a problem for a while... a cell next to the heart should be considered useful! } useful = false for (x2 = Math.max(0,x1-1); x2 <= Math.min(xs-1,x1+1); x2++) { for (y2 = Math.max(0,y1-1); y2 <= Math.min(ys-1,y1+1); y2++) { for (z2 = Math.max(0,z1-1); z2 <= Math.min(sheets-1, z1+1); z2++) { // k,l is near, give k,l a 2. anotherId = makeId(x2,y2,z2); //alert(oldDoc.getElementById(anotherId).innerHTML); if ( ( (oldDoc.getElementById(anotherId).innerHTML == "#️⃣") ||(oldDoc.getElementById(anotherId).innerHTML == "✅") ||(oldDoc.getElementById(anotherId).innerHTML == "🍋") // "💩") ) && close3D(x1,y1,z1,x2,y2,z2) ) { document.getElementById(anotherId).innerHTML = keyCaps[cap+1]; $("." + anotherId).html(keyCaps[cap+1]); // this is supposed to update the y-slices as well useful = true canGoThatFar = true //alert("Useful!"); } /*if ( oldDoc.getElementById(anotherId).innerHTML == "❤️" && close3D(i,j,sheet,k,l,sheet2) ) { alert("A solution exists!"); window.location.reload(); }*/ } } } if (!useful) { //alert('I am declaring ' + oneId + ' to be not useful.'); document.getElementById(oneId).innerHTML = "🍋"; // "💩"; //🚮 $("." + oneId).html("🍋"); // this is supposed to update the y-slices as well } } } } } if (!canGoThatFar) { break; } } /*if (!canGoThatFar) { alert("No solution exists!"); window.location.reload() }*/ // check for more "turds" or "lemons": for (cap = keyCaps.length - 2; cap > 0; cap--) {// making this keyCaps.length - 1 will lead to keyCaps[cap+1] == undefined. old$ = $("#data").clone(); // clone the
with id='data' for (x1 = 0; x1 < xs; x1++) { for (y1 = 0; y1 < ys; y1++) { for (z1 = 0; z1 < sheets; z1++) { id = makeId(x1,y1,z1); jQueryId = makeJQueryId(x1,y1,z1); if ( old$.find(jQueryId).html() == keyCaps[cap] // was old$(jQueryId).html() == but old$ is not a function. ) { //alert("Found cap"); goodNearby = false //if all nearby are not cap+1, turn into turd. for (x2 = Math.max(0,x1-1); x2 <= Math.min(xs-1,x1+1); x2++) { for (y2 = Math.max(0,y1-1); y2 <= Math.min(ys-1,y1+1); y2++) { for (z2 = Math.max(0,z1-1); z2 <= Math.min(sheets-1, z1+1); z2++) { //https://stackoverflow.com/a/29430000/803990 a minimal path contains no cycles but we want more, a homotopically minimal path in a sense if (close3D(x1,y1,z1,x2,y2,z2)) { //alert("Close!"); //if (i == 8 && j == 9 && sheet == 9 && k == 9 && l == 9 && sheet2 == 9) { // alert('Hello'); //} // k,l is near, give k,l a 2. anotherId = makeId(x2,y2,z2); jQueryAnotherId = makeJQueryId(x2,y2,z2); /*alert( old$.find(jQueryId).html() + ", " + keyCaps[cap] + ", " + old$.find(jQueryAnotherId).html() + ", " + keyCaps[cap+1] );*/ //WORK ON THIS if ( ( old$.find(jQueryAnotherId).html() == keyCaps[cap+1] ) ||(old$.find(jQueryAnotherId).html() == "❤️") ) { goodNearby = true //alert("Good nearby!"); doesn't happen right now... } } } } } if (!goodNearby) { $(jQueryId).html("🍋"); // "💩" $("."+id).html("🍋");// to make yslices work too } } } } } } for (x1 = 0; x1 < xs; x1++) { for (y1 = 0; y1 < ys; y1++) { for (z1 = 0; z1 < sheets; z1++) { id = makeId(x1,y1,z1); jQueryId = makeJQueryId(x1,y1,z1); if (($(jQueryId).html() == "#️⃣") || ($(jQueryId).html() == "🍋")) { $(jQueryId).html("💩"); // if a square is useless, mark it as turd } } } } } } $(document).ready(function(){ //$('body').addClass('blink'); //blink('.blink'); document.getElementById('labby_headline').scrollIntoView( { behavior: 'smooth' }); xs = parseInt($('#x').html()); ys = parseInt($('#y').html()); sheets = parseInt($('#z').html()); //$('#labby').css(".blink_me {animation: blinker 1s linear infinite;}@keyframes blinker {50% {opacity: 0;}}"); //$('body').style = ".blink_me {animation: blinker 1s linear infinite;}@keyframes blinker {50% {opacity: 0;}}"; $(document).keypress(function(event){ theKey = String.fromCharCode(event.which); handle_keypress_or_onclick(xs,ys,sheets,theKey); }); $('.press_q').click(function(event){ handle_keypress_or_onclick(xs,ys,sheets,"q"); } ); // end of keypress $('.press_w').click(function(event){ handle_keypress_or_onclick(xs,ys,sheets,"w"); } ); // end of keypress $('.press_e').click(function(event){ handle_keypress_or_onclick(xs,ys,sheets,"e"); } ); // end of keypress $('.press_r').click(function(event){ handle_keypress_or_onclick(xs,ys,sheets,"r"); } ); // end of keypress $('.press_a').click(function(event){ handle_keypress_or_onclick(xs,ys,sheets,"a"); } ); // end of keypress $('.press_s').click(function(event){ handle_keypress_or_onclick(xs,ys,sheets,"s"); } ); // end of keypress $('.press_d').click(function(event){ handle_keypress_or_onclick(xs,ys,sheets,"d"); } ); // end of keypress $('.press_f').click(function(event){ handle_keypress_or_onclick(xs,ys,sheets,"f"); } ); // end of keypress }); // end of document ready // googleanalytics: var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-20074178-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = jQuery('script')[0]; s.parentNode.insertBefore(ga, s); })();