MazeRoboSim is a native C++ 2D robotics simulator designed to teach basic maze-solving algorithms. It features a complete workflow from maze generation to coding and simulation.
- Procedural Generation: Uses a Recursive Backtracker algorithm to create perfect mazes.
- Customizable: Adjust maze dimensions and settings.
- Preview: See the maze layout before programming.
- Simplified C++: Write code using high-level commands like
forward(),left(), andright(). - Robot Preview: Visual representation of the robot chassis with sensors.
- Command Reference: Handy list of available commands and variables.
- Split View: Code on the left, Robot and Maze preview on the right.
- Real-Time Physics: The robot moves and interacts with the maze walls.
- Raycast Sensors: Accurate simulation of ultrasonic sensors (
fdist,ldist,rdist). - Visual Feedback: See the robot navigate the maze in real-time.
- CMake (3.18 or newer)
- C++ Compiler (GCC, Clang, or MSVC)
- Internet Connection (For fetching Raylib and ImGui dependencies)
This project uses CMake to automatically fetch dependencies (Raylib, ImGui) and build the project.
-
Prerequisites:
- Visual Studio with the "Desktop development with C++" workload.
- CMake (select "Add CMake to the system PATH").
- Git (select "Add Git to system PATH").
-
Clone the repository:
git clone https://github.com/Not1Sam/MazeRoboSim.git cd MazeRoboSim -
Configure and Build:
mkdir build cd build cmake .. -G "Visual Studio 17 2022" cmake --build . --config Release
Note: Adjust the generator
-Gif you are using a different version of Visual Studio. If you encounter aWinMainlinker error, this is already handled in theCMakeLists.txtfor you. -
Run: The executable
MazeRoboSim.exewill be in thebuild/Releasefolder.
- Prerequisites:
sudo apt update sudo apt install build-essential cmake libgl1-mesa-dev libxi-dev libxcursor-dev libxrandr-dev libxinerama-dev libx11-dev libglfw3-dev libopenal-dev
-
Prerequisites:
sudo pacman -Syu sudo pacman -S base-devel cmake mesa libxi libxcursor libxrandr libxinerama libx11 glfw-x11 openal
-
Clone the repository:
git clone https://github.com/Not1Sam/MazeRoboSim.git cd MazeRoboSim -
Configure and Build:
mkdir build cd build cmake .. make -
Run:
./MazeRoboSim
- Design: Configure your maze settings and click "Proceed to Programming".
- Code: Write your logic in the IDE.
- Commands:
forward(),backward(),left()(90° Snap),right()(90° Snap),stop(). - Variables:
fdist(Front),ldist(Left),rdist(Right),intvariables (e.g.,int i = 0;). - Control Flow:
if,else if,else,while,do-while,for. - Operators:
+,-,*,/,&&,||,!,<,>,? :. - Speed Control: Use the slider in the IDE to adjust the simulation step delay (0.1s - 2.0s).
- Example (Looping):
void loop() { int i = 0; while (i < 4) { if (fdist > 20) { forward(); } else { right(); } i = i + 1; } }
- Commands:
- Simulate: Click "Start Simulation" to watch your code run!