HTML/Javascript Binary/Octal/Hexadecimal Game Buttons Tutorial

HTML/Javascript Binary/Octal/Hexadecimal Game Buttons Tutorial

HTML/Javascript Binary/Octal/Hexadecimal Game Buttons Tutorial

When you think about a makeover to a web application involving user interactive input, you could do a lot worse than concentrating on additional HTML (for us, input type=) button elements. Just about everybody understands the concept of a “button press” means “action”. In that way, if the way the rest of the web application confuses, buttons often break through that confusion.

And so, in this context, we had occasion to revisit the game web application of HTML/Javascript Binary/Octal/Hexadecimal Game Tutorial written way back in December 2014, and felt that confusion we’d summarize (in “weakness terms”) as …

Not enough reward for effort.

… it panning out that “the reward” was an offer to “replay” the Binary/Octal/Hexadecimal Game for another go where you improve on the time it took you to solve the five questions, correctly, in the previous game.

On this “small makeover” we decided not to “roll over” on these lofty sparse rewards, as we think the effort here will help understanding, but the introduction of buttons helps create interest “on the trip” of the game, we think.

The game has five questions of two types …

  1. known decimal number for a set of known and unknown dropdown (ie. select) element digit of base 2 (binary) or 8 (octal) or 16 (hexidecimal) numbers
  2. unknown decimal number for a set of known dropdown (ie. select) element digit of base 2 (binary) or 8 (octal) or 16 (hexidecimal) numbers

… and the five corresponding buttons act to, respectively …

  1. offer a question mark button the pressing of which uses a Javascript prompt window to prompt for the user’s decimal number guess
  2. fill in result (HTML div) with a cross emoji for incorrect and tick emoji for correct correspondence

… resulting, we think, in the sense that there is a feeling of progression within the set of five questions, along the way. That is what we think, but perhaps you have your own opinion about this changed binary_quiz.htm HTML and Javascript numbers game


Previous relevant HTML/Javascript Binary/Octal/Hexadecimal Game Tutorial is shown below.

HTML/Javascript Binary/Octal/Hexadecimal Game Tutorial

HTML/Javascript Binary/Octal/Hexadecimal Game Tutorial

Are you feeling transformational? Maybe calculating? Perhaps didactic? Witheringly logical? You can test how you feel, in a mathematical sense, by playing our “Binary/Octal/Hexadecimal” game today.

The study of bases other than (decimal) 10 in mathematics is very interesting and it is used a lot in computing, a simple example of which is notation like #ffffff to describe the colour white, which lots of us were taught at school as the colour that contains the lot, hence all the 255 (hexadecimal ff) of Red and 255 (hexadecimal ff) of Green and 255 (hexadecimal ff) of Blue in the RGB colour model system. You might think that a computer would be able to work faster with the smaller amounts of data of hexadecimal, but, basically, the computer will, eventually, go and turn this into binary because at the bottom of its design it understands on and off, as you would understand voltage on a Bugs Bunny cartoon if you were the Coyote just missing the Roadrunner, running into an electrical socket running an Eat at Joes sign being switched off, on (sizzle), off, on (sizzle), off, on (sizzled Coyote, meet Daffy Duck?!).

Anyway, see how you go with this game that asks you to solve 5 problems as quickly as possible. One way around you can cheat the system, and this is fine by me, in the sense that the intention is just to put that picture in your head of the powers of 2 involved to get a little bit familiar with them. Another way to do this is to access a text editor that can simultaneously display a hexadecimal view (or dump) of that data. UltraEdit on Windows can do this.

Here is a link to some downloadable HTML (with Javascript) programming code you could rename to binary_quiz.html and a live run.

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 *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>