Blue
agents going down towards the X
, while orange
angents exiting from the X
after the train
has arrived, are directing themselves towards the upper left hand side where the blue
agents first exited.
This program runs a concurrent simulation of several agents. They are all dropped into a waiting area
where they will wonder around until, let's say a train arrives
It consists of a set of Agents
entering the waiting room, and a set of Agents
arriving from this mentioned train, and exiting it.
The agents are being run on their own thread
, meaning that they can interact between each other and see at every point in time where another agent is located at.
Each agent is calculating its own path using A-star
search algorithm.
This path is displayed in the right hand side and can be switched to other agents up and down
by pressing F1
and F2
respectivelly.
-
ncurses, used for the graphical representation of the agents on the terminal
sudo apt install libncurses5-dev libncursesw5-dev
-
cmake, used to build the executable
sudo apt-get -y install cmake
Once all dependencies are installed,
- git clone
https://github.com/edghyhdz/agentswaitingarea.git
- Inside the root project folder
mkdir build && cd build
cmake ..
make
Once installation is complete
- run
.build/agents_display
- The agents entering will be doing so from the upper left hand side,
- The agents exiting the
train
will be doing so from the lower middle part marked withX
- If you want to check different agent's
a-star
paths, click onF1
orF2
to go up or down respectivelly- The selected agent will be highlighted in the left hand side of the terminal screen
- The right hand screen will be displaying
When pressing either F1 or F2, agent is switched and a different a star path is displayed for
both exiting and entering agents. The selected agents are highlighted in different colors.
Some code snippet, references or help were taken from the following repositories,
-
CppND - System monitor project, where several code snippets were used for the terminal user interface
-
From the CppND - Concurrent traffic simulation project, for all concurrent matters where several code snippets were used for the terminal user interface
-
As well as material as taught from the CppND from udacity
-
Other single references are commented inside the code
- A
README
with instructions is included with the project - The
README
indicates which project is chosen - The
README
includes information about each rubric point addressed
- Code is compiling and running
- The project demonstrates an understanding of C++ functions and control structures
- The project uses Object Oriented Programming techniques -> refer to all code in
src/
folder - Classes use appropriate access specifiers for class members
- Classes abstract implementation details from their interfaces
- Classes encapsulate behavior -> refer to all private methods from code classes
- The project makes use of references in function declarations -> refer as an example to
Agent.cpp::12
(agent class constructor) - The project uses destructors appropriately -> refer to
WaitingArea.cpp::163
- The project uses scope / Resource Acquisition Is Initialization (RAII) where appropriate -> refer to
shared_ptr
throughout the code - The project uses move semantics to move data, instead of copying it, where possible -> refer to
WaitingArea.cpp::24
as an example - The project uses smart pointers instead of raw pointers
- The project uses multithreading -> refer to
WaitingArea.cpp::118
- A promise and future is used in the project -> refer to
WaitingArea.cpp::81
- A mutex or lock is used in the project -> refer to
WaitingArea.cpp::14