The Darwin Game

  • Tortoise on mz_pacman
  • Sheep vs. Rover on ns_tunnel
  • Wolf vs. Sheep on ns_faceoff

  • Darwin 2.2 is a game that features artificial intelligence creatures (i.e., virtual robots) competing to either control a map or be the first to complete a task. You play by programming your own species of creature in Java. Darwin 2.2 is a lab assignment in CS136 at Williams College. Students create creatures for specific tasks like navigating a maze or competing for survival. This page contains everything that you need to play the Darwin Game at Williams, adapt it for your school, or play with your programmer friends.

    New for 2012: Enchanted apples, shrines, mud, and 4-species natural selection!


    The Darwin 2.2 simulator and documentation are below. You may use them for free with attribution, in a course or for your own entertainment. You are even welcome to modify and redistribute the code with attribution.

    Darwin 2.2darwin2.2.zipEverything: Simulator, Darwin viewer, sample Creatures, map pack, sprites, player's handbook, reference documentation, and source code
    Player's Handbookplayers-handbook.pdfThe handbook describing in detail how to make a creature, the file format descriptions, and the tournament rules
    APIOnline JavaDocReference documentation for the full API
    JavaJava SDKProvided by Oracle. You only need this if you don't already have a Java compiler installed


    Creatures are programmed in regular Java. Six actions allow them to interact with the simulation world: observe, turnLeft, turnRight, move, attack, delay. Each action has its own specified time cost. A successful attack destroys its target and then spawns a new instance of the attacker's creature type. This allows creatures to reproduce and eventually take over the map. This and the tournament rules create a kind of natural selection among species, hence the `Darwin' name.

    The API is extremely simple. Below is the source code for a robot rover that moves in a straight line until it is obstructed, and then turns to the left. It attacks anything that it runs into.

    public class Rover extends Creature {
        public void run() { while (true) {
            if (! moveForward()) {

    The simulator can be run in text mode or graphical mode. In graphical mode it offers 2D and 3D views and can be paused or set at one of four speeds. The 3D view is shown at the top of this page. To customize your creature's 3D appearance, draw four PNG images. Searching for `3D sprite' or `isometric sprite' yields many good results on Google. For example, the rover above uses a tweaked Pig Tank from Duke Nukem 3D. The maps themselves are created using a simple ASCII format. They support walls, food, treasure, gigantic Venus fly trap monsters, and up to 10 competing AI creatures.

    I am interested in receiving contributions of new sprite graphics and maps by e-mail, and in hearing if you use Darwin in a course. Please do not send unsolicited creature subclasses or suggestions for the API. I don't have the resources to evaluate and integrate them.


    Darwin Game 2.2 was designed by Morgan McGuire. The previous 2.0 version was similar (and the API is backwards compatible!) but required explicit synchronization of creatures by the player. Version 2.1 relieved the programmer of that burden to make more sophisticated strategies accessible to less experienced programmers. Version 2.2 introduced new mechanics to allow alternative strategies and increased the scale of the maps significantly.

    Morgan's Darwin was inspired by Steve Freund's Darwin assignment, in which students implemented in Java an interpreter for a concurrent assembly language. That assignment was based on the Darwin's World interpreter game invented by Nick Parlante and implemented in C and Pascal.