At most one wumpus: Wumpus AI Project

376 views Asked by At

I am not able to use join with ' & ' with list operand. Any help would be appreciated!

def axiom_generator_at_most_one_wumpus(xmin, xmax, ymin, ymax):
    """
    Assert that there is at at most one Wumpus.

    xmin, xmax, ymin, ymax := the bounds of the environment.
    """

    axiom_str = ''
    options = []
    for x in range(xmin, xmax+1):
        for y in range(ymin, ymax+1):
            option = wumpus_str(x,y) + " >> ("
            notWumps = []
            for xtemp in range(xmin, xmax+1):
                for ytemp in range(ymin, ymax+1):
                    if xtemp != x and ytemp != y:
                        notWumps.append('~' + wumpus_str(xtemp,ytemp))
            option += ' & '.join(notWumps)
            option += ')'
            options.append(option)
    axiom_str += ' & '.join(options)
    return axiom_str
0

There are 0 answers