Symmetry for 8x8 board games

Discussion of chess software programming and technical issues.

Moderator: Ras

syzygy
Posts: 5673
Joined: Tue Feb 28, 2012 11:56 pm

Re: Symmetry for 8x8 board games

Post by syzygy »

chrisw wrote: Sun Feb 16, 2025 2:00 pm Just for fun, and here's the naively unexpected bit, I added all reflections and rotations of these unique nodes. Count becomes 111887496, 8x more unsurprisingly. Then did the unique function on all these nodes, and unique count = 27778086, or about 2x the uniques from PERFT.

Why 2x? Well, not 8x because we already have the full possible legal move set in the original uniques, suggesting the reflections/rotations unique result should be 1x. So, why 2x? And why not exactly 2x?
2x because reflecting and rotating the opening position P results in only one other position P'.
Less than 2x because some of the positions reached in 10 ply from P can also be reached in 10 ply from P'.
syzygy
Posts: 5673
Joined: Tue Feb 28, 2012 11:56 pm

Re: Symmetry for 8x8 board games

Post by syzygy »

chrisw wrote: Mon Feb 17, 2025 10:23 pm
abulmo2 wrote: Mon Feb 17, 2025 5:20 pm
chrisw wrote: Mon Feb 17, 2025 12:41 pm Did you manage to find a way to include symmetries to reduce the tree size?
In Edax's opening book, I include all symmetries to reduce the size of the opening book. During the search, only the color inversion is taken into account at no price, as the structure to store the position is color blind. As you noticed the symmetries reduce a lot the tree size at the start of the game, but once a move is played it is more unlikely to get symmetrical positions during the search.
For game play that figures, but if one wants an opening book that would give largest possible test games by autoplay (tuning or NN development), isn’t it best to have the full book with all symmetrical positions included to give widest coverage?
The player who starts has only 1 move, but he can make it in 4 ways. If you "fix" that first half move by suitably rotating/reflecting the board, you probably solve most of the problem.
chrisw
Posts: 4624
Joined: Tue Apr 03, 2012 4:28 pm
Location: Midi-Pyrénées
Full name: Christopher Whittington

Re: Symmetry for 8x8 board games

Post by chrisw »

syzygy wrote: Wed Feb 26, 2025 10:24 pm
chrisw wrote: Mon Feb 17, 2025 10:23 pm
abulmo2 wrote: Mon Feb 17, 2025 5:20 pm
chrisw wrote: Mon Feb 17, 2025 12:41 pm Did you manage to find a way to include symmetries to reduce the tree size?
In Edax's opening book, I include all symmetries to reduce the size of the opening book. During the search, only the color inversion is taken into account at no price, as the structure to store the position is color blind. As you noticed the symmetries reduce a lot the tree size at the start of the game, but once a move is played it is more unlikely to get symmetrical positions during the search.
For game play that figures, but if one wants an opening book that would give largest possible test games by autoplay (tuning or NN development), isn’t it best to have the full book with all symmetrical positions included to give widest coverage?
The player who starts has only 1 move, but he can make it in 4 ways. If you "fix" that first half move by suitably rotating/reflecting the board, you probably solve most of the problem.
For practical purposes, I was trying to get all possible opening positions, N deep, to create an opening book that then gave a sense best of all possible game positions, including reflections/rotations. Because intending to use a fully connected NN to evaluate and because it’s unlikely such an NN would recognise the reflections/rotations all by itself. Maybe a RESNET would.