Yeah, I did the same (VanillaJS) a couple of years back, and started thinking about implementing a computer opponent, but it's really not clear what the evaluation function should be.
I have to say I'm a bit sceptical that this approach can work purely based on win/loss conditions - an attacker victory in particular can often take hundreds of moves in Tafl games.
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.