{"id":48039,"date":"2020-02-19T03:01:57","date_gmt":"2020-02-18T17:01:57","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=48039"},"modified":"2020-02-19T06:07:17","modified_gmt":"2020-02-18T20:07:17","slug":"nimh-game-for-two-remote-players-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/nimh-game-for-two-remote-players-tutorial\/","title":{"rendered":"Nimh Game for Two Remote Players Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/Nimh\/index.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Nimh Game for Two Remote Players Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/nimh_sms.jpg\" title=\"Nimh Game for Two Remote Players Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Nimh Game for Two Remote Players Tutorial<\/p><\/div>\n<p>The recent <a title='Nimh Game Revisit Tutorial' href='#ngrt'>Nimh Game Revisit Tutorial<\/a> continued the idea with our Nimh game, whereby a human plays the computer, and we take it you can see that two players within reach of a device playing the game could collaborate as a two player choice.   But what about a competitive two player mode of use?  Yes, that might be good, but how?<\/p>\n<p>Solutions wise, from coolest to hottest (does not compute?) &#8230;<\/p>\n<ol>\n<li>PHP mail inline HTML form email showing of matches in the body of the email &#8230; but &#8230;\n<ul>\n<li>lots of current logic is Javascript which does not work with &#8220;inline HTML form email&#8221;<\/li>\n<li>images pointing at web server disks could be converted to data-URIs but then email would get too large in content size<\/li>\n<\/ul>\n<\/li>\n<li>PHP mail HTML content attachment that emailee has to download and click on to make happen<\/li>\n<li>client &#8220;a&#8221; href=sms: SMS link containing a &amp;body= argument that is a link to an RJM Programming domain Nimh game (resumption) webpage link<\/li>\n<li>client &#8220;a&#8221; href=mailto: email link containing a &amp;body= argument that is a link to an RJM Programming domain Nimh game (resumption) webpage link<\/li>\n<\/ol>\n<p>We&#8217;re opting for options 3 and 4 above, but don&#8217;t rule out 2 and 1 into the future.<\/p>\n<p>To make this happen a new SMS &#128223; emoji button piece of HTML &#8230;<\/p>\n<p><code><br \/>\n&lt;a onclick=asksms(); title=SMS style=cursor:pointer;text-decoration:none;&gt;&amp;#128223;&lt;\/a&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; with associated Javascript &#8230;<\/p>\n<p><code><br \/>\nfunction asksms() {<br \/>\n  if (document.getElementById('sms')) {<br \/>\n    var wassms=document.getElementById('sms').value;<br \/>\n    var smsis=prompt('Please enter comma separated SMS To,From', wassms);<br \/>\n    if (smsis) {<br \/>\n      if (smsis.trim() != '') {<br \/>\n        if (smsis.indexOf(',') == -1) {<br \/>\n         if (smsis == smsis.toUpperCase()) {<br \/>\n          smsis+=',' + smsis.toLowerCase();<br \/>\n         } else {<br \/>\n          smsis+=',' + smsis.toUpperCase();<br \/>\n         }<br \/>\n        }<br \/>\n        document.getElementById('sms').value=smsis;<br \/>\n      }<br \/>\n    }<br \/>\n  }<br \/>\n}<br \/>\n<\/code><\/p>\n<p> &#8230; and similar thoughts for Email &#128231; button.  On macOS an SMS address can be an email address, on occasions, and we cater for both possibilities, in this scenario.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/nimh-game-for-two-remote-players-tutorial\/'>Nimh Game for Two Remote Players Tutorial<\/a>.<\/p-->\n<hr>\n<p id='ngrt'>Previous relevant <a target=_blank title='Nimh Game Revisit Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/nimh-game-revisit-tutorial\/'>Nimh Game Revisit Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/Nimh\/index.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Nimh Game Revisit Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/nimh_fixes.jpg\" title=\"Nimh Game Revisit Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Nimh Game Revisit Tutorial<\/p><\/div>\n<p>We&#8217;re revisiting our Nimh (&#8220;play the computer and do not get stuck with the last match&#8221;) <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Game\/Nimh\/index.php\" title=\"Click picture\">game<\/a> today, for a few reasons &#8230;<\/p>\n<ul>\n<li>it had slowed down, reading through user files, but every now and then we can maintain that &#8230; as well as realizing &#8230;<\/li>\n<li>the effect of &#8230;\n<ol>\n<li>the sizing we&#8217;d established for the matches &#8230; combined with &#8230;<\/li>\n<li>the vertical alignment we&#8217;d established for a &#8220;whole matches row deletion&#8221; &#8220;a&#8221; link &#8230; as well as &#8230;<\/li>\n<li>non-mobile onmouseover (ie. on hover) logic we&#8217;d applied to preview what could happen should you follow through with your proposed move<\/li>\n<\/ol>\n<p> &#8230; had (unbeknown to us, sometime back &#8230; sorrrrrrrryyyyyyyy) set up the dreaded &#8220;whac-a-mole&#8221; situation whereby the &#8220;a&#8221; link would move away from &#8220;clickability&#8221; when hovering on the way to really wanting to click the &#8220;a&#8221; link &#8230; very frustrating &#8230; and the CSS solution panned out to be &#8230;<br \/>\n<code><br \/>\n&lt;style&gt;<br \/>\n a { vertical-align:top; }<br \/>\n&lt;\/style&gt;<br \/>\n<\/code>\n<\/li>\n<li>it had many &#8220;Mixed Content&#8221; situations causing problems, now more &#8220;fatal&#8221; with the web browsers whereby the coding allows for a mix of &#8220;HTTP:&#8221; protocol content to mix with &#8220;HTTPS:&#8221; protocol content, or vice versa &#8230; the fix being &#8230;<br \/>\n<code><br \/>\nFix mixed content<br \/>\nvia mapping of<br \/>\nHTTP:\/\/ and HTTPS:\/\/<br \/>\nhardcodings to<br \/>\n\/\/<br \/>\n<\/code>\n<\/li>\n<li>had two PHP bugs where in &#8220;header(&#8216;Location: \/Games\/Nimh\/index.php&#8217;);&#8221; we had spurious characters to the right of &#8220;:&#8221; &#8230; sorrrrrrrrrryyyyyyy (for some scenarios)<\/li>\n<li>fixed the size of matches that in some scenarios was far too big<\/li>\n<\/ul>\n<p> &#8230; that we hope makes the game below more bearable &#8230;<\/p>\n<p><iframe src=\"\/\/www.rjmprogramming.com.au\/Games\/Nimh\/index.php\" style=\"width:100%;height:900px;\"><\/iframe><\/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='#d48029' onclick='var dv=document.getElementById(\"d48029\"); 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='d48029' 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='#d48039' onclick='var dv=document.getElementById(\"d48039\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/sms\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d48039' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The recent Nimh Game Revisit Tutorial continued the idea with our Nimh game, whereby a human plays the computer, and we take it you can see that two players within reach of a device playing the game could collaborate as &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/nimh-game-for-two-remote-players-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,37],"tags":[211,222,281,380,476,1608,590,1807,2772,3226,3225,871,932,997,1133,1137,1159,1682,1319,1802],"class_list":["post-48039","post","type-post","status-publish","format-standard","hentry","category-elearning","category-games","category-tutorials","tag-click","tag-collaborate","tag-css","tag-email","tag-game","tag-hover","tag-image","tag-link","tag-match","tag-mixed-content","tag-nimh","tag-onmouseover","tag-php","tag-programming","tag-share","tag-sharing","tag-sms","tag-ssl","tag-tutorial","tag-vertical-align"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/48039"}],"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=48039"}],"version-history":[{"count":7,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/48039\/revisions"}],"predecessor-version":[{"id":48049,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/48039\/revisions\/48049"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=48039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=48039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=48039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}