Table Of Contents

Previous topic


Next topic

The base knowledge of sudoku

This Page

Welcome to SudokuStudyLib’s documentation!

This is a tool and library for studying Logic and Python programming. It includes two packages, one is Sudoku, and another is Matrix. The Sudoku is an oop approaching library, while the Matrix is a traditional function processing library.

This library and document are major for Soduku package, the Matrix package is just a reference for a traditional programmer.


You can use pip to install the library:

pip install SudokuStudyLib

and you can clone the project from:

When you has installed, it will contain two packages, sudoku, and matrix. The following is the file structure:



  1. OOP method: sudoku, in the

    from sudoku import *
    # to solve a sudoku defined in data directory
    # to solve a sudoku and just using the methods which level <= 15 and if can't solve, don't use guess method
    solve("", level_limit=15, use_try=False)
    # to solve a sudoku with emulator methods and print the steps
    solve("", use_emu=True, print_step=True)
    # to solve the world's best difficult sudoku
    # by default method
    # by computer's try error
    try_error(None, file="")
    # by all methods but not using human guessing, it can't solve the sudoku
    solve("", use_emu=True, use_try=False)
    # by basic human methods and guess
    solve("", level_limit=10, use_try=True)
    solve("", level_limit=3, use_try=True)
  2. Traditional method: matrix, in the

    from matrix import *
    # solve it directly
    m, n, p = main("")
    # solve it by limit methods, it can't solve the sudoku
    m, n, p = main("", methods=8)
    # set the limit methods to the 10, and it can solve the sudoku
    m, n, p = main("", methods=10)
    # using the try error's method to solve the best difficult sudoku in the world
    m, n, p = TryError("")