Skip to main content
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-...
Ellie's user avatar
  • 12k
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.
odinchess.com's user avatar
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 ...
jwenting's user avatar
  • 451
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 ...
A. Rex's user avatar
  • 790
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 ...
Mobeus Zoom's user avatar
  • 2,289
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 ...
B.Swan's user avatar
  • 3,498
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 ...
qwr's user avatar
  • 4,031
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 ...
Allure's user avatar
  • 28.3k
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 ...
JonathanReez's user avatar
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 ...
SmallChess's user avatar
  • 22.6k
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 ...
Glorfindel's user avatar
  • 25k
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 ...
Chromatix's user avatar
  • 1,689
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. ...
SmallChess's user avatar
  • 22.6k
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 ...
Glorfindel's user avatar
  • 25k
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. ...
Sleafar's user avatar
  • 1,184
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 (...
Falquiero's user avatar
  • 401
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 ...
user21820's user avatar
  • 2,835
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 ...
user1583209's user avatar
  • 20.9k
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....
itub's user avatar
  • 10.6k
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 ...
Remellion's user avatar
  • 5,040
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. ...
NoseKnowsAll's user avatar
  • 5,838
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 ...
bof's user avatar
  • 4,117
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 ...
Artelius's user avatar
  • 296
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 ...
Peter Cordes's user avatar
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 ...
Hauke Reddmann's user avatar
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 ...
ScottishTapWater's user avatar
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 ...
Ellie's user avatar
  • 12k
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 ...
Eugene's user avatar
  • 229
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 ...
Maxwell86's user avatar
  • 5,546
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 ...
me''s user avatar
  • 315

Only top scored, non community-wiki answers of a minimum length are eligible