Chess and an idea I had last week on Friday

K.I.L.E.R

Retarded moron
Veteran
I'm going to share it with you guys.

A user clicks on a piece on the chess board (x, y).
The user proceeds to click on a tile (dx, dy).
A vector is created from those 2 points.

A Vectors come out of the piece (0, directionY).

Then find the angle between them.

You see the angle?
It's unique for every chess piece but it works for every chess piece's legal moves.

You know what this means?
I should be shot, because I just re-invented the wheel properly. :)
 
Here's an example.
I love B3D's new attachment system. :)
 

Attachments

  • chessExample.JPG
    chessExample.JPG
    31.4 KB · Views: 32
"
Your 45 degrees one is way off, it's more like 30 or less."

I did say they were estimates.
Point remains the same though. :)
 
No one before me has come up with this idea so if anyone decides to use this method to detect valid moves within chess or any other game I know where they got the idea from. :D
 
K.I.L.E.R said:
No one before me has come up with this idea so if anyone decides to use this method to detect valid moves within chess or any other game I know where they got the idea from. :D
and how do you know that noone has come up with this idea before?

To be honest I can't see any value in it. You still have to cope with various distances, and if the piece has special abilities. (i.e. castling, or jumping pieces). You would be better off with some seperate code for each piece type that takes into account all the properties of that piece.

CC
 
and how do you know that noone has come up with this idea before?

I've never seen it be used before in any of the code in chess games I've seen.
I figured if I couldn't find this method on the Internet then it's pretty much mine.
 
K.I.L.E.R said:
I've never seen it be used before in any of the code in chess games I've seen.
I figured if I couldn't find this method on the Internet then it's pretty much mine.
Ah, but did do a Patent search!? :-0

I beleive that you have to be careful when doing searches for things like that. If you do a patent search and you end up breaching someones patent, then you are liable for something like 3 times the damages, than if you hadn't done a patent search.

CC
 
This method is inefficient and flawed. Flawed because by only checking angle, for instance the knight would be allowed to walk (+4, +2), which normally isn't allowed. Nor does it take into account whether there are any pieces blocking the moves. At most it could be used as an early-out method for invalid moves. Inefficient because computing the angle is a lot slower than checking differences in X and Y.
 
Back
Top