{"id":35879,"date":"2018-02-04T03:01:07","date_gmt":"2018-02-03T17:01:07","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=35879"},"modified":"2018-02-03T20:32:02","modified_gmt":"2018-02-03T10:32:02","slug":"rainbow-games-genericization-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/rainbow-games-genericization-tutorial\/","title":{"rendered":"Rainbow Games Genericization Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation.htm\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Rainbow Games Genericization Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation_row.jpg\" title=\"Rainbow Games Genericization Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Rainbow Games Genericization Tutorial<\/p><\/div>\n<p>What would help genericize the recent <a title='Rainbow Games Double Transformation Tutorial' href='#rgdtt'>Rainbow Games Double Transformation Tutorial<\/a> &#8220;Rainbow Games&#8221; web application?   How about introducing another sport?<\/p>\n<p>Again, in honour of &#8220;onions of the 4th dimension&#8221; approaches, we mainly, turn to the power of Javascript&#8217;s <a target=_blank href='http:\/\/www.w3schools.com\/jsref\/jsref_eval.asp' title='Javascript eval'>eval<\/a> methodology to achieve this <a target=_blank title='Abstraction information from Wikipedia, thanks.' href='https:\/\/en.wikipedia.org\/wiki\/Abstraction'>abstracted<\/a> feeling to our web application.  Today, with this, we go <b>two thirds<\/b> of the way along the &#8220;Mathematical Induction&#8221; approach &#8230;<\/p>\n<ul>\n<li><b>prove for the first case<\/b><\/li>\n<li><b>prove for the second case<\/b><\/li>\n<li>prove for the n<sup>th<\/sup> case<\/li>\n<\/ul>\n<p>How does this use of Javascript eval manifest itself in this way?<\/p>\n<ul>\n<li>there are two arrays that work with the &#8220;content&#8221; of our &#8220;Rainbow Games&#8221; sport(s) (<font size=1>well, at least, the first &#8220;sprint running&#8221; sport<\/font>) called <i>emoticons[]<\/i> and <i>choices[]<\/i><\/li>\n<li>wherever we find references in the code to either of these two arrays we start to <b>involve<\/b> the global var<font size=1>iable<\/font> <b>verbsuffix<\/b> &#8230;<br \/>\n<code><br \/>\nvar verb='Sprint';<br \/>\nvar verbs=['Sprint','Row'];<br \/>\nvar anotherverb='run';<br \/>\n<b>var verbsuffix='';<\/b><br \/>\n<\/code><br \/>\n &#8230; in <b>altered<\/b> ways like &#8230;<br \/>\n<code><br \/>\nfunction plus(ih,ihep) {<br \/>\n  var outihep=ihep;<br \/>\n  if (<b>eval(\"<\/b>emoticons<b>\" + verbsuffix + \"<\/b>[<b>\" + <\/b>ih<b> + \"<\/b>]<b>\")<\/b>.indexOf('&lt;p&gt;') != -1) {<br \/>\n    outihep += ' (' + <b>eval(\"<\/b>emoticons<b>\" + verbsuffix + \"<\/b>[<b>\" + <\/b>ih<b> + \"<\/b>]<b>\")<\/b>.split('&lt;p&gt;')[1].split('&lt;')[0] + ')';<br \/>\n  }<br \/>\n  return outihep;<br \/>\n}<br \/>\n<\/code><br \/>\n &#8230; in that <i>abstracted<\/i> way &#8230; noting that sometimes you don&#8217;t need the &#8220;eval()&#8221; encasings &#8230;\n<\/li>\n<li>and so, working through the code this way it just falls to the coder to define new members for all the arrays for all the new sports (ours is &#8220;rowing&#8221; today), some of those new arrays (like for rowing are <i>emoticonsrowing[]<\/i> and <i>choicesrowing[]<\/i>) to involve &#8230;<\/li>\n<li>looking up emoji definitions from &#8230;\n<ol>\n<li><a target=_blank title='Emojipedia' href='http:\/\/www.emojipedia.org'>Emojipedia<\/a><\/li>\n<li><a target=_blank title='FileFormation Information website' href='http:\/\/www.fileformat.info'>FileFormat Information<\/a><\/li>\n<li><a target=_blank title='Iemoji website' href='http:\/\/www.iemoji.com'>Iemoji<\/a><\/li>\n<\/ol>\n<p>&#8230; not forgetting to &#8230;\n<\/li>\n<li>make sure the event logics work for multiple sport scenarios &#8230; but mostly they do by sticking to the principles above &#8230; especially for the &#8230;<\/li>\n<li>new HTML select (dropdown) element allows the user to pick a sport<\/li>\n<\/ul>\n<p>Remaining a work in progress, you can try out our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation.htm\" title=\"Click picture\">live run<\/a> link that has underlying HTML and Javascript and CSS <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation.html--GETME\" title=\"emoji_walk_animation.htm\">emoji_walk_animation.htm<\/a>, and which changed in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation.html--GETME\" title=\"emoji_walk_animation.html\">this way<\/a> regarding today&#8217;s genericization work.  We hope it gives you food for thought.<\/p>\n<hr>\n<p id='rgdtt'>Previous relevant <a target=_blank title='Rainbow Games Double Transformation Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/rainbow-games-double-transformation-tutorial\/'>Rainbow Games Double Transformation Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Rainbow Games Double Transformation Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation_dt.jpg\" title=\"Rainbow Games Double Transformation Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Rainbow Games Double Transformation Tutorial<\/p><\/div>\n<p>We were on the &#8220;road to personalization&#8221; for the web application game we started with yesterday&#8217;s <a title='Rainbow Games Primer Tutorial' href='#rgpt'>Rainbow Games Primer Tutorial<\/a> when &#8220;an old chestnut&#8221; came up again.  It&#8217;s happened before, the desire to &#8220;double transform&#8221; in CSS came about from our emoji &#8230; <\/p>\n<table>\n<tr>\n<td style='font-size:36px;'>&#127939;&#127998;&#8205;&#9792;&#65039;<\/td>\n<\/tr>\n<\/table>\n<p> &#8230; table cell <i>mirroring<\/i> styling as per &#8230;<\/p>\n<p><code><br \/>\n&lt;style&gt;<br \/>\n* { overflow-x: visible; }<br \/>\n<br \/>\nselect { font-size: 36px; }<br \/>\n<br \/>\ntd.runner { width: 50px; word-wrap: break-word; font-size: 36px;<br \/>\n     <i>transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform:  scale(-1, 1);<\/i><br \/>\n        }   \/\/ <\/p>\n<table>\n<tr>\n<td style='font-size:36px;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform:  scale(-1, 1);'>&#127939;&#127998;&#8205;&#9792;&#65039;<\/td>\n<\/tr>\n<\/table>\n<p>tr { max-height: 40px; }<br \/>\n&lt;\/style&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; necessary to make our running emojis run from left to right (that, alas, also transformed any accompanying &#8230; <\/p>\n<table>\n<tr>\n<td style='font-size:36px;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform:  scale(-1, 1);'>&#127939;&#127998;&#8205;&#9792;&#65039; <\/p>\n<p style=\"display: block; font-size: 12px;-\">Florence<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p> &#8230; name), was added to in <b>this double transformational clause<\/b> to prove what this <a target=_blank title='Great link, thanks' href='https:\/\/stackoverflow.com\/questions\/5406368\/can-you-use-css-to-mirror-flip-text'>wonderful web page<\/a> advice had to say.  In other words, a &#8220;double transform&#8221; CSS styling scenario like the one below &#8230;<\/p>\n<p><code><br \/>\n&lt;style&gt;<br \/>\n* { overflow-x: visible; }<br \/>\n<br \/>\nselect { font-size: 36px; }<br \/>\n<br \/>\ntd.runner { width: 50px; word-wrap: break-word; font-size: 36px;<br \/>\n     <i>transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform:  scale(-1, 1);<\/i><br \/>\n        }<br \/>\ntr { max-height: 40px; }<br \/>\n<br \/>\n<b>p {<br \/>\n    display: block;<br \/>\n    font-size: 12px;<br \/>\n    -webkit-transform: matrix(-1, 0, 0, 1, 0, 0);<br \/>\n    -moz-transform: matrix(-1, 0, 0, 1, 0, 0);<br \/>\n    -o-transform: matrix(-1, 0, 0, 1, 0, 0);<br \/>\n    transform: matrix(-1, 0, 0, 1, 0, 0);<br \/>\n}  <\/b>  \/\/ <\/p>\n<table style='width:50px;'>\n<tr style='width:50px;'>\n<td style='width:50px;font-size:36px;transform: scale(-1, 1); -o-transform: scale(-1, 1); -moz-transform: scale(-1, 1); -ms-transform: scale(-1, 1); -webkit-transform:  scale(-1, 1);'>&#127939;&#127998;&#8205;&#9792;&#65039; <\/p>\n<p style=\"display: block; font-size: 12px;-webkit-transform: matrix(-1, 0, 0, 1, 0, 0);-moz-transform: matrix(-1, 0, 0, 1, 0, 0);-o-transform: matrix(-1, 0, 0, 1, 0, 0);transform: matrix(-1, 0, 0, 1, 0, 0);\">Florence<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p>&lt;\/style&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; works as a &#8220;double transform&#8221; to first &#8230;<\/p>\n<ul>\n<li>mirror (image) flip the table cell (td) emoji data &#8230; but us appending some &#8220;Runner Name&#8221; textual data underneath also, annoyingly, got flipped  until &#8230;<\/li>\n<li>within that (same) table cell (td) element and after the emoji data we append an HTML <a target=_blank title='HTML p tag information from w3schools' href='https:\/\/www.w3schools.com\/tags\/tag_p.asp'>p<\/a>(aragraph) element to both &#8230;\n<ol>\n<li>introduce a new HTML element type into the (CSS styling) mix &#8230; and to &#8230;<\/li>\n<li>introduce a new CSS transformation type, the matrix &#8230; perhaps either or both new parts to the problem critical to its success when, believe me, lots of other approaches don&#8217;t work<\/li>\n<\/ol>\n<\/ul>\n<p> &#8230; to personalize the &#8220;runners&#8221; and &#8220;users&#8221;, optionally, &#8220;into the game&#8221;, by allowing the &#8220;user&#8221; to name their &#8220;runners&#8221; and allow for a &#8220;runner energy&#8221; setting be a bit randomized, to add for some other interest &#8220;variety&#8221; to the game&#8217;s workings.  So, still a work in progress that you can try out at our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation.html\" title=\"Click picture\">live run<\/a> link that has underlying HTML and Javascript and CSS <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation.html-GETME\" title=\"emoji_walk_animation.html\">emoji_walk_animation.html<\/a>, and which changed in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation.html-GETME\" title=\"emoji_walk_animation.html\">this way<\/a> regarding today&#8217;s work.<\/p>\n<hr>\n<p id='rgpt'>Previous relevant <a target=_blank title='Rainbow Games Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/rainbow-games-primer-tutorial\/'>Rainbow Games Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Interesting Places Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation.jpg\" title=\"Rainbow Games Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Rainbow Games Primer Tutorial<\/p><\/div>\n<p>It&#8217;s been a while since we&#8217;ve written any conventional HTML and Javascript and CSS game.  Today&#8217;s game uses the &#8220;emoticon&#8221; section of the Emoji character set, defaulting so far, to the &#8220;running woman&#8221; emoji featuring in <a target=_blank title='Compound Emoji WordPress Usage Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/compound-emoji-wordpress-usage-tutorial\/'>Compound Emoji WordPress Usage Tutorial<\/a>.<\/p>\n<p>It&#8217;s the early days of our &#8220;Rainbow Games&#8221; web application, and we&#8217;re starting with the animation featuring horizontal hashtag navigation techniques for a running race start to our game.  Where it finishes?  Hard to say! Today, we&#8217;ve looked at &#8220;splits&#8221; and a finish line.<\/p>\n<p>You can try out our burgeoning <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation.html\" title=\"Click picture\">live run game concept<\/a> link that has underlying HTML and Javascript and CSS <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emoji_walk_animation.html_GETME\" title=\"emoji_walk_animation.html\">emoji_walk_animation.html<\/a>.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d35745' onclick='var dv=document.getElementById(\"d35745\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/game\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d35745' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d35768' onclick='var dv=document.getElementById(\"d35768\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/transformation\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d35768' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d35879' onclick='var dv=document.getElementById(\"d35879\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/eval\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d35879' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>What would help genericize the recent Rainbow Games Double Transformation Tutorial &#8220;Rainbow Games&#8221; web application? How about introducing another sport? Again, in honour of &#8220;onions of the 4th dimension&#8221; approaches, we mainly, turn to the power of Javascript&#8217;s eval methodology &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/rainbow-games-genericization-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,15,1,37],"tags":[2458,126,127,230,281,399,446,1839,576,2459,652,2020,2300,2428,876,997,1917,1319,2454],"class_list":["post-35879","post","type-post","status-publish","format-standard","hentry","category-elearning","category-games","category-uncategorised","category-tutorials","tag-abstraction","tag-background","tag-background-image","tag-column","tag-css","tag-eval","tag-float","tag-genericization","tag-html","tag-induction","tag-javascript","tag-linear-gradient","tag-newspaper","tag-onion","tag-opacity","tag-programming","tag-scroll","tag-tutorial","tag-typesetting"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/35879"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=35879"}],"version-history":[{"count":8,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/35879\/revisions"}],"predecessor-version":[{"id":35925,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/35879\/revisions\/35925"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=35879"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=35879"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=35879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}