{"id":73731,"date":"2026-07-04T03:01:00","date_gmt":"2026-07-03T17:01:00","guid":{"rendered":"https:\/\/www.rjmprogramming.com.au\/ITblog\/?p=73731"},"modified":"2026-07-03T14:26:55","modified_gmt":"2026-07-03T04:26:55","slug":"pairings-game-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/pairings-game-tutorial\/","title":{"rendered":"Pairings Game Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/pairings_game.html\" rel=\"noopener\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Pairings Game Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/pairings_game.jpg\" title=\"Pairings Game Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Pairings Game Tutorial<\/p><\/div>\n<p>In this programming world, it is comforting to think of the &#8220;pairings&#8221; that go on.  But it&#8217;s everywhere, the comfort a &#8220;pairing&#8221; can represent for people.<\/p>\n<p>With this in mind, we designed a simple game &#8230;<\/p>\n<ul>\n<li>the player is presented with 5 ideas of a &#8220;pairing&#8221; &#8230; it&#8217;s subjective, but &#8230;<\/li>\n<li>we believe only one of these will score you a point by clicking on<\/li>\n<\/ul>\n<p> &#8230; in this <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/pairings_game.html_GETME\" rel=\"noopener\">first draft<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/pairings_game.html\" rel=\"noopener\">Pairings Game<\/a> whose tabular cell innards consist of 5 buttons and 5 <a target=\"_blank\" title='Overlay postings' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/overlay' rel=\"noopener\">overlay<\/a>ing &#8230;<\/p>\n<p><code><br \/>\n   var rectos=[];<br \/>\n<br \/>\n   function prepopulate() { \/\/ called at document.body onload<br \/>\n      for (var icell=0; icell&lt;5; icell++) {<br \/>\n       rectos.push(document.getElementById('td' + eval(1 + icell)).getBoundingClientRect());<br \/>\n      }<br \/>\n   }<br \/>\n   <br \/>\n   function populate() {  \/\/ called whenever question changes<br \/>\n     var fivebuts=[], fiveoverlays=[];<br \/>\n     var makecorrect=Math.floor(Math.random() * 5), recto=null;<br \/>\n     var interestg=-1, tg=-1;<br \/>\n     sofarb=',';<br \/>\n     sofaro=',';<br \/>\n     <br \/>\n     for (var icell=0; icell&lt;5; icell++) {<br \/>\n       recto=rectos[icell]; \/\/document.getElementById('td' + eval(1 + icell)).getBoundingClientRect();<br \/>\n       interestg=Math.floor(Math.random() * eval('' + pairingsa.length));<br \/>\n       if (makecorrect == icell) {<br \/>\n         while ((sofarb + sofaro).indexOf(',' + interestg + ',') != -1) {<br \/>\n           interestg=Math.floor(Math.random() * eval('' + pairingsa.length));<br \/>\n         }<br \/>\n         fivebuts.push(interestg);<br \/>\n         fiveoverlays.push(interestg);<br \/>\n         sofarb+='' + interestg + ',';<br \/>\n         sofaro+='' + interestg + ',';<br \/>\n         if (eval(Math.floor(Math.random() * 19876754) % 2) == 0) {<br \/>\n         document.getElementById('td' + eval(1 + icell)).innerHTML='&lt;button onclick=scoreit(1);&gt;' + pairingsa[interestg].split('&')[1] + '&lt;\/button&gt;&lt;div style=\"margin-left:10px;margin-top:10px;font-size:24px;position:absolute;top:' + ('' + recto.top).split('.')[0] + 'px;' + 'left:' + ('' + recto.left).split('.')[0] + 'px;width:' + ('' + recto.width).split('.')[0] + 'px;height:' + ('' + recto.height).split('.')[0] + 'px;z-index:2345;opacity:0.6;pointer-events:none;\"&gt;' + pairingsa[interestg].split('&')[0] + '&lt;\/div&gt;';<br \/>\n         } else {<br \/>\n         document.getElementById('td' + eval(1 + icell)).innerHTML='&lt;button onclick=scoreit(1);&gt;' + pairingsa[interestg].split('&')[0] + '&lt;\/button&gt;&lt;div style=\"margin-left:10px;margin-top:10px;font-size:24px;position:absolute;top:' + ('' + recto.top).split('.')[0] + 'px;' + 'left:' + ('' + recto.left).split('.')[0] + 'px;width:' + ('' + recto.width).split('.')[0] + 'px;height:' + ('' + recto.height).split('.')[0] + 'px;z-index:2345;opacity:0.6;pointer-events:none;\"&gt;' + pairingsa[interestg].split('&')[1] + '&lt;\/div&gt;';<br \/>\n         }<br \/>\n       } else {<br \/>\n         while (sofarb.indexOf(',' + interestg + ',') != -1) {<br \/>\n           interestg=Math.floor(Math.random() * eval('' + pairingsa.length));<br \/>\n         }<br \/>\n         sofarb+='' + interestg + ',';<br \/>\n         tg=interestg;<br \/>\n         interestg=Math.floor(Math.random() * eval('' + pairingsa.length));<br \/>\n         while ((sofarb + sofaro).indexOf(',' + interestg + ',') != -1 || tg == interestg) {<br \/>\n           interestg=Math.floor(Math.random() * eval('' + pairingsa.length));<br \/>\n         }<br \/>\n         sofaro+='' + interestg + ',';<br \/>\n         if (eval(Math.floor(Math.random() * 19876754) % 2) == 0) {<br \/>\n         document.getElementById('td' + eval(1 + icell)).innerHTML='&lt;button onclick=scoreit(0);&gt;' + pairingsa[interestg].split('&')[1] + '&lt;\/button&gt;&lt;div style=\"margin-left:10px;margin-top:10px;font-size:24px;position:absolute;top:' + ('' + recto.top).split('.')[0] + 'px;' + 'left:' + ('' + recto.left).split('.')[0] + 'px;width:' + ('' + recto.width).split('.')[0] + 'px;height:' + ('' + recto.height).split('.')[0] + 'px;z-index:2345;opacity:0.6;pointer-events:none;\"&gt;' + pairingsa[tg].split('&')[0] + '&lt;\/div&gt;';<br \/>\n         } else {<br \/>\n         document.getElementById('td' + eval(1 + icell)).innerHTML='&lt;button onclick=scoreit(0);&gt;' + pairingsa[tg].split('&')[0] + '&lt;\/button&gt;&lt;div style=\"margin-left:10px;margin-top:10px;font-size:24px;position:absolute;top:' + ('' + recto.top).split('.')[0] + 'px;' + 'left:' + ('' + recto.left).split('.')[0] + 'px;width:' + ('' + recto.width).split('.')[0] + 'px;height:' + ('' + recto.height).split('.')[0] + 'px;z-index:2345;opacity:0.6;pointer-events:none;\"&gt;' + pairingsa[interestg].split('&')[1] + '&lt;\/div&gt;';<br \/>\n         }<br \/>\n       }<br \/>\n     }<br \/>\n<br \/> <br \/>\n   }<br \/>\n<\/code><\/p>\n<p> &#8230; div elements (<font size=1>optionally<\/font> we&#8217;ve decided to apply <a target=\"_blank\" title='CSS pointer-events information from W3schools' href='https:\/\/www.w3schools.com\/cssref\/css3_pr_pointer-events.php' rel=\"noopener\"><i>pointer-events:none;<\/i><\/a> to, per game question.<\/p>\n<p>Pretty, simple, huh?!<\/p>\n<p><iframe style=\"width:100%;height:900px;\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/pairings_game.html\"><\/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='#d30150' onclick='var dv=document.getElementById(\"d30150\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/photobooth\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d30150' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this programming world, it is comforting to think of the &#8220;pairings&#8221; that go on. But it&#8217;s everywhere, the comfort a &#8220;pairing&#8221; can represent for people. With this in mind, we designed a simple game &#8230; the player is presented &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/pairings-game-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,14,15,37],"tags":[5568,476,576,652,2910,5146,5430,997,1319],"class_list":["post-73731","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-games","category-tutorials","tag-duo","tag-game","tag-html","tag-javascript","tag-pair","tag-pairing","tag-pairings","tag-programming","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/73731"}],"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=73731"}],"version-history":[{"count":7,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/73731\/revisions"}],"predecessor-version":[{"id":73740,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/73731\/revisions\/73740"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=73731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=73731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=73731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}