A digital ant farm simulation written in Go. This project reads a file describing a colony of ants, rooms, and tunnels, and calculates the most efficient way to move n ants from a start room to an end room while avoiding traffic jams.
Lem-in is an algorithmic project that focuses on Graph Theory and Pathfinding. The goal is to find the optimal flow of ants through a network of rooms and tunnels.
The challenge lies in the constraints:
- One Ant per Room: Only one ant can occupy a room at a time (except for
##startand##end). - Traffic Management: You must find not necessarily the shortest path, but the quickest combination of paths to move all ants without bottlenecks.
The program parses a map file to construct a graph. It then uses pathfinding algorithms (typically BFS or concepts similar to Edmonds-Karp/Max-Flow) to determine the best set of non-conflicting paths. Finally, it simulates the movement turn-by-turn.
The program takes a file passed as an argument. The file structure is as follows:
- Number of Ants: Single integer.
- Rooms:
Name X Y(e.g.,RoomA 2 3).- Special commands
##startand##endsignal the entry and exit rooms.
- Special commands
- Links:
Name1-Name2(Defines a tunnel between two rooms). - Comments: Lines starting with
#are ignored.
Example Input:
3
##start
1 23 3
2 16 7
#comment
3 16 3
4 16 5
5 9 3
6 1 5
7 4 8
##end
0 9 5
0-4
0-6
1-3
4-3
5-2