3 ms·
How does it handle moves where pieces might accidentally hit each other like https://en.wikipedia.org/wiki/Castling https://en.wikipedia.org/wiki/Castling and k
by myroon5 6y ago
How does it handle moves where pieces might accidentally hit each other like https://en.wikipedia.org/wiki/Castling https://en.wikipedia.org/wiki/Castling and knight moves?
- danappelxx 6y agoCheck out the video in the post they linked. Moves the piece slightly out of the way. Honestly incredible!
- alextheparrot 6y agoIn the video you can see it slightly moving a piece in the way to let the knight through
- yasoob 6y agoThere is usually enough space between two chess pieces to easily fit a third one between them on these boards. So from my understanding the magnet just moves the third piece from between the two other pieces without hitting either of them.
- jstanley 6y agoI sized the squares on the board so that there would be enough room to slide a piece orthogonally between 2 other pieces, but was actually not able to make use of this property in the end. The problem I faced was that when I had magnets that were strong enough to be reliably grabbed by the electromagnet, they were strong enough to repel each other if they got too close! I went through quite a large selection of different magnet sizes before I settled on the final one (which is 6mm diameter, 6mm tall, neodymium cylinders). They're strong enough to be grabbed by the electromagnet, and weak enough that 2 pieces can be in the centre of a square and a corner of the square without moving apart, but unfortunately still not weak enough that a piece can slide in a straight line past another piece. When there is a piece in the way, it works out whether it would be shorter to move a piece out of the way, or to route the long way around, and picks whichever is shorter.
- jstanley 6y agoIt uses a ridiculous bastardisation of Dijkstra's algorithm to work out the shortest set of operations to get the piece from where it is to where it needs to be. This includes a way for it to notice that it would like to run into another piece, and then add to the search tree a copy of the current node, but with some operations inserted at the start to first move that piece out of the way. It's in here, but not for the faint-hearted: https://github.com/jes/autopatzer/blob/master/mojo/lib/Autopatzer/Router.pm https://github.com/jes/autopatzer/blob/master/mojo/lib/Autop... I did try giving it an accurate model of the acceleration curve of the stepper motors, so that it would do the set of moves that actually took the least time, but that led to strange motions where it would deliberately move pieces too far, and then back again at a diagonal, just to minimise the number of corners it needs to turn, so I instead just made it do a simple shortest-path, because it looks more natural to a human observer. I.e. instead of going 2 squares right, then 2 squares up, then 1 square diagonal up-left, it would prefer to go 4 squares right, then 3 squares diagonal up-left. It takes less time, but looks stupid.
- fpgaminer 6y agoI'm having a hard time not crying over how beautiful this is. There's something so ludicrously satisfying about bringing our professional computer science hammers to bear on silly hobby projects. I love it. It's like being a kid again, where everything is just imagination and fun, but we get to finally play with the big boy's toys (like Dijkstra's algorithm).