Hacker News new | ask | show | jobs
by benhoyt 396 days ago
A program that will play chess (written in Go). My 18yo daughter can now beat me at chess (not that I'm any good). I figured if I can't beat her, I'll see if I can write a program to beat her instead. My idea for v1 is that I'd write the algorithm myself, without looking up anything about how to write a chess program (I'm sure such literature abounds). I've just about finished v1; still a few bugs to iron out. To be honest, I didn't find it all that fun, mainly because of all the special cases (all the castling rules and the like).
3 comments

I'm a big chess buff, and will say that the hard part is not making an engine (which is hard!), but making an engine that plays poorly, well. What I mean is: engines are very smart and better than the best human. When you make a "dumb" engine, you are telling a chess god to intentionally make mistakes. The mistakes they make, however, are not the same mistakes a beginner chess player would make. Today, beginners are discouraged from learning by playing against bots because of this; It simply doesn't serve you in human games.

Lichess has a "humanlike" bot[1] but I haven't played with it yet. I think this problem will haunt you, if you get past the whole "create a chess engine" problem :) I have tried and failed to do this in the past.

[1] https://lichess.org/@/maia1

Check out chessiverse (I’m not affiliated just found from YouTubers). They purport to be a collection of bots that play like humans with human-like mistakes matched to ELO levels. I like it so far - the main value for me (vs lichess/chess.com) is knowing that who’s on the other end isn’t constantly cheating.
I always assumed that chess engines are dumbed down by occasionally inserting random moves but now it occurred to me that a way to get more realistic mistakes might be feed them a distorted version of the game state.
I can't help but point out the irony of a chess program written in Go, as someone that enjoys playing Go [1] myself. Sorry to hear it wasn't that fun, hope you still got something out of it!

[1] https://en.wikipedia.org/wiki/Go_(game)

Yes, definitely still got/getting something out of it, thanks. And I'll probably get more out of it when I read up on "how to write a real chess program" for v2, and learn about all the things I didn't think about.
Same, always wanted to do this, especially without looking stuff up, which feels like cheating. I haven't yet figured out the recursive tree search thing.