Live data from Hacker News

How to build a chess engine

chessengines.org

31–40 of 58 posts

Re: How to build a chess engine

#32

What is the most compact representation for a complete chess game state? Can it be as low as 64 bits?

This is pretty tremendous: https://codegolf.stackexchange.com/questions/19397/smallest-...

Chess computing is one area where there’s a lot of attention to hard details as well as the algorithms, lots of gems like this in the genre

Re: How to build a chess engine

#35
One day I'd like to write a rubbish Chess Engine purely for personal use, so that I can play chess against the computer and actually have a good probability of winning, instead of getting thrashed even on the 'easy' setting.

The way my brain works, the act of writing the engine would probably also level up my chess playing skills as a side benefit.

Re: How to build a chess engine

#36
I think chess engines are an amazing thing to study. So much fundamental computer science is covered, from extremely low level CPU instructions to high level data structures and algorithms. There's no surprise to me that many of the greats have turned their eye to representing and solving chess, from Turing to Knuth. I strongly suspect you could teach an entire CS degree never stepping outside of chess.

Even now there are so many rich directions you could go in. For example, many people are working on explainability in machine learning, but I think in many applications you want to go even further and actually optimise a model to _teach humans_ not just explain its predictions. This is especially relevant to engines when making strategic moves rather than calculating short term tactics.

I also think engines as tools for match preparation could be much better. What if you could more easily set an engine to find forced draws in certain lines, or tailor an engine to find tricky lines that a particular opponent is less likely to follow correctly, or find and optimise for certain endgame structures an opponent is weak at? Doing this in ChessBase (a truly awful but necessary piece of software) is quite painful.

Re: How to build a chess engine

#37

Earlier quoted context omitted.

I see what you're getting at but for whatever reason "chess engine" in fact usually refers to what you're calling the AI player -- https://en.m.wikipedia.org/wiki/Chess_engine

Exactly, that's why I noted "Unless in the Chess industry ...", the details of which I don't know. I only know a bit about general game making (I've tried Godot and GameMaker, some friends make games and we talk) so this was my opinion from a more general game point of view. But still, from that Wikipedia description "a chess engine is a computer program that analyzes chess or chess variant positions, and generates a…

Chess Engine - is a well established term in the field. Position estimation and move generation is the hardest and most important aspect of a chess engine. In this sense chess.js may do many useful things, except the thing that would make it an "engine".

> Maybe "How to build a Chess Automaton/AI Player" would be a better title? Unless in the Chess industry the "chess engine" refers to the machine player, which I do not know.

I find this somewhat presumptuous. You wouldn't go to a different country and warn others that a particular word should mean something different based on your own (foreign language) experience, and propose a different word, with the caveat: "Unless in your country you do things differently".

If you think that your experience is common enough that a warning to fellow game-developers is warranted, do some research, find out that "Chess Engine" is a term that is contextually synonymous to "AI Player" and then inform others.

Re: How to build a chess engine

#38
Chess programming is fascinating but it seems for me that it has somewhat stalled in creativity in terms of classical (non DNN) engines. They all seem to use improved versions of min-max/alpha-beta. Which results in computer players that are extremely powerful but also quite dull. This is because they assume that the opponent will play perfect game and will do it at the full strength of the engine.

Basically there is no point playing against the engines at full strength as a human, since it will beat almost any human beyond grandmaster level. And that’s for weaker engines – the medium tier ones will regularly beat grandmasters and the top ones around the stockfish tier will probably not loose 1 game in 100 plays.

That considered I’ve wondered what’s possible dropping the assumptions about perfect play of the opponent. Some probabilistic models of opponent or different way of rating whole tree of moves in the context, instead of position only. For example considering the alternative moves and how difficult it would be to play perfect game for the opponent, it might be better to play combination with a lot of traps with possibility of loosing some position if the opponent plays perfectly. Current engines wouldn’t play such kind of move because they’d assume (via min-max/alpha-beta) that opponent will have perfect answer. Of course, if the opponent is an engine it will, but against humans it would make things much more interesting.

Re: How to build a chess engine

#39
post #38

Chess programming is fascinating but it seems for me that it has somewhat stalled in creativity in terms of classical (non DNN) engines. They all seem to use improved versions of min-max/alpha-beta. Which results in computer players that are extremely powerful but also quite dull. This is because they assume that the opponent will play perfect game and will do it at the full strength of the engine. Basically there is…

https://boristrapsky.com (https://lichess.org/@/Boris-Trapsky) plays against a typical, rather than perfect-playing, opponent but I could not find any source code.

Re: How to build a chess engine

#40
post #38

Chess programming is fascinating but it seems for me that it has somewhat stalled in creativity in terms of classical (non DNN) engines. They all seem to use improved versions of min-max/alpha-beta. Which results in computer players that are extremely powerful but also quite dull. This is because they assume that the opponent will play perfect game and will do it at the full strength of the engine. Basically there is…

You might find https://www.youtube.com/watch?v=DpXy041BIlA interesting. He creates a tournament of "imperfect" engines.
Post reply on HN