Programs and code

This page collects the various programs and useful code snippets I’ve released over the years. Unless otherwise stated, all code is licensed with the LGPL. Other sources of programming material on this website are the articles page and the programming category of the blog.

Complete programs with source code

  • ESMS - simulator and toolset for running fantasy soccer leagues.
  • Jamca - a chess playing program I’m developing with emphasis on educational value. It is a work in progress.
  • Chuck - (Updated: 10.12.2002) a checkers playing program I wrote in C++ a long time ago, to get some hands-on experience with game AI programming. It was one of my first projects, so the code is (very) far from perfect. Read the readme.txt file in the package to get started.
  • Perlines - (Updated: 31.12.2004) A clone of the “Colorful lines” (distributed as “Glines” with Gnome) game, written in Perl/Tk. Download the single Perl file and run it. I tested it on Linux and Windows (with ActiveState’s Perl). Warning: the game is very addictive !
  • Pbombs - (Updated: 31.12.2004) A Minesweeper clone, written in Perl/Tk. I only tested it on Windows.
  • wxPyTris - (Updated: 31.05.2008) A Tetris clone written in Python (2.5) using the wxPython (2.8) GUI toolkit. It works on both Windows and Linux with native widgets (courtesy of wx). Here’s a zipped executable (4.8 MB) that will run on Windows without Python/wxPython installed.
  • Perlmix - (Updated: 13.04.2006) A Perl implementation of the MIX machine and MIXAL language devised by D. Knuth in TAOCP. Includes two separate packages - a compiler/assembler of MIXAL -> MIX machine code, and a simulator of MIX machine code (with a simple built-in debugger), including the MIX devices.
  • Sudoku solver in Ruby using SAT - (Updated: 08.04.2007) This is a Ruby implementation of a Sudoku solver. The Sudoku is converted into a SAT problem, which is then solved with a simple SAT solver. Read the readme.txt file in the package for more details and instructions of use.
  • Perl Serial communication - (Updated: 18.11.2006) a small utility written in C++ along with a Perl module which in unison provide a convenient method to communicate on the serial port (RS232) with Perl.

Code snippets and scripts

Some of the files downloadable from this section are not ZIPped, but uploaded as is, with .txt added to their extension - so you can just open them in your browser. If you download a snippet and want to run / compile it, remove the trailing .txt from its extension.

  • wx_mpl_bars.py (Updated: 01.08.2008) - Demo code of matplotlib with wxPython. Displaying a bar plot with information that can be changed by user commands. Allows some interaction with the plot.
  • wx_mpl_dynamic_graph.py (Updated: 01.08.2008) - Demo code of matplotlib with wxPython. Displaying a “live” dynamic graph. Allows user interaction and configuration of the plot.
  • libcollect.py (Updated: 03.07.2008) - A Python module that helps you collect all the libraries your script uses into a convenient distribution directory / zip file. Read the embedded documentation for more details.
  • find_google_link.pl (Updated: 31.08.2007) - Executes a Google search to find the results page on which a link to some website is returned. See this post for more details.
  • lexyacc_examples.zip (Updated: 27.07.2007) - Some examples of scanners and parsers coded with Lex and Yacc. The examples are well documented and show many important features of the Lex & Yacc tools.
  • lis_algorithms.rb - (Updated: 18.04.2006) Presents three different implementations of the Longest Increasing Subsequence problem, in Ruby
  • fixnum.cpp - (Updated: 06.03.2003) A very simple library implementing fixed number arithmetic. I needed a Verilog (a hardware description language) implementation of fixed point operations for a University project, so I first wrote it in C++ to understand how things work (oh, and C++ is so much easier to debug than Verilog…)
  • Utils - (Updated: 19.08.2005) A collection of C++ utility functions / classes. String tokenization, smart pointers, benchmarking, simple command line parsing, and more.
  • namegen.cpp - (Updated: 08.10.2004) a very simple random name generator. Don’t expect too much though, the names it generates are at best in the ridiculous/hilarious spectrum.
  • largest_files.pl - (Updated: 06.03.2003) Give this script a starting point and it will recursively dive into the directory tree and return with the 20 largest files. Can be very useful when you must clean up some space quickly.
  • foggy.pl - (Updated: 12.03.2003) Useful for manager reports - prints piles of meaningless but extremely smart looking text. Check it out !
  • huff.pl - (Updated: 12.09.2003) A simple implementation of Huffman encoding/decoding
  • win_to_unix_text.sh - (Updated: 06.03.2003) Get rid of those annoying ^M (or \r) characters when you transfer text files from Windows to Unix. This is actually a C-Shell script, but it invokes a Perl one-liner to do the work.
  • weighted_random.pl - (Updated: 16.03.2003) Say you want to pick at random between X and Y, but you want Y to have a larger chance of being picked… The code solves a generalization of this problem.
  • levenshtein.pl - (Updated: 27.03.2003) Calculates the Levenshtein distance (also called Edit distance) between two strings. This can be used for approximate string matching