I really wish I could help you, but I don’t have my computer with me. One thought, though: Have you checked whether topLevel returnes 0 at empty sites? If so, you shouldn’t have to count friendly pieces in line of sight more than once.
Another thought: If forEach Piece doesn’t work that way, you could string together a bunch of «then»s (using (and)) conditional on a comparison between topLevel and friendly pieces in sight. Edit: You don’t need a long string of them, I guess. Maybe you could combine MovesThisTurn and moveAgain, like I did in Even.
Another thought: If forEach Piece doesn’t work that way, you could string together a bunch of «then»s (using (and)) conditional on a comparison between topLevel and friendly pieces in sight. Edit: You don’t need a long string of them, I guess. Maybe you could combine MovesThisTurn and moveAgain, like I did in Even.