public static MoveList GenerateMoves(this IPosition pos, Emgf flags = Emgf.Legalmoves, bool useCache = true, bool force = false) { pos.State.Pinned = flags.HasFlagFast(Emgf.Legalmoves) ? pos.GetPinnedPieces(pos.GetPieceSquare(EPieceType.King, pos.State.SideToMove), pos.State.SideToMove) : BitBoards.EmptyBitBoard; var moves = new MoveList(); pos.GenerateCapturesAndPromotions(moves, flags); pos.GenerateQuietMoves(moves, flags); return(moves); }