Function generate_valid_puzzle

Source
pub fn generate_valid_puzzle(
    n: usize,
) -> Box<dyn Fn(ComplexityClass) -> Result<Puzzle, DominoError>>
Expand description

Generates a valid puzzle of size n that can later be customized by complexity class and randomness.

This function adopts a functional style by returning a series of closures, each progressively refining the puzzle generation process. The first closure takes a ComplexityClass, and the second closure takes a boolean (random). These parameters are intended to be used within the function, guiding the puzzle generation based on the chosen complexity and randomness.

§Arguments

  • n - The number of tiles in the puzzle.

§Returns

A function that, given a ComplexityClass, returns another function that generates a Puzzle.