4 ms·
The problem is that it needs to check every position that the king can move to as well. Doing it based on pixels would be extremely slow, and doing it based on
by ehulinsky 4y ago
The problem is that it needs to check every position that the king can move to as well. Doing it based on pixels would be extremely slow, and doing it based on the math seems like a nightmare, unless I am missing something.
- kortex 4y agoYou would not do it by pixels, it's pure math. I'd have to sit down and work through the actual math, but between convolution and affine transformations, I'm pretty sure there should be a way to compute the intersection with a formula for each piece type. Knight is the easiest, that's just checking (lol) the distance to see if 5-r/2 <= d < 5+r/2.