3 ms·
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 globa
by klibertp 1y ago
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.
...now that I look at this, it's 3 years old. I wonder how much better today's LLMs would fare?
[1] https://github.com/stefanrodrigues2/Prolog-Adventure-game/blob/main/treasure_hunt.pl#L216-L225 https://github.com/stefanrodrigues2/Prolog-Adventure-game/bl... - no, the routine does not "wait" on Windows, you'd need to put `get_char(_)` or something before `halt`.