def test_should_choose_move_worst_positioned_tile():
    tiles = [1, 8, 2, 4, None, 3, 7, 6, 5]
    solver = Solver(tiles)
    possibilities = solver.lookahead(tiles)
    move_scores = solver.prioritize(possibilities)
    move_priorities = sorted(move_scores, key=move_scores.get)
    assert move_priorities[0] == 8
def test_can_provide_lookahead():
    puzzle = Solver([1, None, 3, 2])
    assert puzzle.lookahead([1, None, 3, 2]) == {
        1: [None, 1, 3, 2],
        2: [1, 2, 3, None]
    }