Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. COI don't think that would work because my search function is recursive and probably wouldn't be able to undo the move if I keep swapping the pieces around. The move object use the index to make/unmake moves. You're just adding more overhead.
      singulars
    2. COThis is a very good approach to the question as asked: more generally, when comparing objects (such as board positions) where there's more than one valid representation for the same object (due to transpositions etc), a powerful strategy is to try to find a "canonical" representaton - i.e. for each different board position that may have many representations, pick one as the "right" one, and then when comparing two positions (or beforehand), transform them into this "right" ("canonical") representation - that way, if they don't compare equal, you can be certain they're different positions.
      singulars
    3. COBTW the recursion shouldn't be an issue (just have a function that moves a piece and updates the representation, then call it once on the way in to move a piece, and again on the way out to move it back). And in the vast majority of cases the updating is trivial - at most swap two entries - so the "hard" cases should be rare enough to make it a win overall. But if you're prepared to change your board representation, then Amoss's solution is better, and Mathieu Pagé explains how to use hashing to make it even more efficient...
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload