That is a correct description.elcabesa wrote:if I understood correctly:
staged generator:
generate moves of stage N and put them in a list.
order & iterate the moves
go to stage n+1
your generator
fast generate all the moves and store thme in bitboard
get the move of a stage from bitboard
order & iterate them
go to stage n+1
so you don't do the serialization of the moves in case you don't need them
I don't think it will be faster of a staged move gen.
I don't think it will be easier than a stage move enerator if you serialize the move you need before ordering them
but it's an interesting try.
I solved the difficult of writing a staged movegen writing a full move list generator and then transforming it in a staged one simply using function TEMPLATE.
you can look at the code of you.
It can potentially be faster than staged gen if the move generator do some free ordering (promotions before captures before non-captures, etc), but I am not convinced it will actually make a significant difference. The aim is simplicity, and still be as fast as a staged generator.
One thing that is easier with this approach is taking out hash moves, killers, and history moves.
With a staged generator, those moves must be carefully excluded from the remaining moves if they don't fail high. Searching those nodes twice probably won't really have a performance impact since they would still be in TT, but it makes things like LMR more complicated.
With my approach, we can just look for those moves in the list, and if we find them, we know the move is pseudo-valid, and we can turn off the appropriate bit for the piece then.
This way there would still be stages, but the stages are fewer. Hash move, killers, and histories no longer need their own stages, since all moves are "generated" in the beginning. They can just be taken out of the stages they would otherwise be in.
The search also doesn't need a separate promotions stage, because it can be implicit in the ordering of moves generated.
In the boring moves stage (which isn't usually sorted), if a move fails high, rest of the moves in that stage don't need to be serialized. This is where it can potentially perform better than staged generation, but I'm guessing this doesn't happen all that often.
The only "stage" that really requires extracting all moves and sorting is the captures stage (and in this stage it's as fast as a staged generator). Every other stage can be extracted 1 move at a time.