Rule-Based Programming in Interactive Fiction
eblong.com
eblong.com
https://linusakesson.net/dialog/index.php
Dialog is a Prolog dialect: it’s like Markdown and Prolog had a baby.
> Dialog is a domain-specific language for creating interactive fiction. It is heavily inspired by Inform 7 (Graham Nelson et al. 2006) and Prolog (Alain Colmerauer et al. 1972), and substantially different from both.
I love it. I've put considerable effort into building tools around it, and to building up a library of extensions.
There is so much confusion about that and I blame textbooks like Structure and Interpretation of Computer Programs and hackers like Gerald Sussman who have taught generations of programming students that Prolog is about backtracking with unification. It isn't and I've had many awkward conversations with folks who know about logic programming and Prolog from SICP and other similar texts until I realised that we are talking about completely different things.
If I remember correctly SICP doesn't even mention SLD-Resolution, or Resolution at all and most people I've spoken to who have learned about Prolog and "logic programming" from SICP have not even heard the words "SLD-Resolution". It's like a Prolog from a parallel universe based on dictionaries and partial unification with LISP variables.
As to Dialog in particular- it's a Domain Specific Language for writing IF games. Ver cool but not Prolog.
https://www.linusakesson.net/games/the-impossible-bottle/ind... https://ifcomp.org/comp/2020?compact=0
Of course I since realized that was the tip of the iceberg.
Don't know much yet but some interesting things I've found:
Dusa, which promises an easier way to merge constraint languages and answer sets https://dusa.rocks/
Puzzlescript, which isn't exactly the same paradigm (its declarative but not a logic lang) that is beloved by the sokobon puzzle community. Sokobon itself is three lines of code in this and many other games only need to add one or two more. Its genius. https://www.puzzlescript.net/
My goal rn as an art project is to try to combine the two, so every puzzlescript game can be queried for interesting properties in Dusa / Potasscio / Some Logic Language.
When the author gets to the portion on priorities, in CLIPS this is (primarily) handled with salience and modules.
Salience is a numeric value assigned to each rule, assuming only one agenda the rules with the highest salience will be processed first.
Modules group rules and there's a "focus" stack of modules. The module at the top of the focus stack has its agenda processed first before any other modules. Focus can be controlled by the programmer.
It then has other mechanisms (selectable by the programmer, default is "depth strategy") for when an agenda has multiple rules of the same salience. Depth strategy is LIFO (last in first out), treating the salience level as a stack. So if a rule with salience 10 is activated and later a second rule is activated with salience 10, the second one will run first.
https://www.clipsrules.net/documentation/v641/bpg641.pdf - Page 26 for conflict resolution strategies.