{"id":56025,"date":"2022-06-26T03:01:23","date_gmt":"2022-06-25T17:01:23","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=56025"},"modified":"2024-01-10T12:28:56","modified_gmt":"2024-01-10T02:28:56","slug":"word-guessing-or-synonym-game-right-click-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/word-guessing-or-synonym-game-right-click-tutorial\/","title":{"rendered":"Word Guessing or Synonym Game Right Click Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.html\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Word Guessing or Synonym Game Right Click Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame_three.jpg\" title=\"Word Guessing or Synonym Game Right Click Tutorial\" \/><\/a><p class=\"wp-caption-text\">Word Guessing or Synonym Game Right Click Tutorial<\/p><\/div>\n<p>When we presented <a title='Word Guessing or Synonym Game for Two Tutorial' href='#wgsgtt'>Word Guessing or Synonym Game for Two Tutorial<\/a> we were curious about &#8230;<\/p>\n<ul>\n<li>word game &#8230;<\/li>\n<li>played by more than one player &#8230;<\/li>\n<li>all using the one device<\/li>\n<\/ul>\n<p> &#8230; and, back then, settled on a two player word game that worked it so that &#8230;<\/p>\n<ol>\n<li>one player enters word guesses via mouse or touch gestures on that &#8220;one device&#8221; &#8230;<\/li>\n<li>one player enters word guesses via keyboard on that &#8220;one device&#8221;<\/li>\n<\/ol>\n<p> &#8230; but, today, we&#8217;re revisiting this word game trying <font color=blue>to add<\/font> &#8230;<\/p>\n<ol>\n<li>one player enters word guesses via mouse or touch gestures on that &#8220;one device&#8221; &#8230;<\/li>\n<li>one player enters word guesses via keyboard on that &#8220;one device&#8221;<font color=blue> &#8230; <\/font><\/li>\n<li>one player enters word guesses via <font color=blue>right<\/font> mouse clicks on that &#8220;one device&#8221; &#8230;<\/li>\n<\/ol>\n<p> &#8230; via the great <a target=_blank title='Custom right click menu access advice, thanks' href='https:\/\/stackoverflow.com\/questions\/4909167\/how-to-add-a-custom-right-click-menu-to-a-webpage'>context menu<\/a> (ie. right click <a target=_blank title='Event oncontextmenu information from W3schools' href='https:\/\/www.w3schools.com\/jsref\/obj_mouseevent.asp'>&#8220;oncontextmenu&#8221;<\/a> event) access advice used in &#8230;<\/p>\n<p><code><br \/>\nif (document.addEventListener) {<br \/>\n  document.addEventListener('contextmenu', function(e) {<br \/>\n    if (rcok) {<br \/>\n    e.preventDefault();<br \/>\n    activeplayer=3; \/\/alert(\"You've tried to open context menu\"); \/\/here you draw your own menu<br \/>\n    document.getElementById('tblthree').style.visibility='visible';<br \/>\n    document.getElementById('tblone').style.visibility='hidden';<br \/>\n    document.getElementById('sone').style.textDecoration='underline';<br \/>\n    document.getElementById('sone').style.cursor='pointer';<br \/>\n    }<br \/>\n  }, false);<br \/>\n} else {<br \/>\n  document.attachEvent('oncontextmenu', function() {<br \/>\n    if (rcok) {<br \/>\n    window.event.returnValue = false;<br \/>\n    activeplayer=3; \/\/alert(\"You've tried to open context menu\");<br \/>\n    document.getElementById('tblthree').style.visibility='visible';<br \/>\n    document.getElementById('tblone').style.visibility='hidden';<br \/>\n    document.getElementById('sone').style.textDecoration='underline';<br \/>\n    document.getElementById('sone').style.cursor='pointer';<br \/>\n    }<br \/>\n  });<br \/>\n}<br \/>\n<\/code><\/p>\n<p> &#8230; <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.html---GETME\" title=\"wordguessgame.html\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.html---GETME\" title=\"wordguessgame.html\">wordguessgame.html<\/a> code in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.html\" title=\"Click picture\">live run<\/a> Word Guess Game for Up to Three.<\/p>\n<p><b><i>Stop Press<\/b><\/i><\/p>\n<p>The Bulls and Cow game ideas in December 2022 in <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/htmljavascript-bulls-and-cows-game-primer-tutorial\/' title='HTML\/Javascript Bulls and Cows Game Primer Tutorial'>HTML\/Javascript Bulls and Cows Game Primer Tutorial<\/a> helped with ideas to improve the &#8220;names&#8221; management parts to this game for <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.html----GETME\" title=\"wordguessgame.html\">a tweaked<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.html----GETME\" title=\"wordguessgame.html\">wordguessgame.html<\/a> code in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.html\" title=\"Click picture\">live run<\/a> Word Guess Game for Up to Three. <\/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\/word-guessing-or-synonym-game-right-click-tutorial\/'>Word Guessing or Synonym Game Right Click Tutorial<\/a>.<\/p-->\n<hr>\n<p id='wgsgtt'>Previous relevant <a target=_blank title='Word Guessing or Synonym Game for Two Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/word-guessing-or-synonym-game-for-two-tutorial\/'>Word Guessing or Synonym Game for Two 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\/wordguessgame.html\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Word Guessing or Synonym Game for Two Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguesssynonym.jpg\" title=\"Word Guessing or Synonym Game for Two Tutorial\" \/><\/a><p class=\"wp-caption-text\">Word Guessing or Synonym Game for Two Tutorial<\/p><\/div>\n<p>The reminder of just how brilliant is the &#8230;<\/p>\n<ul>\n<li><a target=_blank title='WordReference website' href='http:\/\/wordreference.com'>WordReference<\/a> website &#8230; the reminder occurring when we presented the recent <a target=_blank title='Italian French Spanish Verb Conjugation Emoji Image Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/italian-french-spanish-verb-conjugation-emoji-image-tutorial\/'>Italian French Spanish Verb Conjugation Emoji Image Tutorial<\/a> &#8230; combined with &#8230;<\/li>\n<li>the search for a web application with synergy, leading us to <a title='Word Guessing Game for Two Primer Tutorial' href='#wggtpt'>Word Guessing Game for Two Primer Tutorial<\/a> &#8230; has us, today &#8230;<\/li>\n<\/ul>\n<p> &#8230; adding onto &#8230;<\/p>\n<ul>\n<li>Word Guess &#8220;buzzing in&#8221; for two players &#8230; with &#8230;<\/li>\n<li>Synonym (in English) Guess &#8220;buzzing in&#8221; for two players<\/li>\n<\/ul>\n<p> &#8230; as some additional functionality to this game calling on the good ol&#8217; &#8220;\/usr\/share\/dict\/words&#8221; inbuilt dictionary of words that comes with Linux (and macOS) &#8220;out of the box&#8221; &#8230; hooooorayyyyy!<\/p>\n<p>In broad brush terms, we use &#8230;<\/p>\n<ul>\n<li>the Linux &#8220;\/usr\/share\/dict\/words&#8221; inbuilt dictionary of English words to pick a candidate word &#8230;<\/li>\n<li>ask, via <a target=_blank title='jQuery Ajax information' href='http:\/\/api.jquery.com\/jquery.ajax\/'>jQuery Ajax<\/a> of <a target=_blank title='WordReference website' href='http:\/\/wordreference.com'>WordReference<\/a> if this word has synonyms &#8230;\n<ol>\n<li>if not, reask &#8220;\/usr\/share\/dict\/words&#8221; inbuilt dictionary for a word &#8230; else &#8230;<\/li>\n<li>sit there and wait for a &#8220;buzz in&#8221; via mouse or keyboard for a player answer, and if they are correct, their score increases by the length of the synonym word(s)<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p>Here&#8217;s a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.html\" title='Click picture'>live run<\/a> and here is the HTML programming source code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.html--GETME\" title=\"wordguessgame.html\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.html--GETME\" title=\"wordguessgame.html\">wordguessgame.html<\/a> code.<\/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\/word-guessing-or-synonym-game-for-two-tutorial\/'>Word Guessing or Synonym Game for Two Tutorial<\/a>.<\/p-->\n<hr>\n<p id='wggtpt'>Previous relevant <a target=_blank title='Word Guessing Game for Two Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/word-guessing-game-for-two-primer-tutorial\/'>Word Guessing Game for Two 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\/wordguessgame.html\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Word Guessing Game for Two Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.jpg\" title=\"Word Guessing Game for Two Primer Tutorial\" \/><\/a><p class=\"wp-caption-text\">Word Guessing Game for Two Primer Tutorial<\/p><\/div>\n<p>Word Games help vocabulary for <a target=_blank title='English as a second or foreign language' href='https:\/\/en.wikipedia.org\/wiki\/English_as_a_second_or_foreign_language'>ESL<\/a> students.  There is also not much doubt that collaboration can help ESL students, who also learn quicker with other students present.<\/p>\n<p>Today we create a web application Word Guessing Game designed for two.  Not two devices, the one device for two users (hovering over it).  So for &#8230;<\/p>\n<ul>\n<li>non-mobile users can play the game with one user using the mouse and the other using the keyboard<\/li>\n<li>mobile users can play with one user using touch on the blue areas of the web application and the other using touch on other places<\/li>\n<\/ul>\n<p>The events we code for are &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Javascript onclick event information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/event_onclick.asp'>onclick<\/a>  &#8230; will be recognised on non-mobile platforms<\/li>\n<li><a target=_blank title='Javascript ontouchstart event information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/dom_obj_event.asp'>ontouchstart<\/a>  &#8230; will be recognised on mobile platforms (where it will supercede any onlick event)<\/li>\n<li><a target=_blank title='Javascript onkeyup event information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/event_onkeyup.asp'>onkeyup<\/a> &#8230;  will be recognised on non-mobile platforms<\/li>\n<\/ul>\n<p> &#8230; so you can see that the colour coding of the webpage becomes important for the mobile platform usage.<\/p>\n<p>Today&#8217;s game tests English vocabulary skills.  Why just English?   Well, it uses English words, based on the dictionary arrangements at its (web) server, which happens to be based on English.<\/p>\n<p>Programmers often use <a target_blank title='Words (unix) information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/Words_%28Unix%29'>Linux dictionary files<\/a> as a means to get a word list, and that list could be in any language, and for ours it is English.<\/p>\n<p>Here&#8217;s a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.html\" title='Click picture'>live run<\/a> and here is the HTML programming source code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/wordguessgame.html_GETME\" title=\"wordguessgame.html\">wordguessgame.html<\/a> which, again, uses some PHP we&#8217;ve talked about with a lot of our <a target=_blank title='Word Games' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/word-game'>word games<\/a> at this blog, on a &#8220;Client Pre-Emptive Iframe&#8221; scenario in a couple of HTML iframe elements we include into today&#8217;s game.  We thank this free online <a target=_blank href=\"http:\/\/www.thefreedictionary.com\/\">English<\/a> dictionary that gets called on if the user chooses to.<\/p>\n<p>We hope you try it, and like it.  By the way, you can also play the game as a single user.<\/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='#d17485' onclick='var dv=document.getElementById(\"d17485\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=SQL\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d17485' 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='#d51091' onclick='var dv=document.getElementById(\"d51091\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/synonym\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d51091' 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='#d51091' onclick='var dv=document.getElementById(\"d51091\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/synonym\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d51091' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>When we presented Word Guessing or Synonym Game for Two Tutorial we were curious about &#8230; word game &#8230; played by more than one player &#8230; all using the one device &#8230; and, back then, settled on a two player &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/word-guessing-or-synonym-game-right-click-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":[211,3865,281,322,354,400,476,576,4647,652,3987,873,952,997,1069,1200,1319,1453],"class_list":["post-56025","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-games","category-tutorials","tag-click","tag-context-menu","tag-css","tag-device","tag-dom","tag-event","tag-game","tag-html","tag-huddling","tag-javascript","tag-oncontextmenu","tag-ontouchstart","tag-player","tag-programming","tag-right-click","tag-stop-press","tag-tutorial","tag-word-game"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/56025"}],"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=56025"}],"version-history":[{"count":4,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/56025\/revisions"}],"predecessor-version":[{"id":57871,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/56025\/revisions\/57871"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=56025"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=56025"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=56025"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}