Row goes from 1 to 8.
Column goes from 1 to 8.
Queen goes from 1 to 8.
Every queen can be assigned_row exactly 1 row.
Every queen can be assigned_column exactly 1 column.
The following rule:
Queen Q1 is sharing_row with queen Q2 when
queen Q1 is assigned_row row R1 and also
queen Q2 is assigned_row row R2.
Compiles (with the online tool) in a way that seems to violate my intuition:
The issue here is that Q2 is used in both arguments of the predicate sharing_row/2. Intuitively, I would think it should compile as sharing_row(Q1,Q2).
Changing the CNL rule to use the another:
Queen Q1 is sharing_row with another queen Q2 when
queen Q1 is assigned_row row R1 and also
queen Q2 is assigned_row row R2.
Consider the following declarations:
The following rule:
Compiles (with the online tool) in a way that seems to violate my intuition:
The issue here is that
Q2
is used in both arguments of the predicatesharing_row/2
. Intuitively, I would think it should compile assharing_row(Q1,Q2)
.Changing the CNL rule to use the
another
:Compiles to:
This is better, but it still doesn't capture the semantics of
another
in that the rule is missing the inequality betweenQ1
andQ2
.