Reputation: 312
I just finished creating a game in Prolog using Sicstus.
During the game I use assert
's and retract
's to update the values of some variables I use.
When the game finishes, if I don't reconsult
the source files, and re-run the game, those variables have the same content of the past game, which makes sense.
So what I am asking is if exists some sort of built-in predicate that I can call at the end of the game so it reconsults the source files, establishing the original data of the game. (I know it is a lazy way to do it.)
Upvotes: 0
Views: 470
Reputation: 312
Perhaps you can remove the default facts from the file and write an initializer predicate that asserts them instead. Then you could retract all of them on a restart and rerun your initializer to set the defaults
– lurker
This was the answer. Thank you Lurker.
Upvotes: 0