Language CLIPS
Date: | 04/20/05 |
Author: | Bill Ensinger |
URL: | n/a |
Comments: | 1 |
Info: | n/a |
Score: | (2.50 in 4 votes) |
;Written by Bill Ensinger (Bill222E@aol.com) on Saturday February 24, 1996 ;8:00 - 9:41 pm Eastern Standard time at Taylor University. ;All praise to God; note that we just pass the beer, but don't drink! (deftemplate beer (field ninetynine)) (deffacts bottles (beer (ninetynine 99))) (defrule Bottlesninetynine "" (beer (ninetynine ?bottlenum)) ?fl <- (beer (ninetynine ?bottlenum)) (test (> ?bottlenum 2)) => (printout t ?bottlenum " bottles of beer on the wall," t) (printout t ?bottlenum " bottles of beer." t) (printout t "Take one down, pass it around," t) (printout t (- ?bottlenum 1) " bottles of beer on the wall." t) (printout t " " t) (modify ?fl (ninetynine =(- ?bottlenum 1))) ) (defrule Bottlestwo "" (beer (ninetynine 2)) ?fl <- (beer (ninetynine ?bottlenum)) => (printout t ?bottlenum " bottles of beer on the wall," t) (printout t ?bottlenum " bottles of beer." t) (printout t "Take one down, pass it around," t) (printout t (- ?bottlenum 1) " bottle of beer on the wall." t) (printout t " " t) (modify ?fl (ninetynine =(- ?bottlenum 1))) ) (defrule Bottlesone "" (beer (ninetynine 1)) ?fl <- (beer (ninetynine ?bottlenum)) => (printout t ?bottlenum " bottle of beer on the wall," t) (printout t ?bottlenum " bottle of beer." t) (printout t "Take one down, pass it around," t) (printout t "No more bottles of beer on the wall!" t) )
Download Source | Write Comment
Alternative Versions
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
One rule + sequence _ maps solution | Ken Roger Riggs | 01/25/10 | 0 |
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments
as said on 12/18/07 03:07:31
thank you
please help me in the problem with car
starter turning? yes or no
yes(got arry petrol?)yes or no
yes(call the aa)
no(Buy some!)