December 2015 |
Artificial Intelligence: Expert Systems with CLIPS and Free Software |
LIU/Brooklyn Artificial Intelligence |
2 (defmodule FISH (export deftemplate menu) )
3 (deftemplate FISH::fish
4 (slot species )
5 (multislot habitat )
6 (slot seasonal_availability ) ;date of fish runs
7 (slot open_season ) ;the date legal open season begins
8 (slot close_season ) ;the date the legal season closes
9 (slot size_min ) ;minimum legal size allowed to be taken
10 (slot limit ) ;legal maximum allowed number of fish allowed
11 (slot fishing_type ) ;bottom or gamefishing
12 (slot fishing_location ) ;inshore or offshore
13 (multislot best_trip ) ; best to fish day or night
14 (slot desireability) ; how much people like to fish
15 )
60 (deffacts FISH::fishes
61 (fish (species tautog) (habitat bottom wrecks) (seasonal_availability winter_tautog )
62 (open_season 21022) (close_season 21231 ) (size_min 24 )
63 (limit 4 ) (fishing_type bottom ) (fishing_location offshore )
64 (best_trip day ) (desireability 5)
65 )
66 (fish (species tautog) (habitat bottom wrecks) (seasonal_availability winter_tautog )
67 (open_season 21022) (close_season 21231 ) (size_min 24 )
68 (limit 4 ) (fishing_type bottom ) (fishing_location offshore_federal_waters )
69 (best_trip day ) (desireability 5)
70 )
71 (fish (species tautog) (habitat bottom wrecks) (seasonal_availability winter_tautog )
72 (open_season 21022) (close_season 21231 ) (size_min 24 )
73 (limit 4 ) (fishing_type bottom ) (fishing_location inshore )
74 (best_trip day ) (desireability 2)
75 )
76 (fish (species striped_bass) (habitat inshore current rocks ) (seasonal_availability spring_bass_run )
77 (open_season 20101 ) (close_season 21231 ) (size_min 31 )
78 (limit 1 ) (fishing_type game) (fishing_location inshore )
79 (best_trip day night ) (desireability 4)
80 )
81 (fish (species striped_bass) (habitat inshore current rocks ) (seasonal_availability fall_bass_run )
82 (open_season 20101) (close_season 21231 ) (size_min 31 )
83 (limit 1 ) (fishing_type game ) (fishing_location inshore )
84 (best_trip day night ) (desireability 4)
85 )
86 (fish (species scup) (habitat bottom) (seasonal_availability warm_months )
87 (open_season 20501 ) (close_season 20831 ) (size_min 10 )
88 (limit 30 ) (fishing_type bottom ) (fishing_location inshore )
89 (best_trip day ) (desireability 3 )
90 )
91 (fish (species scup) (habitat bottom) (seasonal_availability warm_months )
92 (open_season 20501 ) (close_season 20831 ) (size_min 10 )
93 (limit 30 ) (fishing_type bottom ) (fishing_location offshore )
94 (best_trip day ) (desireability 4 )
95 )
96 (fish (species scup) (habitat bottom) (seasonal_availability warm_months )
97 (open_season 20501 ) (close_season 20831 ) (size_min 10 )
98 (limit 30 ) (fishing_type bottom ) (fishing_location offshore_federal_waters )
99 (best_trip day ) (desireability 4 )
100 )
101 (fish (species scup) (habitat bottom) (seasonal_availability warm_months )
102 (open_season 20901 ) (close_season 21031 ) (size_min 10 )
103 (limit 45 ) (fishing_type bottom ) (fishing_location offshore )
104 (best_trip day night) (desireability 4 )
105 )
106 (fish (species scup) (habitat bottom) (seasonal_availability warm_months )
107 (open_season 20901 ) (close_season 21031 ) (size_min 10 )
108 (limit 45 ) (fishing_type bottom ) (fishing_location offshore_federal_waters )
109 (best_trip day night) (desireability 4 )
110 )
111 (fish (species scup) (habitat bottom) (seasonal_availability warm_months )
112 (open_season 20901 ) (close_season 21031 ) (size_min 10 )
113 (limit 45 ) (fishing_type bottom ) (fishing_location inshore )
114 (best_trip day night) (desireability 3 )
115 )
116 (fish (species scup) (habitat bottom) (seasonal_availability warm_months )
117 (open_season 21101 ) (close_season 21231 ) (size_min 10 )
118 (limit 30 ) (fishing_type bottom ) (fishing_location inshore )
119 (best_trip day ) (desireability 3 )
120 )
121 (fish (species scup) (habitat bottom) (seasonal_availability warm_months )
122 (open_season 21101 ) (close_season 21231 ) (size_min 10 )
123 (limit 30 ) (fishing_type bottom ) (fishing_location offshore )
124 (best_trip day ) (desireability 4 )
125 )
126 (fish (species scup) (habitat bottom) (seasonal_availability warm_months )
127 (open_season 21101 ) (close_season 21231 ) (size_min 10 )
128 (limit 30 ) (fishing_type bottom ) (fishing_location offshore_federal_waters )
129 (best_trip day ) (desireability 4 )
130 )
131 (fish (species fluke ) (habitat bottom ) (seasonal_availability warm_months)
132 (open_season 20517) (close_season 20921 ) (size_min 18 )
133 (limit 5 ) (fishing_type bottom ) (fishing_location inshore )
134 (best_trip day ) (desireability 3)
135 )
136 (fish (species bluefish) (habitat open_water current ) (seasonal_availability all_year)
137 (open_season 20101 ) (close_season 21231 ) (size_min 0 )
138 (limit 500 ) (fishing_type game ) (fishing_location inshore )
139 (best_trip day ) (desireability 2 )
140 )
141 (fish (species bluefish) (habitat open_water current ) (seasonal_availability all_year)
142 (open_season 20101 ) (close_season 21231 ) (size_min 12 )
143 (limit 15 ) (fishing_type game ) (fishing_location offshore )
144 (best_trip day ) (desireability 3 )
145 )
146 (fish (species bluefish) (habitat open_water current ) (seasonal_availability all_year)
147 (open_season 20101 ) (close_season 21231 ) (size_min 12 )
148 (limit 15 ) (fishing_type game ) (fishing_location offshore_federal_waters )
149 (best_trip day ) (desireability 3 )
150 )
151 (fish (species cod ) (habitat open_water) (seasonal_availability winter )
152 (open_season 20101 ) (close_season 21231 ) (size_min 22 )
153 (limit 10 ) (fishing_type bottom ) (fishing_location offshore )
154 (best_trip day ) (desireability 3)
155 )
156 (fish (species cod ) (habitat open_water) (seasonal_availability winter )
157 (open_season 20101 ) (close_season 21231 ) (size_min 22 )
158 (limit 10 ) (fishing_type bottom ) (fishing_location offshore_federal_waters )
159 (best_trip day ) (desireability 3)
160 )
161 (fish (species black_sea_bass ) (habitat bottom ) (seasonal_availability warm_months )
162 (open_season 20715) (close_season 21031 ) (size_min 14 )
163 (limit 8 ) (fishing_type bottom ) (fishing_location inshore )
164 (best_trip day ) (desireability 3 )
165 )
166 (fish (species black_sea_bass ) (habitat bottom ) (seasonal_availability warm_months )
167 (open_season 21101) (close_season 21231 ) (size_min 14 )
168 (limit 10 ) (fishing_type bottom ) (fishing_location inshore )
169 (best_trip day ) (desireability 3 )
170 )
171 (fish (species black_sea_bass ) (habitat bottom ) (seasonal_availability warm_months )
172 (open_season 20715) (close_season 21031 ) (size_min 14 )
173 (limit 8 ) (fishing_type bottom ) (fishing_location offshore )
174 (best_trip day ) (desireability 3 )
175 )
176 (fish (species black_sea_bass ) (habitat bottom ) (seasonal_availability warm_months )
177 (open_season 21101) (close_season 21231 ) (size_min 14 )
178 (limit 10 ) (fishing_type bottom ) (fishing_location offshore )
179 (best_trip day ) (desireability 3 )
180 )
181 (fish (species black_sea_bass_federal ) (habitat bottom ) (seasonal_availability warm_months )
182 (open_season 20515) (close_season 20921 ) (size_min 14 )
183 (limit 10 ) (fishing_type bottom ) (fishing_location offshore_federal_waters )
184 (best_trip day ) (desireability 3 )
185 )
186 (fish (species black_sea_bass_federal ) (habitat bottom ) (seasonal_availability warm_months )
187 (open_season 21022) (close_season 21231 ) (size_min 14 )
188 (limit 10 ) (fishing_type bottom ) (fishing_location offshore_federal_waters )
189 (best_trip day ) (desireability 3 )
190 )
191 (fish (species ling ) (habitat mud bottom ) (seasonal_availability winter )
192 (open_season 20101) (close_season 21231 ) (size_min 0)
193 (limit 500 ) (fishing_type bottom ) (fishing_location offshore )
194 (best_trip day ) (desireability 2)
195 )
196 (fish (species ling ) (habitat mud bottom ) (seasonal_availability winter )
197 (open_season 20101) (close_season 21231 ) (size_min 0)
198 (limit 500 ) (fishing_type bottom ) (fishing_location offshore_federal_waters )
199 (best_trip day ) (desireability 2)
200 )
201 )
29 (deftemplate FISH::season
30 (slot description ) (slot start_date) (slot end_date)
31 )
32 (deftemplate FISH::date
33 (slot categ (type SYMBOL) (allowed-symbols today start_date end_date) )
34 (slot day (type INTEGER) (range 1 31))
35 (slot month (type INTEGER) (range 1 12))
36 (slot dateint (type INTEGER)(range 20101 21231 )) ; (dateint - 20000 ) is the date
37 )
38
39 (deffunction FISH::openseason (?start ?end ?today )
40 (if (> ?start ?end )
41 then
42 (or
43 (and (>= ?today ?start ) (<= ?today 21231))
44 (and (>= ?today 20101 ) (<= ?today ?end))
45 )
46 else (and (>= ?today ?start) (<= ?today ?end))
47 )
48 )
7 (defrule FISH::getdate
8 =>
9 ( printout t crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf )
10 ( printout t crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf )
11 ( printout t crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf )
12 ( printout t crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf )
13 ( printout t crlf crlf crlf crlf crlf crlf crlf crlf crlf crlf )
14 ( printout t crlf "Enter the Date" crlf "What is the Month (as an integer) ==>")
15 (bind ?month (read) )
16 (printout t crlf "What is the Day (as an integer)==> ")
17 (bind ?day (read) )
18 (bind ?day2 (+ ?day 10000))
19 (bind ?month2 (+ (* ?month 100) 10000))
20 (assert (date (categ today) (month ?month) (day ?day) (dateint (+ ?month2 ?day2))))
21 )