cryptokwot - substitution cipher game
cryptokwot
cryptokwot [<file> | --puzzle=file ]
cryptokwot --help|--man|--desktop|--icon
Game in which the player must decipher a quotation that's been enciphered with a randomly generated simple substitution cipher.
If you've ever done a newspaper Cryptoquote or Cryptoquip, this will be familiar.
cryptokwot doesn't solve the puzzle for you; it basically replaces pencil and paper, allowing you to assign plaintext letters to ciphertext ones interactively.
By default, the plaintext comes from the command fortune -a. This command will be re-run repeatedly until cryptokwot finds that the output is between 3 and 8 lines of text. The command and the numbers can be changed; see CONFIG FILE, below.
If a file argument is given, it will be used as the plaintext. This is mostly intended for debugging. Once the puzzle is solved, answering y to the Play again? prompt will generating plaintext as described above.
The --puzzle=file option works similarly, but it assumes the file has already been enciphered. It's intended for use with existing puzzles, typed in from newspapers or copy/pasted from websites. In this mode, cryptokwot doesn't know the plaintext nor the key, so it can't tell you when you've won.
All game options are controlled by the config file (see below), so there aren't a lot of command-line options. The --man, --icon, --desktop options are intended for packagers.
Prints this help text, via perldoc(1).
Prints this help text as a man page, via pod2man(1). Suggested use:
cryptokwot --man > cryptokwot.6
Then cryptokwot.6 can be installed in e.g. /usr/man/man6 or /usr/share/man/man6 or wherever your OS keeps its man pages.
Print the cryptokwot icon to standard output, which should be redirected to a file. It's a GIF image, so suggested use is:
cryptokwot --icon > cryptokwot.gif
If you're packaging cryptokwot, use e.g. ImageMagick's convert(1) to turn the GIF into whatever image format your OS likes icons to be in (probably PNG).
Print a FreeDesktop compliant .desktop file to standard output. Suggested use:
cryptokwot --desktop > cryptokwot.desktop
If you're a packager, place cryptokwot.desktop wherever your OS keeps its .desktop files. This will allow KDE/Gnome/XFCE/etc users to launch cryptokwot from their start menu (or equivalent).
You should read the in-game help, accessible via the /help command. The following is a more formalized description of the game.
The object of the game is to decipher the message. Secondary objectives are to minimize the number of moves made and the amount of time spent.
The plaintext is enciphered according to a randomly generated key. However, the key is not 100% random: in particular, it's guaranteed that no letter will be enciphered as itself.
During play, the game keeps track of how many moves you've made and the amount of time you've been playing. The /pause command stops the timer (and removes the puzzle from view, so you can't cheat).
Each move consists of:
A substitution of one or more letters. The ciphertext letters are always given first. These always count as one move, no matter how many letters you enter.
A removal of a substitution (done by entering the single ciphertext letter to remove). Counts as one move.
The /undo command. This restores the state of the game to what it was before your last move, and itself counts as one move. You can /undo all the way back to the starting state.
The /reset command. Counts as one move. Clears all your ciphertext to plaintext mappings. This is similar to executing /undo repeatedly, except that /reset only costs one move, and can itself be undone with /undo.
Other commands (/pause, etc) don't count as moves. Errors also don't count as moves.
The config file is ~/.cryptokwotrc. If it doesn't exist, cryptokwot will create it, with the default options.
The options you can set in the config file are the minimum and maximum lines the puzzle can be, whether or not to use bright colors, and the command to use to get quotes (default is fortune -a).
For more information, see the comments in the default config file (not going to repeat all that stuff here).
You can call these bugs if you like...
1. cryptokwot only works with ASCII text files with lines <= 80 columns. Traditionally, fortune(6) files have always been English written in ASCII, wrapped somewhere around 72 columns. If you have oddball fortune files that don't meet the wrap requirement, you could try setting $fortune_cmd to something like:
fortune <args> | fmt
You could also try piping it to iconv(1) or uconv(1) to transliterate accented characters to ASCII, if it's non-English. YMMV on whether the text is still readable after transliteration (I literally have no idea how much e.g. a French or German speaker would miss the accent marks, as I do not speak French or German).
2. There's no way to change the colors, if you don't like them (other than toggling the bright setting, or of course editing the code). The game should be fully playable without colors, so you can try e.g.
TERM=vt100 cryptokwot
3. The UI could be made a little friendlier, e.g. by using curses. I don't think it would add much to the game, and I'd rather avoid the external dependency (yes, I know, fortune and tput are already external deps, but they're part of any halfway-complete Linux distribution, whereas perl-Curses might not be).
4. There is too much documentation. Nobody's ever going to read it all, are they?
cryptokwot was written by B. Watson <yalhcru@gmail.com> and released under the WTFPL: Do WTF you want with this.