Not as a general rule. If you're playing as the attacker, you don't always want to take defender pieces even if they're "free" - they're more useful boxing their own king in.
Yea, it's not even a good strategy really. Just the only thing that I felt like I could code that would be a step up from just making a random legal move.