JESS: [EXTERNAL] Re: Limit on number of rules tried?
northparkjamie <[email protected]> Thu, 19 Dec 2013 19:11:07 -0800
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_123611_18424776.1387509067721
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
My apologies for the lousy formatting of my original message. Please see
properly formatted version below.
northparkjamie wrote
> Hi, can you please help me?
>
> I'm relatively new to Jess (and using it with
> CTAT <http://ctat.pact.cs.cmu.edu/>
> , so my question may need to be redirected to them).
>
> I am trying to build a sudoku tutor (just to improve my skills) and I'm
> having a problem with my very first rule (below). This rule fires if one
> cell is empty and another in the same row is not. On the RHS, the predict
> function (from CTAT) checks whether the number entered by the user into
> the first cell is the same as the number in the second cell. If it is the
> same, the construct-message function displays the given message. If it is
> different, anything that has happened on the RHS is or remains undone. For
> example, if the row is {nil nil 6 nil nil nil 2 3 nil} and the user enters
> 6 in any of the nil cells, the rule should fire and the predict should
> match and the message should be shown. But, if the user enters 8, the rule
> should still fire, but the predict function should fail, so nothing should
> happen.
>
> If I test this rule on the first row of the 9x9 grid, it behaves as
> expected. But if I test it on any other row, the engine only tries it 20
> times and never finds the cell in which the input was placed.
>
> Is there something in Jess that is limiting the number of trials or should
> I be talking to the CTAT people? If it is Jess, is there a way I can
> modify this limitation?
>
> Thanks in advance for your time and wisdom,
> Jamie
>
> (defrule bug-num-is-in-row
> ?prob <- (problem
> (interface-elements $?
> ?grid $?))
> ?grid <- (grid (rows $? ?row $?))
> ?row <- (row (cells $? ?cell $?))
> ?cell <- (cell
> (name ?name)
> (value nil)
> (row-number ?row-num))
> ?cell2 <- (cell
> (value ?number&~nil)
> (row-number ?row-num2))
> (test (= ?row-num ?row-num2))
> =>
> (predict ?name UpdateTextField ?number)
> (construct-message
> "[The row already has a
> "?number".]")
> )
--
View this message in context: http://jess.2305737.n4.nabble.com/Limit-on-number-of-rules-tried-tp4654204p4654205.html
Sent from the Jess mailing list archive at Nabble.com.
------=_Part_123611_18424776.1387509067721
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: 7bit
My apologies for the lousy formatting of my original message. Please see properly formatted version below.<br/><br/>
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' class="quote dark-border-color"><div class="quote light-border-color">
<div class="quote-author" style="font-weight: bold;">northparkjamie wrote</div>
<div class="quote-message shrinkable-quote">
Hi, can you please help me?<br/><br/>
I'm relatively new to Jess (and using it with <a href="http://ctat.pact.cs.cmu.edu/" target="_top" rel="nofollow" link="external">CTAT</a>, so my question may need to be redirected to them).<br/><br/>
I am trying to build a sudoku tutor (just to improve my skills) and I'm having a problem with my very first rule (below). This rule fires if one cell is empty and another in the same row is not. On the RHS, the predict function (from CTAT) checks whether the number entered by the user into the first cell is the same as the number in the second cell. If it is the same, the construct-message function displays the given message. If it is different, anything that has happened on the RHS is or remains undone. For example, if the row is {nil nil 6 nil nil nil 2 3 nil} and the user enters 6 in any of the nil cells, the rule should fire and the predict should match and the message should be shown. But, if the user enters 8, the rule should still fire, but the predict function should fail, so nothi
ng should happen.<br/><br/>
If I test this rule on the first row of the 9x9 grid, it behaves as expected. But if I test it on any other row, the engine only tries it 20 times and never finds the cell in which the input was placed.<br/><br/>
Is there something in Jess that is limiting the number of trials or should I be talking to the CTAT people? If it is Jess, is there a way I can modify this limitation?<br/><br/>
Thanks in advance for your time and wisdom,<br/>
Jamie<br/><br/>
(defrule bug-num-is-in-row <br/>
?prob <- (problem <br/>
(interface-elements $? ?grid $?))<br/>
?grid <- (grid (rows $? ?row $?))<br/>
?row <- (row (cells $? ?cell $?))<br/>
?cell <- (cell <br/>
(name ?name)<br/>
(value nil)<br/>
(row-number ?row-num))<br/>
?cell2 <- (cell <br/>
(value ?number&~nil)<br/>
(row-number ?row-num2))<br/>
(test (= ?row-num ?row-num2))<br/>
=><br/>
(predict ?name UpdateTextField ?number)<br/>
(construct-message <br/>
"[The row already has a "?number".]")<br/>
)
</div>
</div></blockquote>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://jess.2305737.n4.nabble.com/Limit-on-number-of-rules-tried-tp4654204p4654205.html">Re: Limit on number of rules tried?</a><br/>
Sent from the <a href="http://jess.2305737.n4.nabble.com/">Jess mailing list archive</a> at Nabble.com.<br/>
------=_Part_123611_18424776.1387509067721--
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
in the BODY of a message to [email protected], NOT to the list
(use your own address!) List problems? Notify [email protected].
--------------------------------------------------------------------