コード例 #1
0
def recuringSolve(data, currentSol):
    # print('==============')
    # print(data)
    # print(currentSol)
    if len(data) == 0:
        if checkSolution(currentSol):
            displaySolution(currentSol)
        return

    row = data.pop(0)
    for i in range(4):
        # print(i)
        currentSol.append(row)
        recuringSolve(data, currentSol)
        currentSol.pop()
        row = rotate(row)
    data.insert(0, row)
コード例 #2
0
def recuringSolve(data, currentSol):
    # print('==============')
    # print(data)
    # print(currentSol)
    if len(data) == 0:
        if checkSolution(currentSol):
            displaySolution(currentSol)
        return

    row = data.pop(0)
    for i in range(4):
        # print(i)
        currentSol.append(row)
        recuringSolve(data, currentSol)
        currentSol.pop()
        row = rotate(row)
    data.insert(0, row)
コード例 #3
0
def solve(data):
    currentSol = [data.pop(0)]
    recuringSolve(data, currentSol)
コード例 #4
0
def solve(data):
    currentSol = [data.pop(0)]
    recuringSolve(data, currentSol)