Understanding first premise using preferential order

67 views
Skip to first unread message

kartik vermun

unread,
Apr 16, 2017, 2:03:52 PM4/16/17
to PyKE
I am trying to understand the first premise. 
Let's say I have various shapes of various colors. 
shape.shape_color(circle,red)
shape.shape_color(circle,green)
shape.shape_color(circle,blue)

and I have a preferential order = ['blue','green','red']
So i want circle , blue as the final shape color pair.

I have the following rule - 
select_shape_colors
    foreach
        shape.shape_color($shape,$color)
    $color_preference = get_color_preference()
    forall $color in color_preference
        first
            shape.shape_color($shape2,$color2)
    assert
        shape.final_shape_color($shape2,$color2)

fc_extras
    def get_color_preference():
        return ('blue','green','red')

I an unable to figure out the errors in this rule, be it syntax or logical.
Does anyone have any idea?

Thanks
Reply all
Reply to author
Forward
0 new messages