• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

why i cant see the result ,jess console

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(deftemplate pants-color (slot of) (slot is))
(deftemplate position (slot of) (slot is))
(defrule generate-possibilities
=>
(foreach ?name (create$ Fred Joe Bob Tom)
(foreach ?color (create$ red blue plaid orange)
(assert (pants-color (of ?name)
(is ?color))))
;;共有16种循环结果比如Fred red;Fred blue。。。。。
(foreach ?position (create$ 1 2 3 4)
(assert (position (of ?name)
(is ?position))))))
(defrule find-solution
;; There is a golfer named Fred, whose position is ?p1
;; and pants color is ?c1
(position (of Fred) (is ?p1))
(pants-color (of Fred) (is ?c1))
;; The golfer to Fred's immediate right
;; is wearing blue pants.
(position (of ?n&~Fred)
(is ?p& eq ?p (+ ?p1 1))))
(pants-color (of ?n&~Fred)
(is blue&~?c1))
;; We don't know anything about Joe, really
(position (of Joe) (is ?p2&~?p1))
(pants-color (of Joe) (is ?c2&~?c1))
;; Bob is wearing the plaid pants
(position (of Bob)
(is ?p3&~?p1&~?p&~?p2))
(pants-color (of Bob&~?n)
(is plaid&?c3&~?c1&~?c2))
;; Tom isn't in position 1 or 4
;; and isn't wearing orange
(position (of Tom&~?n)
(is ?p4&~1&~4&~?p1&~?p2&~?p3))
(pants-color (of Tom)
(is ?c4&~orange&~blue&~?c1&~?c2&~?c3))
=>
(printout t Fred " " ?p1 " " ?c1 crlf)
(printout t Joe " " ?p2 " " ?c2 crlf)
(printout t Bob " " ?p3 " " ?c3 crlf)
(printout t Tom " " ?p4 " " ?c4 crlf crlf))


this is the program ,and when i run it ,the result is
Jess, the Rule Engine for the Java Platform
Copyright (C) 2004 Sandia Corporation
Jess Version 7.0a6 3/23/2005

This copy of Jess will expire in 83 day(s).


i want to know why i cant see the result ??
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It doesn't look as though your program includes a call to (reset) and (run).
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank u very much . i see it ,and solve it by ur help
but sorry ,i forgot my first loagin name and this is my new number ,hope u remember me ,and now i am reading about the book:jess in action ,very good
thank u again
 
author & internet detective
Posts: 42135
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

Thanks,
Jeanne
Forum Bartender
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic