Werner's home on the Web

Xlator: A Futurama Translator

ยท 371 words ยท 2 minutes to read
Tags: code fun

good news

Good news, everyone!

Thanks to the power of modern computers we can now easily transcribe our Earthican language into Alien Alphabet 1 (AA1) and Alien Alphabet 2 (AA2) from Futurama!

AA1 is a simple substitution cipher. AA2 is a bit more complex, but it does not have all the characters from AA1. You can find more information here:

Alien Alphabet 1 (aka Alienese):

Alien Alphabet 1

Alien Alphabet 2:

Alien Alphabet 2

You may notice that I made the XBMs containing the alien fonts by taking screenshots on the above pages. Be sure to checkout his links section as well.

Source Code ๐Ÿ”—

You can find the source code here as a .tgz archive or as a .zip archive

The code is written in platform independent C, so you should be able to compile it by typing make on the command prompt if you’re using Linux. It also works if you use MinGW on Windows.

Internals ๐Ÿ”—

universal translator

While the program may seem a bit pointless if you’re a serious programmer, it does have some technical features that are worth mentioning:

  • The fonts are stored as XBM images and compiled into the code.
  • The files bmp.c and bmp.h implements a basic API for manipulating .BMP bitmap files centered around the struct bitmap.
  • There are functions for converting the XBMs to a struct bitmap and to blit between struct bitmap objects.

The result is that the program does not have any external dependencies, it is portable across platforms (I know it works on Windows and Linux), and once you’ve compiled it can be distributed as a single executable without any additional files.

Usage ๐Ÿ”—

The program can be run from the shell as follows:

usage: ./xlator [options] (-t "string" | infile)
where options are a combination of:
	 -t string      Translate the string, otherwise infile must be given
	 -1             Use Alien Language One (Default)
	 -2             Use Alien Language Two
	 -o outfile     Specifies the output file, default output.bmp
	 -f RRGGBB      Specifies the foreground colour, default FFFFFF
	 -b RRGGBB      Specifies the background colour, default 000000
		  Colours are specified in hexadecimal, eg FF00FF
	 -d             Outputs the cipher instead of translating the string
	 -s size        Resizes the image to 'size' times
	 -M             Disables smoothing on the output
	 -v             Enables verbose mode
	 -h             Displays the help message