Live data from Hacker News

A step-by-step guide to building a simple chess AI

medium.com

1–10 of 44 posts

Re: A step-by-step guide to building a simple chess AI

#2
Interesting that it's deterministic. I can get it to play the same game again and again. Why is this not the case with more advanced chess engines?

Edit: Apparently single-threaded stockfish is deterministic. Maybe my experience with non-deterministic chess engines just has to do with the handicapping related to providing easier levels of play.

Re: A step-by-step guide to building a simple chess AI

#3
post #2

Interesting that it's deterministic. I can get it to play the same game again and again. Why is this not the case with more advanced chess engines? Edit: Apparently single-threaded stockfish is deterministic. Maybe my experience with non-deterministic chess engines just has to do with the handicapping related to providing easier levels of play.

[deleted]

Re: A step-by-step guide to building a simple chess AI

#4
post #2

Interesting that it's deterministic. I can get it to play the same game again and again. Why is this not the case with more advanced chess engines? Edit: Apparently single-threaded stockfish is deterministic. Maybe my experience with non-deterministic chess engines just has to do with the handicapping related to providing easier levels of play.

When you say that it is deterministic, do you win or do you lose the game?

If you always win with the same game, then instead of AI, we are rather talking about AS (Artificial Stupidity).

Re: A step-by-step guide to building a simple chess AI

#5
post #2

Interesting that it's deterministic. I can get it to play the same game again and again. Why is this not the case with more advanced chess engines? Edit: Apparently single-threaded stockfish is deterministic. Maybe my experience with non-deterministic chess engines just has to do with the handicapping related to providing easier levels of play.

Never checked but somehow got me surprised: aren't all chess engines deterministic? The same program, given the same input, should give the same output unless it is specifically programed to try to avoid it (and then we have PRNGs).

Re: A step-by-step guide to building a simple chess AI

#7
post #2

Interesting that it's deterministic. I can get it to play the same game again and again. Why is this not the case with more advanced chess engines? Edit: Apparently single-threaded stockfish is deterministic. Maybe my experience with non-deterministic chess engines just has to do with the handicapping related to providing easier levels of play.

Never checked but somehow got me surprised: aren't all chess engines deterministic? The same program, given the same input, should give the same output unless it is specifically programed to try to avoid it (and then we have PRNGs).

A reply that was deleted mentioned that some engines use Monte Carlo simulations which are non-deterministic (?).

My experience with chess engines being non-deterministic is that if I pick the same opening I don't always play the same game with the same engine. I really might just be off here, and that variance might be related to random artificial handicapping.

Re: A step-by-step guide to building a simple chess AI

#8
> I'm having trouble beating a chess program I wrote. Not sure if I'm a bad player or the algorithm is decent

Most beginners will lose to even a chess engine that only looks one step ahead, as it will not drop pieces in obvious ways, but the beginner will.

Chess.js etc. is great btw. Last time I made some chess ai, most of the time was spent generating possible moves. En passant, promotion and stuff adds complexity.

Re: A step-by-step guide to building a simple chess AI

#9
Love this article. I went through a lot of these same steps when I was tinkering with my own chess bot. Bitboard representation with bitshifting operations can dramatically speed everything up (see here https://chessprogramming.wikispaces.com/Bitboards). Another easy step is to integrate an opening book. The "Encyclopaedia of Chess Openings" provide a great set. Here is link to CSV of the openings for easy parsing: https://github.com/notnil/opening/blob/master/csv/openings_a...

Plug: Any gophers out there looking to build their own bot can use my chess engine https://github.com/notnil/chess

Edit: wording

Re: A step-by-step guide to building a simple chess AI

#10
post #2

Interesting that it's deterministic. I can get it to play the same game again and again. Why is this not the case with more advanced chess engines? Edit: Apparently single-threaded stockfish is deterministic. Maybe my experience with non-deterministic chess engines just has to do with the handicapping related to providing easier levels of play.

Never checked but somehow got me surprised: aren't all chess engines deterministic? The same program, given the same input, should give the same output unless it is specifically programed to try to avoid it (and then we have PRNGs).

Some things that make chess engines non-deterministic: 1) Most chess engines use an opening book instead of calculating moves early in the game. These books are often programmed probabilistically, so it may have 4 reasonable responses to a given move and pick one randomly. 2) Many engines are programmed to "ponder", that is do optimistic calculations during the opponents turn. This means that the time taken by you to make the move could potentially affect the calculations performed by the engine.
Post reply on HN