We aim to implement Depth First Search (DFS) on a grid, program will accept a problem text file and output a solution text file.
- Up : 1 move = 2 Squares
- Down : 1 move = 2 Squares
- Left : 1 move = 1 Square
- Right : 1 move = 3 Squares
Grid Rules:
- Available Cell : 1
- Unavailable Cell : -1
- Start Cell : 2
- End Cell : 3
An example of problem text file (problem.txt):
1. (0,6)(5,1)...(6,9) // List of available spaces in the grid.
2. 4 // Number of problems in this file.
3. 10 11 9 0 // Problem #1, first pair is start position, second pair is end position.
4. 3 2 4 4 // Problem #2
5. 2 7 9 11 // Problem #3
6. 1 1 11 11 // Problem #4
An example of solution text file (solution.txt):
1. 10 (10,11)(9,11)(7,8)(6,6)...(9,0) // First integer stands for minimum number of moves 'n'.
2. 3 (3,2)...(4,4) // Following the first integer is the coordinates of
3. 9 (3,2)...(4,4) // the path taken to reach from start coordinate to
4. 15 (1,1)...(11,11) // end destiation