A ruby a day!

ant example

A client server ants simulator

A useless but fun application that consists of a server that simulates a world inhabited by ants. Clients can connect and steer the ants in this world.

The ant world is by now nearly complete. I don't think I'll add or change a lot of things in the ant possibilities. What is missing is documentation, code review and client/server ui feature improvements.

This program is an example used for my ruby course. It is not checked for safety so usage is on you own account. I'm not be hold liable for anything but the fun you can have with it.

The program is in an alpha state, so don't expect too much.

Download

You can download the ants simulator here:

Source

You can browse the source code directly here

Documentation

Right now not too much documentation is available.

Installation

Just unzip and untar into a directory of your choice. Start a antsserver, start the neccessary amount of antsclients and watch the world evolve.

The fun is programming new ant types.

Description

The server manages a checkerboard like world in which there exist the following objects:

Clients connect to the server and each client gets assigned a tribe of ants.

When enough clients have connected, the server begins to simulate the system. For each ant the client is polled on what to do next. He gets information about the ant, and the 5 cells that the ant can see. (Center, North, South, East, West). The client then returns on of the possible actions

The collected actions of all ants are then executed in a random order. (Here is the "luck factor" of the game).

At the end the ant tribe that has collected most food items has won.

Ant Types

The different ant types can be programmed in ruby. So you have the full power of ruby to make your ants intelligent. The basic idea is that each ant should act on its own. But with my design it is easy to create a "central intelligence" that knows about all own ants at all times.

This is not a bad thing! The idea of the game is to learn ruby, so if you are smart using ruby, it's ok. But to keep the fun in the game I recommend playing in leagues. Possible leagues would be