Word Guessing or Synonym Game Right Click Tutorial
โœ‚๐Ÿƒ๐Ÿพโ€โ™€๏ธ๐Ÿƒ๐Ÿผโ€โ™‚๏ธ
๐Ÿ“–

Word Guessing or Synonym Game Right Click Tutorial

Word Guessing or Synonym Game Right Click Tutorial   ๐Ÿ”

When we presented Word Guessing or Synonym Game for Two Tutorial we were curious about โ€ฆ

  • word game โ€ฆ
  • played by more than one player โ€ฆ
  • all using the one device

โ€ฆ and, back then, settled on a two player word game that worked it so that โ€ฆ

  1. one player enters word guesses via mouse or touch gestures on that โ€œone deviceโ€ โ€ฆ
  2. one player enters word guesses via keyboard on that โ€œone deviceโ€

โ€ฆ but, today, weโ€™re revisiting this word game trying to add โ€ฆ

  1. one player enters word guesses via mouse or touch gestures on that โ€œone deviceโ€ โ€ฆ
  2. one player enters word guesses via keyboard on that โ€œone deviceโ€ โ€ฆ
  3. one player enters word guesses via right mouse clicks on that โ€œone deviceโ€ โ€ฆ

โ€ฆ via the great context menu (ie. right click โ€œoncontextmenuโ€ event) access advice used in โ€ฆ



if (document.addEventListener) {

document.addEventListener('contextmenu', function(e) {

if (rcok) {

e.preventDefault();

activeplayer=3; //alert("You've tried to open context menu"); //here you draw your own menu

document.getElementById('tblthree').style.visibility='visible';

document.getElementById('tblone').style.visibility='hidden';

document.getElementById('sone').style.textDecoration='underline';

document.getElementById('sone').style.cursor='pointer';

}

}, false);

} else {

document.attachEvent('oncontextmenu', function() {

if (rcok) {

window.event.returnValue = false;

activeplayer=3; //alert("You've tried to open context menu");

document.getElementById('tblthree').style.visibility='visible';

document.getElementById('tblone').style.visibility='hidden';

document.getElementById('sone').style.textDecoration='underline';

document.getElementById('sone').style.cursor='pointer';

}

});

}

โ€ฆ thechanged wordguessgameโšซhtml code in liveโœ‚run Word Guess Game for Up to Three.

Stop Press

The Bulls and Cow game ideas in December 2022 in HTML/Javascript Bulls and Cows Game Primer Tutorial helped with ideas to improve the โ€œnamesโ€ management parts to this game for atweaked wordguessgameโšซhtml code in liveโœ‚run Word Guess Game for Up to Three.



Previous relevant Word Guessing or Synonym Game for Two Tutorial is shown below.

Word Guessing or Synonym Game for Two Tutorial

Word Guessing or Synonym Game for Two Tutorial   ๐Ÿ”

The reminder of just how brilliant is the โ€ฆ

โ€ฆ adding onto โ€ฆ

  • Word Guess โ€œbuzzing inโ€ for two players โ€ฆ with โ€ฆ
  • Synonym (in English) Guess โ€œbuzzing inโ€ for two players

โ€ฆ as some additional functionality to this game calling on the good olโ€™ โ€œ/usr/share/dict/wordsโ€ inbuilt dictionary of words that comes with Linux (and macOS) โ€œout of the boxโ€ โ€ฆ hooooorayyyyy!

In broad brush terms, we use โ€ฆ

  • the Linux โ€œ/usr/share/dict/wordsโ€ inbuilt dictionary of English words to pick a candidate word โ€ฆ
  • ask, via jQuery Ajax of WordReference if this word has synonyms โ€ฆ
    1. if not, reask โ€œ/usr/share/dict/wordsโ€ inbuilt dictionary for a word โ€ฆ else โ€ฆ
    2. sit there and wait for a โ€œbuzz inโ€ via mouse or keyboard for a player answer, and if they are correct, their score increases by the length of the synonym word(s)

Hereโ€™s a liveโœ‚run and here is the HTML programming source code you could call thechanged wordguessgameโšซhtml code.


Previous relevant Word Guessing Game for Two Primer Tutorial is shown below.

Word Guessing Game for Two Primer Tutorial

Word Guessing Game for Two Primer Tutorial   ๐Ÿ”

Word Games help vocabulary for ESL students. There is also not much doubt that collaboration can help ESL students, who also learn quicker with other students present.

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 โ€ฆ

  • non-mobile users can play the game with one user using the mouse and the other using the keyboard
  • 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

The events we code for are โ€ฆ

  • onclick โ€ฆ will be recognised on non-mobile platforms
  • ontouchstart โ€ฆ will be recognised on mobile platforms (where it will supercede any onlick event)
  • onkeyup โ€ฆ will be recognised on non-mobile platforms

โ€ฆ so you can see that the colour coding of the webpage becomes important for the mobile platform usage.

Todayโ€™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.

Programmers often use Linux dictionary files as a means to get a word list, and that list could be in any language, and for ours it is English.

Hereโ€™s a liveโœ‚run and here is the HTML programming source code you could call wordguessgameโšซhtml which, again, uses some PHP weโ€™ve talked about with a lot of our word games at this blog, on a โ€œClient Pre-Emptive Iframeโ€ scenario in a couple of HTML iframe elements we include into todayโ€™s game. We thank this free online English dictionary that gets called on if the user chooses to.

We hope you try it, and like it. By the way, you can also play the game as a single user.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Event-Driven Programming, Games, Tutorials and tagged , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *