I have a puzzle with initial state
R R R G R
R G G R R
R G G R G
R G G R R
R R R B R
Where R = Red
, G = Green
and B = Moveable Blank
and Goal State
R R R R R
R G G G R
R G B G R
R G G G R
R R R R R
I know in order to move the blank i must apply searching algorithms like DFS, BFS, A* etc
and i know i must create classes:
Node
class Node {
char board[5][5];
Node *parent;
};
Tree
class Tree {
Node *root;
};
Frontier like Hash Table to detect visited state in O(1) complexity.
So i am just confused how will i start implementing a solution to this puzzle. Can anyone guide me? The operators that i can apply on the blank are up, down, left, right.