Beispiel #1
0
def mate(puztuple):
    puza = puztuple[0]
    puzb = puztuple[1]

    distsa = puza.distances
    distsb = puzb.distances
    movesa = puza.movenums
    movesb = puzb.movenums

    n = puza.n

    outmoves = {}

    for x in range(1, n + 1):
        for y in range(1, n + 1):

            if (distsa[(x, y)] > distsb[(x, y)]):
                outmoves[(x, y)] = movesa[(x, y)]
            else:
                outmoves[(x, y)] = movesb[(x, y)]

    babypuz = Puzzle(n)
    babypuz.movenums = outmoves
    babypuz.calculatemindistances()
    babypuz.evaluate()

    return babypuz