- Introduction
- Demo
- Requirements
- Installation
- Usage
- File Overview
- Project Context
- Contributing
- License
C++ program that simulates a robot moving around a map. The dimensions of the board, the initial position of the robot and the obstacles can be found in the input.txt
file. The user can modify the data in the input.txt file to make the game more dynamic.
The program will terminate when all the cells of the board have been visited or when the robot cannot move to any free cell. The number of free and occupied cells of the board should be displayed on the screen.
In addition, the final result of the program must be printed in a file called output.txt
.
- Compiler: Any modern C++ compiler
- Language Standard: C++
- Operating System: Linux
May also work on macOS or Windows with minor adjustments
1๏ธโฃ Clone the repository:
git clone https://github.com/valentechie/robot_explorer.git
2๏ธโฃ Navigate to the project folder:
cd robot_explorer
3๏ธโฃ Compile the code:
g++ robot_simulation.cpp -o robot_simulation
4๏ธโฃ Run the program:
./robot_simulation
-
Edit
input.txt
to set the board size, robot's starting position, and obstacles.Example
input.txt
:5 5 # Board size, rows(5) cols(5) 2 2 # Robot starting position, row (2) col(2) 1 0 # Obstacle at row (1) col (0) 1 3 # Obstacle at row (1) col (3)
-
Run the program.
-
Results are displayed on the terminal and saved in
output.txt
.Example
output.txt
:Total free cells visited: 23 Total Occupied cells: 2 Final board state: R # . . . * . . . . * * * . . . # . . . . . . . .
Legend:
R
= Robot#
= Obstacle.
= Free cell*
= Occupied cell
robot_simulation.cpp
: Main source code for simulation logic.input.txt
: Configuration for the board and robot.output.txt
: Final results after running the program.
Developed as the final assignment for Fundamentos de la Programaciรณn at URJC.
This project helped consolidate key programming concepts and practical C++ experience.
Contributions are welcome!
- Fork this repository
- Open issues for bugs or ideas
- Submit pull requests to improve the project
This project is licensed under the GNU General Public License v3.0 (GPL-3.0)