{"id":20517,"date":"2023-08-22T19:38:37","date_gmt":"2023-08-23T02:38:37","guid":{"rendered":"https:\/\/www.kith.org\/jed\/?page_id=20517"},"modified":"2023-08-26T11:04:52","modified_gmt":"2023-08-26T18:04:52","slug":"follow-me","status":"publish","type":"page","link":"https:\/\/www.kith.org\/jed\/hodgepodge\/code\/follow-me\/","title":{"rendered":"Follow Me!"},"content":{"rendered":"\r\n<style>\r\ntable {\r\n  width: 200px;\r\n  height: 200px;\r\n  padding: 0 !important;\r\n  border-collapse: separate;\r\n  border-spacing: 0;\r\n  margin-left: auto;\r\n  margin-right: auto;\r\n}\r\n\r\ntr {\r\n  margin: 0 !important;\r\n  margin-top: 0 !important;\r\n  margin-bottom: 0 !important;\r\n  border: 0 !important;\r\n  padding: 0 !important;\r\n}\r\n\r\ntd {\r\n  margin: 0 !important;\r\n  margin-top: 0 !important;\r\n  margin-bottom: 0 !important;\r\n  border: 0 !important;\r\n  padding: 0 !important;\r\n  height: 100px !important;\r\n}\r\n\r\nimg {\r\n  margin: 0 !important;\r\n  margin-top: 0 !important;\r\n  margin-bottom: 0 !important;\r\n  border: 0 !important;\r\n  padding: 0 !important;\r\n  height: 100px !important;\r\n}\r\n\r\n<\/style>\r\n\r\n<script language=\"JavaScript\">\r\n<!--\r\nfunction MM_swapImgRestore() { \/\/v3.0\r\n  var i,x,a=document.MM_sr;\r\n  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)\r\n    if (!x.lit) x.src=x.oSrc;\r\n}\r\n\r\nfunction MM_preloadImages() { \/\/v3.0\r\n  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();\r\n    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)\r\n    if (a[i].indexOf(\"#\")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];} }\r\n}\r\n\r\nfunction MM_findObj(n, d) { \/\/v3.0\r\n  var p,i,x;  if(!d) d=document; if((p=n.indexOf(\"?\"))>0&&parent.frames.length) {\r\n    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}\r\n  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];\r\n  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;\r\n}\r\n\r\nfunction MM_swapImage() { \/\/v3.0\r\n  var i, j=0, x, a=MM_swapImage.arguments;\r\n  document.MM_sr=new Array;\r\n  for(i=0;i<(a.length-2);i+=2)\r\n    if ((x=MM_findObj(a[i]))!=null)\r\n      {document.MM_sr[j++]=x; if (!x.oSrc) x.oSrc=x.src; if (!x.lit) x.src=a[i+2];}\r\n}\r\n\r\nfunction addToQueue(buttonName, litURL) {\r\n  var x;  \/\/ an object\r\n  if (!document.JH_lit) document.JH_lit = new Array;\r\n  var j = document.JH_lit.length;\r\n  if ((x=MM_findObj(buttonName))!=null)\r\n  {\r\n    if (!x.litURL) x.litURL = litURL;\r\n    document.JH_lit[j]=x;\r\n  }\r\n}\r\n\r\nfunction buttonClicked(buttonNumber, buttonName, litURL) {\r\n  if ((!document.sequence)||(document.sequence.length == 0)) {addToQueue(buttonName, litURL); return;} \/\/ just playing around\r\n  if (document.sequence[0] == buttonNumber)\r\n  {\r\n    addToQueue(buttonName, litURL);\r\n    document.sequence = document.sequence.slice(1);\r\n    if (document.sequence.length == 0) setTimeout(\"alert('You win!')\",300);\r\n  }\r\n  else\r\n  {\r\n    var shouldaString = \"Wrong! Remaining sequence should have been: \";\r\n    for (var i=0; i < document.sequence.length; i++)\r\n    {\r\n      if (i != 0) shouldaString = shouldaString + \", \";\r\n      shouldaString = shouldaString + document.buttonColors[document.sequence[i]];\r\n    }\r\n    alert(shouldaString+\".\");\r\n    document.sequence = new Array;\r\n    var a = document.JH_lit[0];\r\n    if (a&&a.lit) document.JH_lit = document.JH_lit.slice(0,1); \/\/if something is lit\r\n    else document.JH_lit = new Array;\r\n  }\r\n}\r\n\r\nfunction lightImage(x) {\r\n  if(!x.oSrc) x.oSrc=x.src;\r\n  x.src=x.litURL;\r\n  x.lit=true;\r\n}\r\n\r\nfunction unlightImage() {\r\n  var x, a=document.JH_lit;\r\n  if (a&&(x=a[0])&&x.oSrc) x.src=x.oSrc; \/\/restore first lit image.\r\n  x.lit=false;\r\n  document.JH_lit=document.JH_lit.slice(1); \/\/remove first item from queue.\r\n}\r\n\r\nfunction processQueue() {\r\n  var delay = 500;\r\n  var a = document.JH_lit;\r\n  if (a&&(x=a[0])&&(!x.lit))\r\n  {\r\n    lightImage(x);\r\n    setTimeout(\"unlightImage()\",delay);\r\n  }\r\n  setTimeout(\"processQueue()\",200);\r\n}\r\n\r\nfunction initializeStuff(){\r\n  document.buttonColors = new Array (\"red\", \"blue\", \"green\", \"yellow\");\r\n}\r\n\r\nfunction generateSequence(sequenceLength){\r\n  document.sequence = new Array;\r\n  for (var i=0; i<sequenceLength; i++)\r\n  {\r\n    document.sequence[i] = Math.floor(Math.random() * 4);\r\n\r\n    if (document.sequence[i] == 0)\r\n      addToQueue('button11','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_red.gif')\r\n    if (document.sequence[i] == 1)\r\n      addToQueue('button12','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_blue.gif')\r\n    if (document.sequence[i] == 2)\r\n      addToQueue('button21','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_green.gif')\r\n    if (document.sequence[i] == 3)\r\n      addToQueue('button22','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_yellow.gif')\r\n  }\r\n \/\/ alert (document.sequence);\r\n}\r\n\r\nfunction MM_callJS(jsStr) { \/\/v2.0\r\n  return eval(jsStr)\r\n}\r\n\r\nfunction MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL) { \/\/v3.0\r\n  var newURL='', verStr=navigator.appVersion, app=navigator.appName, version = parseFloat(verStr);\r\n  if (app.indexOf('Netscape') != -1) {\r\n    if (version >= NSvers) {if (NSpass>0) newURL=(NSpass==1)?URL:altURL;}\r\n    else {if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;}\r\n  } else if (app.indexOf('Microsoft') != -1) {\r\n    if (version >= IEvers || verStr.indexOf(IEvers) != -1)\r\n     {if (IEpass>0) newURL=(IEpass==1)?URL:altURL;}\r\n    else {if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;}\r\n  } else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;\r\n  if (newURL) { window.location=unescape(newURL); document.MM_returnValue=false; }\r\n}\r\n\r\nwindow.addEventListener(\"load\", (event) => {\r\n  MM_preloadImages('https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_redborder.gif','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_greenborder.gif','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_blueborder.gif','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_yellowborder.gif','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_red.gif','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_green.gif','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_blue.gif','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_yellow.gif');\r\n  initializeStuff();\r\n  processQueue();\r\n  MM_checkBrowser(4.0,0,1,4.0,0,1,1,'otherbrowsers.html','');\r\n  return document.MM_returnValue;\r\n});\r\n\r\n\/\/-->\r\n<\/script>\r\n<p>In the game of Follow Me!, the computer lights up the colored boxes in a random sequence; your task is then to repeat the sequence in order.<\/p>\r\n<p>Before you click the <b>Begin<\/b> button, you can play around by clicking squares to light them up.<\/p>\r\n<p>After you click the <b>Begin<\/b> button, wait until the sequence is done playing before you click a square.<\/p>\r\n<p>In some cases, the computer\u2019s sequence may not show a black box in between two of the same color box, so what should be multiple consecutive flashes of a single color look like just one long flash. I\u2019m not sure under what circumstances that happens; sometimes it does, sometimes it doesn\u2019t. If it happens to you, try reloading the page.<\/p>\r\n<hr width=\"25%\" \/>\r\n<form method=\"post\" action=\"\" name=\"inputForm\">\r\n  <p>Choose a sequence length and then click <b>Begin<\/b>.<\/p>\r\n  <p> \r\n    <select name=\"seqLengthChooser\">\r\n      <option value=\"1\">1<\/option>\r\n      <option value=\"2\">2<\/option>\r\n      <option value=\"4\">4<\/option>\r\n      <option value=\"8\">8<\/option>\r\n      <option value=\"16\">16<\/option>\r\n    <\/select>\r\n    <input type=\"button\" name=\"begin\" value=\"Begin\" onClick=\"MM_callJS('generateSequence(document.inputForm.seqLengthChooser.options[document.inputForm.seqLengthChooser.selectedIndex].value);')\">\r\n  <\/p>\r\n<\/form>\r\n<p>&nbsp;<\/p>\r\n<p>&nbsp;<\/p>\r\n<table>\r\n  <tr>\r\n    <td><a href=\"javascript:;\" onClick=\"buttonClicked(0,'button11','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_red.gif')\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('button11','','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_redborder.gif',1)\"><img name=\"button11\" border=\"0\" src=\"https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_black.gif\" width=\"100\" height=\"100\"><\/a><\/td>\r\n    <td><a href=\"javascript:;\" onClick=\"buttonClicked(1,'button12','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_blue.gif')\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('button12','','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_blueborder.gif',1)\"><img name=\"button12\" border=\"0\" src=\"https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_black.gif\" width=\"100\" height=\"100\"><\/a><\/td>\r\n  <\/tr>\r\n  <tr>\r\n    <td><a href=\"javascript:;\" onClick=\"buttonClicked(2,'button21','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_green.gif')\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('button21','','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_greenborder.gif',1)\"><img name=\"button21\" border=\"0\" src=\"https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_black.gif\" width=\"100\" height=\"100\"><\/a><\/td>\r\n    <td><a href=\"javascript:;\" onClick=\"buttonClicked(3,'button22','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_yellow.gif')\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('button22','','https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_yellowborder.gif',1)\"><img name=\"button22\" border=\"0\" src=\"https:\/\/www.kith.org\/jed\/wp-content\/uploads\/sites\/2\/2023\/08\/square_black.gif\" width=\"100\" height=\"100\"><\/a><\/td>\r\n  <\/tr>\r\n<\/table>\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n\r\n<h2>Notes<\/h2>\r\n<p>Game inspired by the game of Simon, of course.<\/p>\r\n<p>Written by Jed Hartman in 1999, using JavaScript code mostly generated by Dreamweaver. In 2023, I was impressed to find that all of the JS code still worked, without modification, in its original page. When I copied it over to this WordPress page, I had to make a couple of small modifications; for example, I had to change the <code>onLoad<\/code> event handler to <code>window.addEventListener<\/code>. And moving it to WordPress seems to have introduced an intermittent timing bug that causes problems sometimes when the same color appears twice in a row in a given pattern. But still, the 25-year-old JS code is pretty close to working without changes; nice work, Dreamweaver engineers.<\/p>\r\n<\/html>\r\n\r\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":5,"featured_media":0,"parent":5479,"menu_order":70,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-20517","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.kith.org\/jed\/wp-json\/wp\/v2\/pages\/20517","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kith.org\/jed\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.kith.org\/jed\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.kith.org\/jed\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kith.org\/jed\/wp-json\/wp\/v2\/comments?post=20517"}],"version-history":[{"count":21,"href":"https:\/\/www.kith.org\/jed\/wp-json\/wp\/v2\/pages\/20517\/revisions"}],"predecessor-version":[{"id":20666,"href":"https:\/\/www.kith.org\/jed\/wp-json\/wp\/v2\/pages\/20517\/revisions\/20666"}],"up":[{"embeddable":true,"href":"https:\/\/www.kith.org\/jed\/wp-json\/wp\/v2\/pages\/5479"}],"wp:attachment":[{"href":"https:\/\/www.kith.org\/jed\/wp-json\/wp\/v2\/media?parent=20517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}