"""Larsdoku — Pure logic Sudoku solver powered by WSRF bitwise engine + GF(2) linear algebra.

100% pure logic on Top1465 benchmark (1465/1465). Zero guessing. Every step proven.

Quick usage:
    from larsdoku import solve
    result = solve("003000600900700010080005020600010900200807003004090005020500060010003002005000300")
    print(result['board'])       # solved board
    print(result['n_steps'])     # number of steps
    print(result['technique_counts'])  # technique frequency
"""
__version__ = "1.8.9"


def solve(puzzle, max_level=99, no_oracle=False, detail=False, gf2_extended=False):
    """Solve a Sudoku puzzle with pure logic.

    Args:
        puzzle: 81-char string (0 or . for empty cells)
        max_level: max technique level to use (1-7, default all)
        no_oracle: if True, stop when stalled instead of guessing
        detail: capture rich detail (candidates, explanations, rounds)
        gf2_extended: use GF(2) Extended mode

    Returns:
        dict with keys: success, board, steps, n_steps, technique_counts,
                        solution, empty_remaining, rounds, stalled
    """
    from larsdoku.cli import solve_selective, normalize_puzzle
    bd81 = normalize_puzzle(puzzle)
    return solve_selective(bd81, max_level=max_level, no_oracle=no_oracle,
                           detail=detail, gf2_extended=gf2_extended)
