English Word Guessing Game Player Equality Tutorial

English Word Guessing Game Player Equality Tutorial

English Word Guessing Game Player Equality Tutorial

Yesterday’s English Word Guessing Game Players Tutorial started multi-player scenarios with our “English Word Guessing Game” web application, but was a bit “amateur hour” in its approach, regarding …

  • premature, and too simple, (textbox) onblur event programmatical form submit button clicking logic … and now we check on answer length
  • number (in fact, all) characters were accepted as legitimate “word answer” characters … and now we allow keyboard numeric “hotkeys” focus that player’s textbox, via “onkeydown” keyboard event logic …
    <?php echo ”

    <script type='text/javascript'>
    function isitnum(event) {
    if (eval('' + event.keyCode) >= 48 && eval('' + event.keyCode) <= 57) {
    top.setgl(eval(-48 + eval('' + event.keyCode)));
    return false;
    }
    return true;
    }
    </script>

    “; ?>
  • players were referred to by number only … and now we allow for player name to be entered via a preceding (the question) span contenteditable=true element

… meaning the one device (perhaps a mobile one) can have a hovering group of players who all see, for any multi-player game screen, the possibility to be answering via …

  • click or tap of a button … to establish their textbox’s focus … and/or …
  • keyboard numeric hotkeys … to establish their textbox’s focus … and alpha letters to complete their answers

… and once a player reaches the length of their answer, they can send that answer off for analysis via any of …

  • that player tabs out of their textbox … or …
  • that player clicks or taps their “Correct?” form submit button … or …
  • a keyboard numeric for another player number is pressed

… for the changed what_is_the_english_word.php‘s English Word Guessing Game


Previous relevant English Word Guessing Game Players Tutorial is shown below.

English Word Guessing Game Players Tutorial

English Word Guessing Game Players Tutorial

Yesterday’s English Word Guessing Game Primer Tutorial‘s “English Word Guessing Game” suited one player. Today, we allow the user to set the number of players to …

  • each nominated player plays within an HTML iframe element with an overall HTML table element within an HTML body element … meaning …
  • until tomorrow’s work, it is “dog eat dog” as to who controls which player’s textbox has the focus … but …
  • scoring is asynchronous
  • until tomorrow’s work, the use of the tab character to tab out of a textbox clicks the “Correct?” button to go off to assess that player’s answer

<?php

$score=0;
$goes=0;
$blurb='';
$dblurb="Score: 0/0";
$totalj=0;
$fortyeight="48";
$fortyeighti="";
$fortyeightj="";
$ob="";
$sh3="";
$aic="Am I Correct?";
if (isset($_GET['fortyeight'])) {
$fortyeight=$_GET['fortyeight'];
$fortyeighti="<input type=hidden name=fortyeight value='" . $fortyeight . "'></input>";
$fortyeightj="&fortyeight=" . $fortyeight;
$aic="Correct?";
$ob=" onblur=\" if (this.value.trim() != '') { document.getElementById('subm').click(); } \" ";
$sh3=" style='display:none;'";
}

if (isset($_GET['numplayers'])) {
$preifs="<html>
<head><title>What Is The English Word - RJM Programming - February, 2022</title>
</head><body style='background-color:yellow;'><table style='width:100%;' border=20><tr><th colspan=2>Player</th></tr><tr><th>Number</th><th>Game</th></tr></table></body></html>";
for ($ih=1; $ih<=$_GET['numplayers']; $ih++) {
$preifs=str_replace("</table>", "<tr><td style=text-align:center;>" . $ih . "</td><td><iframe src='./what_is_the_english_word.php?fortyeight=24' style='width:100%;height:200px;'></iframe></table>", $preifs);
}
echo $preifs;
exit;
}

?>

… the idea of the “fortyeight” code is to reduce the font size in order to fit in more player iframe display into the one shared screen, with the user interfacing code being …

<?php echo ”

<h3" . $sh3 . ">RJM Programming <a title='How many players?' style='cursor:pointer;text-decoration:underline;' onclick=\" var hm=prompt('How many players?','1'); if (hm == null) { hm=''; } if (hm.trim().replace('1','') != '') { location.href=document.URL.split('?')[0].split('#')[0] + '?fortyeight=24&numplayers=' + encodeURIComponent(hm); } \">-</a> February, 2022</h3>

“; ?>

… for the changed what_is_the_english_word.php‘s English Word Guessing Game.


Previous relevant English Word Guessing Game Primer Tutorial is shown below.

English Word Guessing Game Primer Tutorial

English Word Guessing Game Primer Tutorial

Ever so simple! Is that what you want in a Word Game? We like that, but we also like to learn words that might be new to us. How about a …

  • English word game …
  • based on Linux or unix or macOS dictionary list …
  • randomly choosing …
    1. word length between 5 and 12
    2. a letter in word
    3. that letter position in word
  • and a clue, thanks to https://crossword-solver.io/clue/

… basis for our word game, today? Well, it’s just “first draft” time for what_is_the_english_word.php‘s English Word Guessing Game, but we think you might like to try it?!

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 *