I just read your first post. You changed "author" names between posts, which confused me.
But now that I know the context... Your problem is related to word reduction in group theory, and it is a difficult problem. If you want to check out some software optimised for this use there is a package called "GAP", www.gap-system.org/
You might be best off assigning a "state" to the board after each move, consisting of the piece locations, or at least a hashing function of the positions. This is computationally expensive one single time and avoids multiple comparisons of lists. I.e. the computational work is done O(n) times, where n is the number of positions in your database, rather than O(n^2) comparisons. Linear beats quadratic for large enough n.