Re:Ask HN: What did you make during lockdown?
by fpgaminer on Sunday June 21, 2020 @03:22PM
(#23594599)
I'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).
It's in here, but not for the faint-hearted: 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.