Ejemplo n.º 1
0
 def evaluate(self, blockset):
     # iterate me, over all groundings of variables, if one is found, break, if not, rule not satisfied
     for a in range(len(blockset)):
         onfireA = blockset[a].onfire
         if onfireA:
             return Goal(blockset[a].id, negate=True, predicate="onfire")
     return None
Ejemplo n.º 2
0
    def evaluate(self, blockset):

        # iterate me, over all groundings of variables, if one is found, break, if not, rule not satisfied
        for a in range(len(blockset)):
            for b in range(len(blockset)):
                clearB = blockset[b].clear
                squareB = blockset[b].type == Block.SQUARE
                triangleA = blockset[a].type == Block.TRIANGLE

                if clearB and squareB and triangleA:
                    return Goal(blockset[a].id, blockset[b].id, predicate="on")
        return None
Ejemplo n.º 3
0
    def evaluate(self, blockset):
        # iterate me, over all groundings of variables, if one is found, break, if not, rule not satisfied
        for a in range(len(blockset)):
            for b in range(len(blockset)):
                for c in range(len(blockset)):
                    for d in range(len(blockset)):
                        onAC = blockset[a].on == blockset[c]
                        onBD = blockset[b].on == blockset[d]
                        onDC = blockset[d].on == blockset[c]
                        AnotD = blockset[a] != blockset[d]

                        if onAC and onBD and onDC and AnotD:
                            return Goal(blockset[a].id,
                                        blockset[b].id,
                                        predicate="on")
        return None
Ejemplo n.º 4
0
    def evaluate(self, blockset):

        # iterate me, over all groundings of variables, if one is found, break, if not, rule not satisfied
        for a in range(len(blockset)):
            for b in range(len(blockset)):
                for c in range(len(blockset)):
                    for d in range(len(blockset)):
                        onAC = blockset[a].on == blockset[c]
                        onBD = blockset[b].on == blockset[d]
                        onCB = blockset[c].on == blockset[b]
                        squareD = blockset[d].type == Block.SQUARE

                        if onAC and onBD and onCB and squareD:
                            return Goal(blockset[a].id,
                                        blockset[b].id,
                                        predicate="on")
        return None