Questions tagged [programming]

Questions related to all aspects of writing software related to chess.

Filter by
Sorted by
Tagged with
25
votes
4answers
9k views

What is the worst opening move in Chess960 for White?

Is there a first move for white in Chess960 in which white can immediately blunder a piece or lose a significant advantage (say -2.0 or so)?
22
votes
4answers
10k views

Creating chess engine, machine learning vs. traditional engine?

I am both an avid chess player and computer programmer. I would say that playing chess and programming are the two things I spend the most time doing. Naturally, I am wanting to create my own engine ...
20
votes
5answers
9k views

What prevents chess engines from being undetectable?

I see accounts of people getting banned from sites like chess.com for using engines like Stockfish and Komodo (I admit I have used these engines before, but never in an actual match). Now, I believe ...
19
votes
3answers
6k views

Given a legal chess position, is there an algorithm that generates a series of moves that lead to it?

Given a FEN board position, is there an alhorthim that can return a PGN move list that evaluates to it from the initial position?
18
votes
1answer
3k views

What if both players always play the worst engine move?

There are questions for the worst opening in chess and the worst opening in Chess960, but these only consider the very first move. I'm curious what a game would look like where white plays the worst ...
18
votes
5answers
2k views

How did the engines improve since Deep Blue?

Computer chess engines have gotten better since Deep Blue beat Kasparov in 1997. Did the algorithms get better, or were the improvements mostly due to the same algorithms running faster thanks to ...
16
votes
3answers
2k views

Open source chess playing or pgn viewing libraries

Is anyone familiar with any open source chess libraries in any language that can do any of the following: parse PGNs and/or FENs calculate valid chess moves based on position process an entire chess ...
14
votes
2answers
3k views

How do chess engines decide which best line to play when the game outcome is within their horizon?

Inspired by the Hot Network Question "In this puzzle, why does white play dxe5?", when a chess engine is in a position that it can definitively call lost, drawn, or won, what policy is used to decide ...
14
votes
2answers
4k views

Which methods can be used to prove that a position is illegal?

Given a board position, there are programs that try to find a series of legal moves that lead to it. Are there algorithms that can do the opposite - prove that the position is not reachable by a ...
14
votes
3answers
2k views

Alternative approaches to chess engine programming

As far as I understand, roughly speaking, chess engines work by: calculating all possible variations (game tree) up to some depth evaluating the final position based on some criteria (material, piece ...
14
votes
3answers
3k views

How can I know the Elo rating of my chess engine?

I built an uci compatible chess engine, and I would like to know its Elo rating. What is the easiest way to get it? I would like something that works both on Linux and Windows.
14
votes
1answer
388 views

What features can I add to this FIDE chess application? (edits made 2/25)

EDIT: Most of the app is completed. Now all I have to complete is implementation of FIDE arbiters, a dynamic 3d plot (right now it only has 3 variables being plotted, no inputs affect it), adding more ...
13
votes
6answers
23k views

Chess engine with API

I am looking for a chess engine which provides a normal API which I can use with some high level programming language like C# or python. I went through the list of leaders (Houdini, Komodo, Stockfish ...
13
votes
1answer
5k views

Stockfish evaluation of a position from PGN

I am trying to get Stockfish's evaluation of a board position(which is in PGN format) using command line.I know it accepts board position in FEN format, but is there any way i can provide PGN format? ...
13
votes
1answer
5k views

How to convert PGN moves to long algebraic notation (in python)?

I want to read a PGN file and then advance to a certain move number, and feed that to an UCI engine. Turns out engines work using long algebraic notation, and PGNs are in short algebraic. What is an ...
12
votes
11answers
7k views

Do chess programmes keep a history of the full board for each move?

I am creating a chess GUI for UCI engine as a hobby. I keep the history of moved positions (e.g., (4,6) -> (4,4) for the pawn in front of the white king moving forward 2 squares) and the type of ...
10
votes
5answers
2k views

Is the dead position problem solvable?

In chess, there are some dead positions (FIDE Laws of Chess). 5.2.2 The game is drawn when a position has arisen in which neither player can checkmate the opponent’s king with any series of legal ...
10
votes
3answers
2k views

Is there a USCF API?

A while ago there was a site made by NM Jonathan Hilton's father that did some analytics on player's USCF rating histories. I thought it was a pretty good site, but it disappeared. There are still ...
9
votes
4answers
2k views

Website or program that creates puzzles from blunders in your past games

I'm looking for a website or program that would look at your past games on Lichess or chess.com and find moves that you played that were blunders and create puzzles around those
9
votes
1answer
2k views

Find magic numbers for bitboards

I am writing a C++ chess engine and I am looking for magic numbers for Little-Endian Rank-File Mapping bitboards to generate moves for sliding pieces. The rival chess website gives magic numbers but ...
9
votes
3answers
4k views

Which interface protocol should I implement for my chess engine?

I am writing a chess engine in C++ https://github.com/RomainGoussault/Deepov. I know there are several interface protocols out there (UCI, Winboard protocol, etc) and I don't know which to implement. ...
9
votes
2answers
2k views

Where can I find databases of tactical problems, categorized and ranked by difficulty?

I'm toying with the idea of building a tactical training tool. For my idea to work, I need positions that are categorized by motif and difficulty. A lot of tools seem to have this, and I doubt they're ...
9
votes
3answers
1k views

Unit Testing a chess board representation

So this is a bit of outlier question. I am writing a chess library, essentially from scratch. You can find much of the code here, with the intention of using it for a GUI and/or an engine. (The game ...
8
votes
3answers
4k views

How does Stockfish know if the king is in check?

I am writing a chess engine. I need to know how to tell if the king is in check. I was thinking that maybe I can use the approach that Stockfish uses. Where and how in Stockfish's code is check ...
8
votes
2answers
2k views

Is it normal for a chess engine to blunder material if its evaluation is only based on naive material evaluation?

For the past couple of weeks, I've been making a chess engine, and right now I'm working on creating its search and evaluation phases. To start off with, I made the evaluation phase a simple count of ...
8
votes
4answers
489 views

Checkless Chess

Is there any material difference between chess the way it is now versus doing away with check and checkmate and defining victory as simply capturing the opponent's King, assuming an available King ...
8
votes
2answers
864 views

How do chess engines evaluate a position if the position is in the middle of an exchange?

In the minimax algorithm, chess engines do a depth-first search as far as they can calculate ahead, and then evaluate all these final positions. Then, using these evaluations they work backwards one ...
8
votes
4answers
819 views

What is this battleship-style chess variant called?

So I've recently built and published a chess app, targeted at club chess player (like myself). The goal of the app is to educate and make chess more accessible. I'm working on an update. One of the ...
8
votes
2answers
3k views

How to create your own opening book for your own chess engine?

I am currently working on a chess engine in Java. I am using the minimax algorithm with alpha-beta pruning to select the best move. However, it is inefficient to use the algorithm for selecting ...
8
votes
1answer
311 views

Mathematical formula to get how broad opening repertoire is

programmers and mathematicians! I'm looking for some opinions how to build meaningfull formula that represents broadness of opponent's repertoire. At the moment I do it like this: I filter all ...
8
votes
4answers
6k views

What is the optimal way to use Stockfish programmatically?

I have Stockfish compiled on my machine. Instead of just running the Stockfish program in the terminal, is it possible to interact with it in a separate program? For example, some basic things I ...
8
votes
3answers
3k views
+100

Is there an online chess evaluation engine with a REST API?

Is there an online chess evaluation engine with a REST API? I'd like to be able to send a game or position (with castling ability presumably) to a simple REST API and get back the positional ...
7
votes
3answers
2k views

Is it possible to download a big txt file containing many openings?

I am creating a small chess engine for a CS class, nothing serious, i need to read the openings from a txt file or any format, i can go to websites like chessgames.com and download individual games, ...
7
votes
4answers
6k views

Javascript based Chess engine

In one of my previous questions I asked about comparison of the strongest chess engines and got a really good answer. While there are little or no doubts that chess engines are stronger than humans, I ...
7
votes
2answers
219 views

Does the PGN specification mistakenly omit solidus (/) for symbol tokens?

The Portable Game Notation (PGN) specification appears to contradict itself regarding the valid characters that may appear in a symbol token. From [1], section 7, quote: A symbol token starts with ...
7
votes
3answers
2k views

Piping Stockfish input

I'm trying to write a Linux command line UCI interface for Stockfish. My program writes a bunch of commands to a text file and then tries to pipe them to Stockfish via the command line. My problem is, ...
7
votes
2answers
2k views

Chess GUI that allows null-moves

Is there a GUI that allows null-moves as legal moves? Of course for engines the null-move heuristic already is an established technique.
6
votes
5answers
14k views

Check for checkmate

So I am implementing an intelligent chess agent but I can't get the checkmate working. I was wondering if there is a program that takes the chessboard notation and returns a result of yes or no to ...
6
votes
3answers
5k views

Representing Moves found via BitBoards, applying them, and removing them

I understand how to find all valid moves for all pieces on the board. For example I know that a certain knight can hit all of the 1's in this board 01000000 00100000 N0000000 00100000 01000000 ...
6
votes
1answer
9k views

Working with UCI protocol (coding)

I'm currently writing small application for a chess interested friend. The application is supposed to automatically annotate his chess games. When giving the engine a position to analyze, and a depth (...
6
votes
2answers
2k views

Detect pinned pieces code

This post is a follow up of this one: C++ vs Java Engine move generation performance My goal here is to improve the performance of my move generator, which finishes perft (start_pos, 6) in 8.5 secs. ...
6
votes
3answers
227 views

How do generic game engines work?

The evaluation functions for chess usually includes chess specific knowledge. However, Zillions of Games is able to play any game based only on a description of how the pieces move and winning/losing/...
6
votes
2answers
1k views

What are the common mistakes make by chess engines at ELO range 1500 - 1800?

I'm a software developer and occasional chess player at elo rating 1500. Chess engines of different level play different type of games with some mistakes according to that given level. I'm ...
6
votes
1answer
546 views

Three-fold repetition and null move

Added transposition table (this was tested alone and worked as expected), three fold repetition and null move pruning in my engine and wins more games but some of them end with three fold repetition ...
6
votes
1answer
2k views

Implementing Late Move Reduction (LMR) inside iterative deepening

Here I am trying to improve my engine, and the next feature on the list is LMR. I understood the general ideia, but since I don't want to introduce bugs and the CPW on the subject has no code, how do ...
6
votes
2answers
15k views

Is there a list of approximate ELO ratings for each Stockfish level?

I want to create something that will select an appropriate Stockfish difficulty setting automatically given the player's rating. The straight Stockfish v11 that I've downloaded has 20 difficulty ...
6
votes
2answers
1k views

How to evaluate and comment moves in PGN format?

I want, with Python-chess, to evaluate any movement of some game and generate the PGN with analysis, as Chess.com does in its analysis. For example, i played one game with fools mate and they ...
6
votes
1answer
1k views

Collecting principal variations during search and using them in ordering?

In an Alpha Beta search in that utilizes a Negamax framework, how does one collect principal variations to use in move ordering, and how does one use them, without using a transposition table? ...
6
votes
0answers
143 views

Stockfish position evaluation component terms in Python?

I saw the excellent Javascript-based guide to how Stockfish evaluates (non-NNUE). Is there a python version out there, perhaps using python-chess? What I am trying to do (in case you have other ...
6
votes
0answers
200 views

Are there any dicylic graphing programs for chess? [closed]

Although chess is frequently thought of as a tree structure, it is not because positions can be arrived at through different move orders and moves can be repeated. Are their graphing programs/...

1
2 3 4 5