Here is where I store some programs that are free. If you like
something that you see here, please feel free to take it and make
it yours. But still free. Thanks.
(.c), a very simple and I
think user-friendly interface to various flavors of the BMP, PBM, PGM,
and PPM image formats. Also converts between RGB and grayscale very
a simple implementation of a GIF image writer (no reader yet). After
public-domain code by Sverre Huseby, 1992.
(.c), a few functions
designed to convert between various internal formats: 8-bit grayscale,
8-bit palettized, and 24-bit RGB formats. Includes an error-diffusion
dithering algorithm due to Victor Ostromoukhov.
simple_png.c, a pair of
functions demonstrating a simple interface for reading and writing PNG
images using the open-source libpng library.
(.c), a very simple
implementation of the classic union-find algorithm. It is not reentrant.
which I have used in creating crosswords for The Tartan. Includes
a crossword dictionary.
.h), a program
for locating "found haiku" in arbitrary text files, as described
Uses the Carnegie Mellon Pronouncing Dictionary (available via
pento, a program
to play "Capture Pentominoes," a board game of my own design.
rot13, a rot13 utility. It also
has support for rot-n, where n is any integer, and a
Caesar-cipher cracker that uses English letter frequencies.
split_get, a program for
splitting and reassembling binary files. (For example, for transporting
large files on multiple floppy disks.)
tea-example.c, an example
of how to use TEA, the Tiny Encryption Algorithm
(Wheeler & Needham, 1994).
Fixes several typos in Wheeler & Needham's
C implementation, and shows one way to give the routines generic
wrappers. This encryption algorithm is not adequately secure for
unitrans, a program that
converts files between ASCII, UTF-8, UCS-2, and other encodings,
including one that's supposed to be supported by the Omega extension of TeX.
Wrapper for the
Meta: Programs about programs
Befunge utilities, including
the Fungus virtual machine and its two-dimensional assembler.
detab, an entab/detab
a tool for generating nice syntax-error messages from parsers written
using the ocamlyacc
tool. Inspired by Merr.
quine, a little program that
tries to generate a "quining" function for any given C program. It isn't
very robust, in that it expects that all #include directives
will be placed first in the file, and that lines generally do not exceed
512 characters. Includes instructions for bootstrapping the
quine program's self-quining ability. Can generate 100% portable
ISO C quines, with the -c option. There's a less
complicated earlier version
usenetify, a utility that
understands enough C and C++ to wrap long lines in a manner suitable for
Usenet postings or piping to a line printer. Should be used in series
usenetify2, a utility that
understands C much better than the old usenetify. It also does
automatic detabbing. It does not wrap lines as aesthetically as
usenetify, but I believe it to be completely free of bugs
(unlike the former program).
This section contains patches I've written for the computer game NetHack. All of these
patches are placed in the public domain by their author. If you don't
know what NetHack is, you have two options: Ignore this section, or
(recommended) follow that link and download the game! Source-diving
The "sitting" patch
combines four YANIs: Joshua Kwan's "pit-sitting" patch,
Mark Rae's idea
in which very heavy creatures shatter boxes and chests by sitting
on them, new interactions when sitting on eggs, and my own YAFM
for sitting on a cream pie.
patch causes thrown potions to have effects on objects. You can
now blank scrolls by throwing water at them. This patch is compatible
with Nephi's invisible
A quick fix for
apparent bug makes the player turn into a stone golem if he becomes
a flesh golem while wielding a cockatrice corpse, even if he became a
flesh golem by stone-to-fleshing himself.
The "jargon" patch
adds several minor enhancements to the parser. You can now genocide
"<foo> mindflayers" and wish for "helmets of <foo>,"
"royal jelly," and "rubber chickens." Suggestions for more additions
patch allows monsters to use rings somewhat intelligently.
For a more complete and spoily rundown, go
This patch implements Simon
that a successful brain-suck by a master mind flayer should cause the
castle tune to randomize again. Because, well, it's a Mastermind
implements Clint Herron's idea
that there should be some way to create new candles for the ascension:
reading a non-cursed scroll of light while confused changes all your
royal jelly into wax candles. (Well, royal jelly is kind of like
[237K, text] doesn't change any game behavior; it just
changes a lot of comments in the game's source code, to fix typos, spelling
mistakes, grammatical errors, and consistency (e.g., referring to "the Amulet"
versus "the amulet"). Totally pointless for anyone except source divers,
and pretty pointless for them, too, but now I can say I've read all the
comments in NetHack!
implements Joe Clark's idea
that "an emerald ring" be reported as "a green stone ring" until
emeralds are actually identified. I personally wouldn't use this
patch, though; it unbalances wizards without adding anything new
in the way of gameplay.
The "xorn" patch
fixes a few bugs that will undoubtedly get fixed in the next version
of NetHack: you can't engrave while embedded in rock; fixed message
for writing underwater; trying to dig messes up engravings; and
fixed messages for casting Protection in funny places.
The "wish" patch
allows the player to wish for "the gnome's aklys" and get it. (Wizards
can wish for
pit".) It also refactors the wishing code a little bit. This is
probably full of bugs.
a C++ template class implementing depth-first search, alpha-beta
search, and breadth-first search on an arbitrary game tree.
a demonstration of how to create a "template class" in standard C.
a program that reads an APL program in Jim Weigang's
"APL-ASCII" notation and writes it back out in UTF-8. Somewhat useful
for typesetting APL with TeX.
bitap, an implementation of
the bitap algorithm for fuzzy string searching.
a hack perpetrated for Shawn Knight's Egyptology class in 2004.
dance, a C implementation of Donald
Knuth's "Dancing Links"
algorithm. Includes an application to the solving of Sudoku puzzles.
a program that produces all the words in a dictionary that are anagrams
of Greek letters, as described in this
a program that draws a visual representation of a Traveling Salesman tour.
I used it to make lena-tour.png,
after feeding the "Lena" image through randtsp
and a TSP solver.
pangram, a program
that generates self-inventorying sentences by Robinsonizing.
randtsp, a program
that generates input to the TSP solver according to a given grayscale
image. See imagetour.
A unit cell
[PNG] for simulating Rule 110 in
a program that hides "secret messages" in SIRDS stereograms,
as described in sci.crypt in July 2004.
This page was last updated
26 June 2011
All original code, images and documentation on this page
are freely distributable.
Please keep them that way.