/ft_lem_in

The goal of this project is to find the shortest way . Introduction to Graph Theory and graphs algorithms.

Primary LanguageC

lem_in

Visual example

lem_in

lem_in

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:

2018-07-04 18 59 42

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:

2018-07-04 19 02 15

Which corresponds to the following representation:

2018-07-04 19 02 55

  • 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).

Example

To start we will assemble the program with the help of the makefile:

screen shot 2018-11-19 at 7 34 47 pm-min

Create a file with rooms, links and 100 ants:

screen shot 2018-11-19 at 7 35 06 pm-min

and run

screen shot 2018-11-19 at 7 35 20 pm-min

There are four ways in this example and ants are taking multiple ways.