How to Generate an Algorithm to Solve Peg Solitaire

algorithmsmachine learning

I know that with regression it is possible to generate a mathematical function based on experimental data. I was wondering, maybe there is a way to generate something more complex. I have a single player logical game which is hard to solve:

There are 37 glass globes in holes:

    |o|o|o|
  |o|o|o|o|o|
|o|o|o|o|o|o|o|
|o|o|o|o|o|o|o|
|o|o|o|o|o|o|o|
  |o|o|o|o|o|
    |o|o|o|

You have to remove one globe at the beginning (I started with the middle one):

    |o|o|o|
  |o|o|o|o|o|
|o|o|o|o|o|o|o|
|o|o|o| |a|b|o|
|o|o|o|o|o|c|o|
  |o|o|o|o|d|
    |o|o|o|

After that you can step over a single globe in horizonatal or vertical direction (I stepped here with "b" over "a", so I removed "a" from the playground):

    |o|o|o|
  |o|o|o|o|o|
|o|o|o|o|o|o|o|
|o|o|o|b| | |o|
|o|o|o|o|o|c|o|
  |o|o|o|o|d|
    |o|o|o|

Now I stepped again (with "d" over "c"):

    |o|o|o|
  |o|o|o|o|o|
|o|o|o|o|o|o|o|
|o|o|o|b| |d|o|
|o|o|o|o|o| |o|
  |o|o|o|o| |
    |o|o|o|

The aim of the game that only a single globe should remain. Now that is extremely hard to achieve, I have less than 1% success rate and I don't have the winning strategy.

Is it possible to generate an algorithm, which can solve the problem by many different scenarios (so which has a strategy)?

I was thinking on genetic algorithms or neural networks, so something which can learn the basics from me and after that develop itself by gaming more, but I have no experience with these methods, so I don't know where to start, and which one would work. I am aware that it is possible to solve the problem manually, but from that I would not learn anything about artificial learning…

Best Answer

It's possible that heuristics exist which improve your success rate, and if they exist, it's possible that you can program something that will find them.

But for a game this small you're almost certainly better off programming a complete search and looking at the solutions that pop up. Then, when you compare what works and what doesn't, your human brain will start to do its thing and pattern-match until you have a better idea of which features of a strategy are relevant to success and which aren't.