pub fn solve_puzzle(puzzle: &Puzzle) -> Result<Solution, DominoError>
Expand description
Attempts to solve a given puzzle using a recursive backtracking approach.
This function clones the puzzle, determines the missing tiles, and then attempts to solve the puzzle by filling in the missing tiles while ensuring valid adjacency constraints.
§Arguments
puzzle
- A reference to thePuzzle
structure representing the current puzzle state.
§Returns
Ok(Solution)
- If a valid solution is found.Err(DominoError::UnsolvablePuzzle)
- If no solution exists.Err(DominoError::InvalidPuzzle)
- If the puzzle input is invalid.