Morpion solitaire/Unicon

From Rosetta Code
Revision as of 21:37, 4 February 2012 by rosettacode>Dgamey (introduction)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Using random play in many summary runs, the highest score achieved was 90. While it was fairly easy to push random games into the low 80's running simulations of as little as a few hundred games, going beyond the highest score will require some very long runs and is unlikely to result in any significant progress.

The program is structured to allow its behaviour to be configured (see M_ vars) to do multi-game simulations and try out strategies. It was a first cut/test bed designed more to understand and explore the problem space rather than for high efficiency.

The grid is automatically expanded as needed whenever a cell is played on an outer edge. When this happens only the affected side is expanded. As a side effect the grid numbering will seem unusual. The game log shows all row/col coordinates relative to the 1,1 origin located at the intersection of the lines containing top and left most edges of the cross.

Extensions/features include:

  • Play single games or run multigame simulations to find and capture the best games
  • Read/write a game record and ability to replay a game to the end or to a specific move
  • Save a game
  • Use a plugable scoring/evaluation procedure at each move (for heuristics)
  • Limit initial random moves to 1 of 3 cases (inside/outside corner, outside valley) not 1 of 28

For more see: Morpion -h|-help

Observations:

  • The seeds of success are sown early, as random play from a truncated position in a known good game produces good results
  • Random play suggests that things are advance fairly quickly before a position gets choked. Many runs hit their mark in the first 5-10k. A few require more (e.g 50K).