while learning prolog, writing text-based game, of it:
newhealth health - damage, retract(stat(target, health, health)), assert(stat(target, health, newhealth)),
i got error static procedures simple search fixed it, when running game dynamic stat/3
. after however, error further in file declare health variable:
stat(target, health, health),
i narrowed down problem (prolog console):
| ?- assert(test(a)). yes | ?- listing test(a). yes | ?- dynamic test/1 yes | ?- listing yes
after being declared dynamic, isn't in static database anymore. google search couldn't find case has same problem mine. need query , retract/assert single database.
dynamic/1 directive. place near top of file, syntax
:- dynamic stat/3.
Comments
Post a Comment