Also the game only has a resolution of 640x640 pixels, and you cant move the mouse a half pixel. But anyways, stalemate basically requires very precise positioning by the attacker, so it is VERY unlikely to actually happen, especially since they are trying to avoid stalemate.
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.
You 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.
They have a diameter of 0.7 squares but that can be changed in the code. As it is they are just below sqrt(2)/2 so that the bishops can escape diagonally.
I think the number of moves approaches infinity as the diameter approaches sqrt(2)/2, as the current diameter is 0.7 squares so that rooks can escape diagonally. Could be interesting to look into.
Yeah I just forgot the word continuous and never changed the name lol. But my thought process is that an analog clock moves smoothly instead of being restricted to minutes, and analog circuits are continuous.
I didn't have it originally, but because of how much more complex the movement in this game is, it was almost impossible to avoid blundering everything.
Adding the knook would be pretty simple actually. I'd just need to combine the code for the rook and the knight and then make a function to snap the mouse position to the right closest point on the crosshair shape.