A console TicTacToe game in Logtalk (3.36.0 or later), which you play against the computer.
This repo workflow automatically runs (on commit events) tests, publishes a code coverage report, and makes available as build artifacts the TAP report, the code coverage report, the API documentation, the source code diagrams, and the SWI-Prolog 8.1.x QLF files and saved state with the precompiled game.
How to play
Launch Logtalk and load the game:
Then you have a choice of difficulties:
or you can play against another human:
In an easy game the computer makes random moves. In the hard game it uses a smart strategy to actively try and win, but not so smart that it's impossible to win!
Running the precompiled version (SWI-Prolog 8.1.x only)
Go to the commits
list, click on the green check mark of the latest successful commit,
and then click on details. On the build report page, click on the
artifacts list and download both
files. Uncompress the files, start SWI-Prolog, and load the files:
?- [logtalk, application]. ... true
After, use the queries in the section above to start the game.
Due to the use of non-ASCII characters to draw the board, the current version requires a backend that supports UTF-8 encoding. The game can currently be played on CxProlog, SICStus Prolog, SWI-Prolog, and YAP.
We've tried to keep this a relatively simple but comprehensive example. So for the OO we're only using objects, parametric objects, and a couple of extensions.
A high-level view of the pre-development design (before any code!):
The implementation generated by Logtalk from the source code:
We've also made an effort to include documentation and unit tests to demonstrate the utility of the Logtalk ecosystem, hence the workflow badge and information above.