Problem
Some moves depends on the history of the game such as
- the
castling requires the king and the switching rock to not have moved the entire game.
- the
en passant requires the move to be done right after the opponent pawn open up a 2 steps move.
Suggestion
Use an embedded DB such as M2 to keep track of all the moves in a game.