Hello everyone. This is my first post. I’ve been programming for over 30 years, but I finished my first ever (trivial) Prolog program last night. It took me two nights to make it work, which is a little embarrassing given that it only has one simple rule, but I am undeterred. I can now roll a six sided die in Prolog, and format/2 the result! This is the program I usually write in lieu of Hello World when learning a new programming language.
I came to consider Prolog three nights ago, when I wanted a way to decouple the rules of a game I was writing in Smalltalk from the rest of the business logic. I’ve been aware of what Prolog is for about 15 years, but hadn’t had a good excuse to learn it until now. Given that I expect Prolog – being a fundamentally different computational model from any that I’ve learned before – to be difficult to learn, I’ve decided to shelve Smalltalk for now, and aim to write a small game in (hopefully) pure Prolog.
The game I’d like to write is a “roguelike.” If you aren’t familiar with roguelikes, see:
https://en.wikipedia.org/wiki/Roguelike
This type of game requires a few of things from the implementation:
- I need to be able to disable echoing of keystrokes to the output
- I need to be able to recognize individual keystrokes, not full lines of input (i.e., no return at the end)
- I need to be able to move the cursor to an arbitrary screen location
- I need to be able to replace the character at the cursor with another character
From searching the forum’s posts, it does seem that SWI-Prolog makes use of ncurses, is this correct? If so, is this functionality exposed from within Prolog, either directly or via a library? If not, is FFI my best option?
Thanks in advance for any help you can offer.