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.