GamesByAdam / aima-python

Automatically exported from code.google.com/p/aima-python
0 stars 0 forks source link

conjuncts() and disjuncts() need to be recursive #10

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I was playing with the Criminal(West) example and the new fol_bc_ask()
stuff, couldn't get it to work unless I changed conjuncts() as follows:

def conjuncts(s):
    if isinstance(s, Expr) and s.op == '&':
        r = []
        for arg in s.args:
            r.extend (conjuncts (arg))
        return r
    else:
        return [s]

Without this change, conjuncts() will do this:
>>> conjuncts (sar.args[0])
[((American(v_1) & Weapon(v_2)) & Sells(v_1, v_2, v_3)), Hostile(v_3)]

Original issue reported on code.google.com by rushing....@gmail.com on 2 Mar 2009 at 6:53

GoogleCodeExporter commented 8 years ago
r87 gets Criminal(West) working in a different way. It's possible other uses of 
conjuncts()/disjuncts() may need to be recursive, since I don't understand all 
this code, so I'm leaving the bug open.

Original comment by wit...@gmail.com on 4 Oct 2011 at 3:05

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r99.

Original comment by wit...@gmail.com on 5 Oct 2011 at 5:58