The sliding puzzle uses a 3 x 3 board with eight numbered tiles and one blank space. A tile can move into the blank space only when it is next to that space.
| Subroutine | Purpose |
|---|---|
| solved() | Returns true if the puzzle has been solved. Otherwise returns false. |
| checkSpace(row, column) | Returns true if there is a blank space next to the tile on the board in position (row, column). Otherwise returns false. |
| Subroutine | Purpose |
|---|---|
| move(row, column) | Moves the tile in position (row, column) to the blank space if the blank space is next to that tile. If the position is not next to the blank space, no move is made. |
Write a C# program to help the user solve the puzzle. Input the row and column of a tile; use checkSpace to determine whether it is next to the blank; call move if valid or output Invalid move otherwise; repeat until solved() is true. You must use the subroutines in Table 5 and Table 6. Use meaningful variable name(s) and C# syntax.
Your answer