Reminds me of Dialog, a domain-specific language for writing adventure games, heavily inspired by Prolog:<p><a href="https://github.com/Dialog-IF/dialog/">https://github.com/Dialog-IF/dialog/</a><p><a href="https://linusakesson.net/dialog/" rel="nofollow">https://linusakesson.net/dialog/</a>
Very nice. I gave a lab assignment like this once! It's a great way to learn Prolog.<p><a href="https://github.com/agiacalone/cecs-342-lab-prolog">https://github.com/agiacalone/cecs-342-lab-prolog</a>
Just for curiosity I just asked chat deepseek to load and solve the game and it solved it in half a second.<p>It suggested adding some riddle, for example:<p><pre><code> path(castle, up, tower) :-
at(blueprint, holding),
(solved_riddle -> true ;
write('Answer the riddle first: What walks on four legs in the morning...?'), nl,
read(Answer),
(Answer = 'human' -> assert(solved_riddle) ;
write('Wrong! Try again.'), nl, fail)).</code></pre>
I have never heard of Prolog before so this was cool. I did think the "make sure the flashlight is turned on" point was kind of confusing. I have the battery and flashlight, but there's no way to turn it on. I couldn't run it with gprolog but swipl works fine.
is it generated by LLM using prompt at <a href="https://github.com/stefanrodrigues2/Prolog-Adventure-game/blob/main/README.md">https://github.com/stefanrodrigues2/Prolog-Adventure-game/bl...</a>?
I only learned Prolog as a hobby, so I may be mistaken, but the quality of the code seems really bad? Starting from keeping game state in a bunch of magic globals (assert/retract everywhere), to a lack of input parsing (even though DCGs would be a perfect match), to comments that disagree with the code[1], to the game logic coupled with game mechanics as side effects (the winning condition is checked inside `take`)... I may be too used to Prolog code from books and tutorials, but the number of cuts also seems much larger than expected.<p>...now that I look at this, it's 3 years old. I wonder how much better today's LLMs would fare?<p>[1] <a href="https://github.com/stefanrodrigues2/Prolog-Adventure-game/blob/main/treasure_hunt.pl#L216-L225">https://github.com/stefanrodrigues2/Prolog-Adventure-game/bl...</a> - no, the routine does not "wait" on Windows, you'd need to put `get_char(_)` or something before `halt`.
When I was in school I had to do some stuff with prolog. I got my wife interested enough that she added some rooms and items to a game like this. Good times!