Say I have a game like tic-tac-toe or chess. Or some other visual logic based problem.

I could express the state of the game as a string. (or perhaps a 2D array)

I want to be able to express the possible moves of the game as rules which change the string. e.g. replacement rules.

I looked into regex as a possibility but this doesn't seem powerful enough. For example, one can't have named patterns which one can use again. (e.g. if I wanted to name a pattern called "numbers_except_for_8". To be used again.

And it also should be able to express things like "repeat if possible".

In other words I need some simple language to express rules of a game that has:

  • modularity
  • simpleness
  • can act on other rules (self referential)

There are languages like LISP but these on the other hand seem too complicated. (Perhaps there is no simple language hence why the English language is so complicated).

I did read once about a generalised board game solving software program which had a way to express the rules of a game. But I can't seem to find a reference to it anywhere.

As an example rules for tic tac toe might be:

Players-Turn: "Find a blank square"->"Put an X in it"->Oponent's turn

Oponents-Turn: "Find a blank square"->"Put an O in it"->Player's turn

So I think the ingredients for rules are: searching for patterns, determining if an object is of a particular type (which might be the same as the first ingredient), and replacing.

  • 1
    $\begingroup$ What about the prolog? Express the rules and moves using a logical expression. $\endgroup$ – OmG Nov 1 '19 at 22:00
  • $\begingroup$ @OmG I think that may be the language that the Stanford Generalised Game Playing program uses. Might be a good idea. The syntax does get a bit complicated beyond simple rules though. But it does seem similar to what I need like this tic-tac-toe game: swish.swi-prolog.org/p/Tic-Tac-Toe.swinb $\endgroup$ – zooby Nov 2 '19 at 12:09
  • $\begingroup$ Actually just seen a variant called ProbLog which uses probabilities as well. $\endgroup$ – zooby Nov 2 '19 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.