📝Greg Strong wrote on Fri, Jan 5, 2018 08:59 PM UTC:
ChessV does this with a brute-force recursive algorithm. It calls a recursive function to "visit" the first square. This function marks that square as "found" and then proceeds to go through every movement capability that the piece has, finds the next square in that direction, and recursively calls itself to visit that square. When this finally finishes every square you have visited is part of the first "slice" or "meta-color". Are there any squares that weren't visited? If so, do this whole process again starting with the first square that wasn't visited. The results of this search will be the second slice. Continue as necessary until the entire board has been found. This should work for any board geometry. It's a little computationally expensive, but is only performed once when a new game is being created.
ChessV does this with a brute-force recursive algorithm. It calls a recursive function to "visit" the first square. This function marks that square as "found" and then proceeds to go through every movement capability that the piece has, finds the next square in that direction, and recursively calls itself to visit that square. When this finally finishes every square you have visited is part of the first "slice" or "meta-color". Are there any squares that weren't visited? If so, do this whole process again starting with the first square that wasn't visited. The results of this search will be the second slice. Continue as necessary until the entire board has been found. This should work for any board geometry. It's a little computationally expensive, but is only performed once when a new game is being created.