Maze Solver_RWA2_GROUP21
This project is used to solve the maze using wall follower algorithm
robot.h
Go to the documentation of this file.
1 
11 #include <iostream>
12 #ifndef __ROBOT_H__
13 #define __ROBOT_H__
14 
15 namespace rwa2group21 {
16 class Robot {
17 public:
23  void turn_left();
29  void turn_right();
35  void move_forward();
41  int robot_get_y () { return m_position.second; }
47  int robot_get_x () { return m_position.first; }
53  char robot_get_direction () { return m_direction; }
54  std::vector<std::pair<int, int>> v5; // A vector v5 is used to append and track position of the robot along with its movement.
60  Robot(): m_position{0,0},m_direction{'n'},v5{std::pair{0,0}} {
61  }
62 private:
63  std::pair<int, int> m_position; // Used to store current position along x and y.
64  char m_direction; //Used to store current direction of the robot.
65 };
66 } // namespace rwa2group21
67 
68 #endif
algorithm.h
This file contains the implementation details for algorithm class.
robot.h
This class is used to drive the robot based on its position and orientation.
Simulator::setText
static void setText(int x, int y, const std::string &text)
Set the text in a cell at the given coordinates.
Definition: simulator.cpp:88
rwa2group21::Robot::turn_left
void turn_left()
Executes when turn left method is called from algorithm class and updates m_position and m_direction ...
Definition: robot.cpp:45
rwa2group21::Robot::move_forward
void move_forward()
when turn move forward method is called from algorithm class and updates m_position and m_direction a...
Definition: robot.cpp:6
Simulator::turnLeft
static void turnLeft()
Turn the robot left.
Definition: simulator.cpp:62
rwa2group21::Robot::Robot
Robot()
A constructor created with member initalisation list with default intial values for position,...
Definition: robot.h:60
rwa2group21::Robot::turn_right
void turn_right()
when turn right method is called from algorithm class and updates m_position and m_direction accordin...
Definition: robot.cpp:27
rwa2group21::Algorithm::run
void run(std::string algo)
This method is called from the main file, after which the whole methods of bot traversing around maze...
Definition: algorithm.cpp:238
Simulator::moveForward
static void moveForward(int distance=1)
Move the robot forward.
Definition: simulator.cpp:40
rwa2group21::Robot::robot_get_direction
char robot_get_direction()
Getter to return the current direction of the robot in the cell.
Definition: robot.h:53
Simulator::turnRight
static void turnRight()
Turn the robot right.
Definition: simulator.cpp:56
rwa2group21::Robot::robot_get_y
int robot_get_y()
Getter to return current position of robot along y direction.
Definition: robot.h:41
simulator.h
Functions to control the robot and get information on the maze.
rwa2group21::Algorithm
This class implements the search algorithm using a Left hand approach or right hand approach.
Definition: algorithm.h:23
rwa2group21::Robot::robot_get_x
int robot_get_x()
Getter to return current position of robot along x direction.
Definition: robot.h:47
Simulator::setColor
static void setColor(int x, int y, char color)
Set the color of the cell at the given coordinates.
Definition: simulator.cpp:76
rwa2group21::Robot
Definition: robot.h:16