Cheating at KHangman

I remember playing “Hangman” on the chalkboard of a one-room school-house in the 1950s. It was great sport on rainy/cold/winter days when outdoor recess was difficult. One constructs a hangman’s scaffold with every miss at a guess of a letter in an unknown word. Being “hung” builds vocabulary as one is motivated not to be hung again. It worked for me. Even with my poor memory, I can spell most words I use even without the spell-checker.

The game, KHangman, comes with many distros of GNU/Linux, and offers most of the features of the chalkboard plus you have a clue as to the category of the word and its length. Still, for young children it is challenging. As losing is no fun at all and exploring the dictionary is educational I decided to create an accessory for cheating at KHangman. Here is the code:

echo cheat, copyright 2010 Robert Pogson. You are free to examine, modify, use and distribute this code under GNU GPL v3 or later
echo ln -s anywordlist wordlist in your HOME directory permits changing the wordlist used.
echo Supply a pattern of known and unknown characters marked by a “.”, e.g. .i.n could be lion
echo Type q to quit, PgUp,PgDn,arrows,spacebar to scroll in the list of words
while [ “q” != $REPLY ];do grep ^$REPLY\$ $HOME/wordlist|less;echo Supply another pattern or “q” to exit cheat;read;done

I put this in /usr/local/bin/cheat so it will be in users’ PATH and I create a link on the XFCE4 panel using their “devilish” emoticon to be opened in terminal. This programme basically uses grep to match the pattern of known and unknown letters in the word against a wordlist. I used the Canadian large wordlist which I place a link in each user’s HOME directory (ln -s /usr/share/dict/canadian-english-large /home/someuser/wordlist). That way, users can replace the link for their own purposes. For example, teachers of early years may use a Dolch wordlist or one they make up to meet their educational objectives.

Here’s what it looks like in action. I showed two windows to show the before and after shots of cheat.

The sneaky thing about this programme is that it encourages them to read the dictionary without it being a tedious task, just part of a game in which they are motivated by the base instinct to survive.

About Robert Pogson

I am a retired teacher in Canada. I taught in the subject areas where I have worked for almost forty years: maths, physics, chemistry and computers. I love hunting, fishing, picking berries and mushrooms, too.
This entry was posted in Linux in Education, Teaching, technology. Bookmark the permalink.

Leave a Reply

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