Maze Solver_RWA2_GROUP21
This project is used to solve the maze using wall follower algorithm
algorithm.h
Go to the documentation of this file.
1 
11 #ifndef __ALGORITHM_H__
12 #define __ALGORITHM_H__
13 #include <iostream>
14 #include <array>
15 #include <memory>
16 #include <vector>
17 #include "../robot/robot.h"
18 
19 namespace rwa2group21 {
23 class Algorithm {
24  public:
30  void run(std::string algo);
35  void init_outer_walls();
41  void follow_wall_left();
47  void follow_wall_right();
52  void generate_goal();
57  void set_right_wall();
62  void set_left_wall();
67  void set_front_wall();
84  Algorithm() : robot (std::make_unique<Robot>()), m_maze_height{16} , m_maze_width{16},goal{0,0}{
85  }
86  private:
87  std::unique_ptr<Robot> robot; // Creating a unique pointer object robot of class Robot to access the methods
88  std::pair<int, int> goal; //Initialsing goal with (0,0) then overriding it with random goal value generated.
89  int m_maze_height; //Setting the maze height to 16.
90  int m_maze_width; //Setting the maze width to 16.
91 
92 };
93 } // namespace rwa2group21
94 #endif
rwa2group21::Algorithm::traceback_robot_movement
void traceback_robot_movement()
Function for tracing back robot movement using coordinates generated from coordinate elimination func...
Definition: algorithm.cpp:289
algorithm.h
This file contains the implementation details for algorithm class.
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::Algorithm::set_right_wall
void set_right_wall()
Setting the right wall of a cell whenever the bot in that particular cell finds a wall on the right w...
Definition: algorithm.cpp:223
rwa2group21::Algorithm::follow_wall_right
void follow_wall_right()
right handed wall algorithm is executed using methods of robot class by recording and evaluating curr...
Definition: algorithm.cpp:112
Simulator::setWall
static void setWall(int x, int y, char direction)
Set a wall at the given coordinates.
Definition: simulator.cpp:68
rwa2group21::Algorithm::init_outer_walls
void init_outer_walls()
This method is internally called from the run method to highlight all the outer walls of any maze sel...
Definition: algorithm.cpp:184
rwa2group21::Algorithm::set_front_wall
void set_front_wall()
Setting the front wall of a cell whenever the bot in that particular cell finds a wall on the front w...
Definition: algorithm.cpp:206
Simulator::wallFront
static bool wallFront()
Check if there is a wall in front of the robot.
Definition: simulator.cpp:19
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
rwa2group21::Algorithm::traceback_coordinate_elimination
void traceback_coordinate_elimination()
Function is responsible for elimination of deadend coordinates during forward movement of the robot.
Definition: algorithm.cpp:259
Simulator::clearAllColor
static void clearAllColor()
Clear the color of all cells in the maze.
Definition: simulator.cpp:84
rwa2group21::Algorithm::generate_goal
void generate_goal()
generating a random goal every time using srand and rand function and is done during the start of the...
Definition: algorithm.cpp:10
rwa2group21::Algorithm::set_left_wall
void set_left_wall()
Setting the left wall of a cell whenever the bot in that particular cell finds a wall on the left whe...
Definition: algorithm.cpp:209
rwa2group21::Algorithm::Algorithm
Algorithm()
Creating a constructor using member initalisation list and default values. Intialised the instance of...
Definition: algorithm.h:84
Simulator::clearAllText
static void clearAllText()
Clear the text in all cells of the maze.
Definition: simulator.cpp:96
rwa2group21::Algorithm
This class implements the search algorithm using a Left hand approach or right hand approach.
Definition: algorithm.h:23
rwa2group21::Algorithm::follow_wall_left
void follow_wall_left()
left handed wall algorithm is executed using methods of robot class by recording and evaluating curre...
Definition: algorithm.cpp:39
Simulator::wallRight
static bool wallRight()
Check if there is a wall to the right of the robot.
Definition: simulator.cpp:26
Simulator::wallLeft
static bool wallLeft()
Check if there is a wall to the left of the robot.
Definition: simulator.cpp:33
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