Hacker News new | ask | show | jobs
by dumbo-octopus 714 days ago
While we're on the topic of ancient link-based sharing websites, here's a pastebin of the Typescript code I wrote years ago that I just dug up to see if it'd handle this case. It does! It uses an actually-pretty-fast backtracking implementation to check for valid moves - validating Backgammon moves is a harder problem than you'd think, especially doing so quickly enough to effectively run monte tree search with. Even with all the thought I've put into it, I still don't have a quick explanation I can give a human trying to learn that game what the valid moves are, especially in the endgame and with blocked moves.

https://pastebin.com/QeSdnQpM

And the test cases I have for it: https://pastebin.com/vmMEjSMz