I am very new to Jess, and to rules-based programming, but have been
programming for 25 years.  I just got and read "Jess in Action", and worked
through the examples.

I am trying to learn Jess by developing an application to figure out playoff
seedings in the National Football League.  This is a reasonably complex
problem, but one I think (hope?) is small enough to be workable.  I have
facts defined to represent things like teams, divisions and game results.  I
am now trying to figure out how to write the rules to determine a team's
record.  A game is defined as:

(deftemplate game "A football Game"
 (slot home-team)
 (slot home-score)
 (slot home-tds)
 (slot visiting-team)
 (slot visiting-score)
 (slot visiting-tds))

I need to figure out a team's wins, losses, ties and net-tds (total
touchdowns scored for minus total touchdowns scored against).  I can think
of some approaches, but I am not sure which is correct.

First, I could run one or more queries to select games involving this team,
then iterate over the results counting up wins and losses.  This seems
rather procedural to me.

Second, I could run count-query-results for rules matching wins, losses and
ties.  This seems more in keeping with declarative programming, but is
running three queries too inefficient? I am not sure how to count up net-tds
by this method either.

Whichever method I choose, I will need the ability to get a team's record
over various subsets of games for tie-breaking purposes.  I might want games
within a division, or games among common opponents, for example.  I can get
a subset of facts with a query, but is there a way to then run queries only
on facts in that subset?

Thank you for any assistance, and please forgive any stupid questions.
--
Jim McMaster
mailto: [EMAIL PROTECTED]

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to