Last Update: Fri Sep 11 09:08:35 -0500 2009

Hangman Tournament

A Ruby sparring tournament. Compete by building a computer AI to play hangman.


There are 4 simple steps to participate.

1 Install the hangman_tournament gem

  sudo gem install hangman_tournament

2 Create a player (computer AI) with a creative and unique name

  generate_hangman_player "Some Creative and Unique Name"

3 Build and install your player‘s ruby gem

  # Install the rspec gem if needed
  # sudo gem install rspec
  cd some_creative_and_unique_name
  rake gem
  sudo gem install pkg/hangman_some_creative_and_unique_name-1.0.gem

4 Enter data, choose password, and submit your player

  # Edit Rakefile and provide the information indicated.
  rake submit

Try Out Your Player

You‘ll need Limelight to watch your player play.

1 Download an installer from (Minimum version required is 0.4.0)

2 Install

3 Create a Limelight Link file

  echo "" > ~/Desktop/hangman.lll

4 Go to your desktop and double click on hangman.lll. Or if you‘ve installed the Limelight gem…

  jruby -S limelight open ~/Desktop/hangman.lll

Click on the link at the top that says "Computer AIs" You should see your player in the list along with Letter Letdown. Have it play a few games. Perform some analysis to see how your code holds up.

Improve Your Player‘s AI

The source code for your player is contained in one file:


You‘ll also find an lack of specs in the file:


Use of rSpec is required.

There are plenty of comments in the generated source code. Go nuts! Add code. Change code. Add files. Turn your player into a masterful hangman AI.

When your player is ready, be sure to submit again. Make sure you remember your players password. You may submit as many times as you like. Each submission will overwrite the previous submission.

  rake submit

Staying in the Loop


Follow @CodeSparring for news and updates on the tournament.

Email list

Join the email list. Use it for questions and discussion about the tournament.

Subscribe: Email:


You have until September 30th, 2009 to submit your final solution. On October 1st, competition begins. Each player will play many many games of hangman. All players will receive the same words in the same order. The Tournament Champion will be the player that wins the most games.

However, there is a more prestigious title to which players should aspire. The Tournament Master. This coveted title is awarded not to the player who wins the most games but to the player that also has the best source code. A series of metrics will be collected on your player‘s source code and compiled into an all-round score. The player with the best all-round score will be honored as Tournament Master.

The Hangman Limelight production provides a Locker Room scene where you can run some sample analysis on your player. This is just an example of the analysis that will be performed but it should give you an idea of what is expected.

Solutions may NOT make use of ruby gems. The tournament is about crafting a complete solution.

Analysis Dependancies

To run full analysis, you will have to have the following gems, and their dependancies, installed:

 * flog
 * rCov
 * rSpec
 * flay

Terms for Disqualification

 1 Attempting to open or modify classes, modules, or objects in the Hangman engine.
 2 Tampering with the Hangman.Rakefile file.
 3 Providing invalid letter guesses.
 4 Making use of Kernel.set_trace_func
 5 Tampering or abusing tournament infrastructure and facilities


None of the players are showing up in the player lists.

First check that the player gems are installed. It‘s likely that the Hangman engine cannot find them. We‘ll have to tell it where it can find the gems. Mac:

  ruby -r "rubygems" -e "'~/.gem_home'), 'w') { |f| f.write Gem.dir }"

Windows: Find your gem directory. In you home directory (C:\Documents and Settings\Micah) create a file named ‘gem_home.txt’ containing the path to your gem directory.

When submitting, I get the error: Could not find installed gem named ’<my player name>’

This is a problem in the hangman_tournament-1.1.gem. Install version 1.2 and the problem should be resolved.