The goal of this project is to find the quickest way to get through the farm.
- Obviously, there are some basic constraints. To be the first to arrive, ants will need to take the shortest path (and that is not necessarily the simplest). They will also need to avoid traffic.
- At the beginning of the game, all the ants are in the room. The goal is to bring them to the room. Each room can only contain one ant at a time. (except at ## start and ## end which can contain as many ants as necessary.)
- We consider that all the ants are in the room.
- At each turn you will only display the ants that moved.
- At each turn you can move each ant only once and through a tube (the room at the receiving end must be empty.
- display results on the standard output in the following format:
x, z, r represents the ants’ numbers (going from 1 to number_of_ants) and y, w, o represents the rooms’ names.
- The ant farm is defined by the following links:
Which corresponds to the following representation:
- The rooms, which are defined by: name coord_x coord_y
- The links, which are defined by: name1-name2
- All of it is broken by comments, which start with #
Breadth-first search (BFS).
To start we will assemble the program with the help of the makefile:
Create a file with rooms, links and 100 ants:
and run
There are four ways in this example and ants are taking multiple ways.