Take the 2-minute tour ×    #include <iostream>  using namespace
std;   #include <list>   //A queue for the working set  //x,y
co-ords of the square, path length so far  struct square {
int x;     int y;      int path_length;  list<square>
workingset;   //A 2D array of ints to represent the board
(duplicates list) int board[10][10];   void
generatelegalmove(square node, int x_offset, int y_offset);
void printboard();   void main()     //Initialises the board
int i, j;             board[i][j] = 0;      //The goal position
- a number we will never reach      board[8][8] = 1337;
bool goal_found = false;       //Sets up initial position
square temp = {3, 7, 1};       //Put initial position in working
set and duplicates list     board[3][7] = 1;       //Loop (until
a goal is found)         //Get the head node from the working
set         square nodetocheck = workingset.front();
//Exit if the goal has been found
if(board[nodetocheck.x][nodetocheck.y] == 1337)
goal_f