Following on from yesterdayโs First Name Guessing Game for Two Primer Tutorial exploring more regarding Linux and Mac OS X dictionary file arrangements we want to tell you about another such resource available to you in the form of the file โฆ
/usr/share/dict/web2a
โฆ where you can find a collection of, in our case, English, phrases (and word pairings). Again, this could be a source for some password creation thoughts, or we use this file to create todayโs โEnglish Phrase Guessing Gameโ by asking the user to fill in the first word or phrase part to score a point.
This was a pretty easy English word game to construct, but it featured some interesting techniques we like around here โฆ
- an HTML iframe hosting of the middle
manperson surprise.php resource we call on to make use of โ/usr/share/dict/web2aโ file via the URL snippet โ&phrase=yโ - a Client Pre-Emptive Iframe feel as to how that middle
manperson surprise.php communicates with its supervisory phrasehtml today, using that HTML iframeโs onload event to check for content, in todayโs case, we hope, an English phrase (or word pairing) of length 3 to 24 โฆ and how did we work out the range โฆ
awk '(NR==1||length<shortest){shortest=length} END {print shortest}' /usr/share/dict/web2a # 3 is shortest thanks to advice of this useful link, thanks
awk ' { if ( length > L ) { L=length} }END{ print L}' /usr/share/dict/web2a # 24 is longest thanks to advice of this useful link, thanks - the game โstandardsโ for randomosity as per โฆ
var lis=eval(Math.floor(Math.random() * 21) + 3); - the usual โScore: 0/0โ (implied score/goes) scoring arrangements
- the usual Javascript setTimeout timer methodology control of the gameโs flow
- the often used offering to find out more on a wrong answer via a window.open English dictionary popup mechanism, prompted for via a Javascript prompt window
- the recent obsession, the HTML div element set to contenteditable=true mode allows for slightly simpler looking user interaction flagged via the onblur event
- the โI give upโ mechanism (that can be really annoying NOT to have, in some games) handled via means of the onclick event, today, via a click on the non-div elements (though we did try it, unsuccessfully with the HTML div element, but it being contenteditable=true, really needs a click (into it) left aside to allow for the HTML div element to get the focus)
Your typical game ideas, in large part.
Hereโs a liverun and here is the HTML programming source code you could call phrase
html which, again, uses some PHP weโve talked about with a lot of our word games at this blog, the very shy surprise.php โฆ aptly named, donโt you think?!
Previous relevant First Name Guessing Game for Two Primer Tutorial is shown below.
It may not be immediately imaginable what would be the synergies between todayโs proposed โFirst Name Guessing Game for Twoโ and Word Guessing Game for Two Primer Tutorialโs โWord Guessing Game for Twoโ. Other than that a First Name is a Word, isnโt there too much difference here to clone the โWord Guessing Game for Twoโ into a new โFirst Name Guessing Game for Twoโ when even dictionaries usually do not venture into the world of First Names, so much a product of our culture and history? But, believe it or not these two games are so alike that, apart from tweaks to prompt wordings and message wordings, all that is needed to succeed after the cloning is to make the middlemanperson surprise.php get called for Linux (or Mac OS X FreeBSD) dictionary file usage such that instead of accessing a dictionary file called โฆ
/usr/share/dict/words
โฆ that contains a list of singular, in our case, English, words to access, for the purposes of our new โFirst Name Guessing Game for Twoโ the dictionary file โฆ
/usr/share/dict/propernames
โฆ cute,huh?! But a big ask for a complete list of First Names around the world! Nevertheless, it is good to have this list for our game today, and some other ideas that you can think of, am sure. Maybe, a basis in letters for part of a password idea, for example. Seeing this same dictionary file on both Mac OS X and Linux was an encouraging sign of support from the operating systems here.
The event and organizational side of the web application is just as described for Word Guessing Game for Two Primer Tutorial below. We just call surprise.php with an extra โฆ
&firstname=y
โฆ within its URL. Also, references to the online English dictionary become a bit inapplicable, but we substitute in, here, on these a links, use of the excellent Behind the Name website, thanks.
So hereโs a liverun and here is the HTML programming source code you could call nameguessgame
html which gotcreated via these cloning changes.
You can also see this play out at WordPress 4.1.1โs First Name Guessing Game for Two Primer Tutorial.
Previous relevant Word Guessing Game for Two Primer Tutorial is shown below.
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 liverun 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.