core of the solver that can rearrange puzzles generated by users