Skip to content

๐Ÿ•น๏ธ Command line game which simulates a robot explorer on a board with obstacles, built in C++

License

Notifications You must be signed in to change notification settings

valentechie/robot_explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

32 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– Simulation of a Robot Explorer on a Board with Obstacles

GPL-3.0 License Language Status


๐Ÿ“š Table of Contents


๐Ÿš€ Introduction

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.


๐ŸŽฌ Demo


๐Ÿ› ๏ธ Requirements

  • Compiler: Any modern C++ compiler
  • Language Standard: C++
  • Operating System: Linux

    May also work on macOS or Windows with minor adjustments


๐Ÿ“ฆ Installation

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

๐Ÿ•น๏ธ Usage

  • 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

๐Ÿ“ File Overview

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

๐ŸŽ“ Project Context

Developed as the final assignment for Fundamentos de la Programaciรณn at URJC.
This project helped consolidate key programming concepts and practical C++ experience.


๐Ÿค Contributing

Contributions are welcome!

  • Fork this repository
  • Open issues for bugs or ideas
  • Submit pull requests to improve the project

๐Ÿ“„ License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0)

About

๐Ÿ•น๏ธ Command line game which simulates a robot explorer on a board with obstacles, built in C++

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages