Daniel Shawul wrote:Yes but that has two problems. One I have to generate moves for the opponent making the move generator two times slower and even more when there is a leaper.
If the chameleon jumps over the longleaper first, it will have many possiblilities to capture along the way. If that test is done for each landing square, it could be 5x slower f.i
Well, what I said applied to capture of regular chess pieces by Chameleon, not to capture of Ultima pieces. In fat all regular Chess piece types (that do replacement capture without side effects) could be considered one "piece family". Pieces that capture something by jumping over it would be another piece family, etc.
For each piece family you would have to do a different test to see if the Chameleon can capture it, which makes Ultima a hard game. But doing "Chamelon Chess" with FIDE + 2X on 10x8 already simplifies the Chameleon move generation a lot. You only have to do a 0x88 capture test for each piece. That is a lot less work than generating all moves of every piece. Chameleon moves to an empty square can never be captures, in such a game.
But if any members of other piece families are present, life is more complicated. Even moves to empty squares could have side effects. But fortunately, for many victim families the tests are simple. E.g. Withdrawer type will only be captured if there was a Withdrawer-stryle piece next to the Chameleon in the direction opposite of motion (and then only if the Chameleon moves in a direction that Withdrawer could move in). In that case all moves in that direction would share the same side effect, so you would have to do the test only once. Leaping capturers you just run into when generating moves along the ray. In Chess you would then count replacement cature a valid move when that happens, but here you would have to check if it is a Leaper-style victim, and if the square behind it is empty.
The most nasty are the Pincer and Coordinator-style captures. Those would indeed have to be tested for on every to-square. An alternative here might be 'retrograde' capture generation, starting from the victim. E.g. in the initial position of Ultima you have 8 Pincer Pawns, that each have 4 moves. That is already 32 Pincer moves, and the number rises when you break the closed rank of them, due to sideway moves. (Move 1 forward, and you get 9 extra...) It would be kind of expensive to test for all of these 32+ moves in 3 directions if something gets sandwiched. It could be cheaper to run through the opponent piece list (16 pieces), and check every piece for an opponent neighbor that could act as 'backer' for the sandwich (in 4 directions). Because usually there will be none, and that immediately rules out the piece can be captured this way. If there is a backer, and an empty square on the other side, you could try to generate all Picer moves to that empty square, from piece list Pincer section, 0x88 alignment test and ray scan. you could mark all squares where a Pincer would capture something (e.g. with a bit mask to indicate what it captures), and do normal generation of Pincer moves, testing the masks on the to-squares.