Latrunculli with Prolog
I will re-organize this page in a few weeks, but until then, here are the Prolog codes for the Latrunculli game.
You will also find the images I have used for the GUI in the zip file. You can write to me if you have any problems with the code. If you are going to work with it, Zafer advises you to use a lot of cuts all over the program. I haven't been as deliberate with my cuts, so I had to implement recursive predicates that utilize the stack logarithmically (instead of the simpler linear recursion).
- userint.pl: The user interface code. consult this, and type 'start' to start the game. It consults the other files...
- main.pl: The game-specific predicates.
- strategies.pl: Three strategies that I have defined are here.
- ga.pl: The generic genetic algorithm code that can theoretically be used to optimize any piecewise board evaluation function (among other things, of course).
- fitness.pl: Problem-specific fitness function. The fitness of an individual is determined by letting it play against a fixed opponent, and looking at the statistics after the contest. It does not exactly work, because there is a quiet_game predicate that I haven't written. It is basically the normal game, but without XPCE calls, because my XPCE is the freeware version that crashes after 20 minutes. That is not enough for the GA to complete.
Last updated: 30 January 2002
Back to my homepage...