42
votes
Accepted
What is the worst opening move in Chess960 for White?
This calls for some scripting, so here's my first hasty attempt at it ;)
Here's a quick way you can do the search on your own in python, using stockfish 10 and only the python-chess package. All open-...
37
votes
Why don’t chess engines use Node.js?
Here is a link comparing C++ to Node.js from this question on Stack Overflow.
To answer your question: C++, while more difficult to write, is way faster than basically anything else.
35
votes
Why don’t chess engines use Node.js?
Node.js isn't a language; it's a framework on top of JavaScript.
It's also not fast, certainly not compared to compiled languages like C++ or Java.
Nor is JavaScript easier to use than compiled ...
32
votes
Accepted
Given a legal chess position, is there an algorithm that generates a series of moves that lead to it?
The task you are considered is usually called a proof game, named such because the task is to prove that the position is legal. As a genre of puzzles, there are various aesthetic constraints, most ...
32
votes
Accepted
What if both players always play the worst engine move?
You may find this game interesting: https://lichess.org/A9ZRnDcE.
Here Stockfish (black) is programmed to select the move leading to the most negative eval position. White is a human who is aiming to ...
31
votes
Accepted
What prevents chess engines from being undetectable?
Engines have no concept of natural moves and they have no fear. An engine will play for the most advantage, not for the most manageable advantage, even if it allows a fierce attack, because it sees ...
27
votes
Why don’t chess engines use Node.js?
To add onto the comments: Node.js and Python are higher-level languages/frameworks, used as "glue languages" for machine learning frameworks that just serve as human-friendly wrappers to ...
26
votes
Creating chess engine, machine learning vs. traditional engine?
If you're trying to make the strongest engine possible, absolutely go for NN engines.
Traditional engines are great - Stockfish is arguably still the strongest engine on the planet on consensus equal ...
25
votes
Accepted
How does Stockfish know if the king is in check?
If you're curious about the Stockfish code, it can be found here:
si->checkersBB = attackers_to(square<KING>(sideToMove)) & pieces(~sideToMove);
We call the attackers_to method to ...
23
votes
Accepted
Do chess programmes keep a history of the full board for each move?
You are doing a chess GUI, not a chess engine right?
Chess GUI doesn't need to be super efficient, because you have no more than a chess game to look for. Even a game over 200 moves about the world ...
20
votes
Accepted
How do chess engines decide which best line to play when the game outcome is within their horizon?
If the engine can choose between getting mated in 2 or mated in 3, it'll choose the line where it is mated in 3 (even though the mate in 2 might be 'more difficult' to spot for humans).
It can't ...
19
votes
What is the worst opening move in Chess960 for White?
Using @Phonon's Python script, I was able to determine that the worst move is 1. g4?? from the BBQRNNKR starting configuration, or 1. b4?? from its mirror image.
This evaluates to -2.5 in one second ...
18
votes
How does Stockfish know if the king is in check?
Where and how in Stockfish's code is check detected?
This is simple engine programming. You will need to build a bitboard of the attacking squares and two bitboards of your king, one for each color. ...
16
votes
Accepted
Alternative approaches to chess engine programming
In the beginning years of computer chess, people have actually tried to teach computers chess in the same way as they do with humans, explaining strategic concepts like a healthy pawn structure or the ...
16
votes
What prevents chess engines from being undetectable?
One very obvious indication for people using engines is, that they need roughly the same time for every move (usually about 5s in blitz games), even for the most obvious ones, which could be premoved. ...
15
votes
How does Stockfish know if the king is in check?
Your question has nothing to do with Stockfish. Though it may be interesting to check the original source code.
This is purely algorithmic.
One dumb solution would be implementing a boolean function (...
15
votes
How would the min max algorithm of a chess engine work in the case of 3 player chess?
The problem is really not in chess, but in any naive 3-player version of any 2-player strategy game. In general, it is hard to make an interesting 3-player game where each player's performance is ...
14
votes
Accepted
Programming three-fold repetition for my chess engine
Threefold-repetition is about a position (not moves) occurring three times. Those positions do not have to be reached by the same moves.
Also (as this also seems to be confused sometimes) it is ...
14
votes
Accepted
How do chess engines evaluate a position if the position is in the middle of an exchange?
A good chess engine won't stop after a predetermined number of moves, but will keep looking until the position is "quiescent", which roughly speaking means that there are no pending captures or checks....
13
votes
Is the dead position problem solvable?
Computer detection of dead positions is much trickier than people think. It is unlikely that an algorithm exists that runs in reasonable time and is 100% accurate.
It is easy to check for a simple ...
13
votes
Is it normal for a chess engine to blunder material if its evaluation is only based on naive material evaluation?
This exact bot has already been created. On lichess, it is simpleEval. You could potentially use it to debug a lot of your issues by seeing what this engine does against you in a given position.
...
12
votes
Accepted
Checkless Chess
Your "checkless" chess AI would run into problems with the stalemate rule. It would consider the poaition with white king on a6, white pawn a7, black king a8, a win for White because wherever Black ...
12
votes
Accepted
Creating chess engine, machine learning vs. traditional engine?
First step: Define your goals/reasons
I think this is the predominant factor. Which of these best fits you? (Choose only one)
You want to enjoy a fun, challenging coding task
You want to create an ...
12
votes
What prevents chess engines from being undetectable?
Some of those things are possible in theory. Especially if you have a good idea what an engine-detector is looking for, you could maybe do some machine-learning training of algorithm against ...
12
votes
Which methods can be used to prove that a position is illegal?
Easy illegality is easy: not exactly 1 king on both sides, both kings in check, pawns on the final ranks. It's also fairly easy to tally promoted material and subtract the missing pawns. A quick ...
12
votes
Accepted
Why don’t chess engines use Node.js?
This is more of a question for Stack Overflow if you ask me... But since I've come here from there and I'm a software engineer and avid chess player, I'll try to explain.
This basically boils down to ...
11
votes
Accepted
Stockfish evaluation of a position from PGN
Yes there are easy ways to do this. I'm going to briefly show you one quick way of doing it in python, using the python-chess module.
If the in-code comments are not enough, feel free to ask for ...
11
votes
Why don’t chess engines use Node.js?
Node.js is just a JavaScript (JS) runtime environment that is basically just Chrome's V8 JS engine, with the APIs (set of standardized commands for interacting with something) only needed for a ...
10
votes
Accepted
How did the engines improve since Deep Blue?
Maybe you can take a look at TalkChess, a forum dedicated to computer chess. I found a recent thread that might be interesting for you: Progress in 30 years by four intervals of 7-8 years
A couple of ...
10
votes
Creating chess engine, machine learning vs. traditional engine?
So, in terms of creating the strongest chess engine possible, should I go neural network or hard-coded?
Don't choose a NN unless you have access to ridiculous(A few hundred Nvidia V100s). Training a ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
programming × 296engines × 180
software × 62
stockfish × 39
computer-chess × 24
evaluation × 23
python × 21
analysis × 20
uci × 20
pgn × 17
bitboard × 17
database × 14
opening × 10
statistics × 10
chess-algorithms × 10
chess-variants × 9
fen × 8
minimax × 8
notation × 7
mathematics × 7
performance × 7
elo × 6
checkmate × 5
learning × 4
endgame × 4