/// only legal moves. It returns the number of generated moves. This
/// function is very ugly, and needs cleaning up some time later. FIXME
/// only legal moves. It returns the number of generated moves. This
/// function is very ugly, and needs cleaning up some time later. FIXME
// Generate pseudo-legal moves
int n = generate_captures(pos, mlist);
n += generate_noncaptures(pos, mlist + n);
// Generate pseudo-legal moves
int n = generate_captures(pos, mlist);
n += generate_noncaptures(pos, mlist + n);
// Remove illegal moves from the list
for (int i = 0; i < n; i++)
if (!pos.pl_move_is_legal(mlist[i].move, pinned))
// Remove illegal moves from the list
for (int i = 0; i < n; i++)
if (!pos.pl_move_is_legal(mlist[i].move, pinned))