Questions tagged [programming]

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

Filter by
Sorted by
Tagged with
24
votes
4answers
8k 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)?
19
votes
4answers
7k 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 ...
18
votes
5answers
1k 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 ...
15
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 ...
15
votes
2answers
2k 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
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 ...
13
votes
1answer
353 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 ...
12
votes
1answer
4k 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 ...
11
votes
5answers
16k 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 ...
10
votes
3answers
1k 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 ...
10
votes
2answers
2k 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.
9
votes
1answer
4k 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? ...
9
votes
1answer
1k 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
991 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
4answers
390 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
3answers
718 views

Is 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 ...
8
votes
4answers
645 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
3answers
3k 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. ...
8
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'...
7
votes
2answers
623 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 ...
7
votes
1answer
236 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 ...
7
votes
2answers
2k views

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 ...
6
votes
1answer
7k 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
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, ...
6
votes
4answers
4k 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 ...
6
votes
2answers
196 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 ...
6
votes
2answers
1k 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
174 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
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
4answers
343 views

Formulating a Precise Definition of “Space” in Chess

Premise I have always enjoyed playing recreational chess, so I know the basics and some general tactics / strategies. It was only recently though that I have gone more hardcore, so to speak, with my ...
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
436 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
2answers
557 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
0answers
195 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/...
5
votes
4answers
420 views

Coding chess engine

I have always wanted to start coding a simple chess engine. I do have basic understanding about the general architecture of such a program, but I would love to see some examples first. Anyone have ...
5
votes
3answers
3k 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 ...
5
votes
2answers
3k views

I'm confused by UCI Pondering and Time Control

I'm trying to talk to a UCI engine (right now Stockfish, but more generally to all UCI engines) to write my own computer-vs-computer program (I could use Fritz, but I really want to learn more about ...
5
votes
3answers
1k views

How can minimax chess engines do alpha-beta pruning without reaching the final positions?

In order to calculate far ahead, minimax chess engines must perform alpha-beta pruning, where they don't calculate positions that are obviously winning or obviously losing. Without doing pruning, ...
5
votes
3answers
3k views

What's the right approach of storing moves generated using bitboards?

I am building a chess engine from scratch using bitboards and, so far I am able to generate pawns moves. But, I am stuck on what should I do after finding all possible moves for pawns. Right now the ...
5
votes
1answer
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 ...
5
votes
1answer
360 views

Converting from Algebraic notation to Coordinate notation

I saw this thread: Converting square notation to algebraic notation programmatically Unfortunately, it's the reverse of what I need to do. Given a FEN and an Algebraic move, I need to generate the ...
5
votes
3answers
1k 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, ...
5
votes
2answers
172 views

Stockfish draw value randomization and “3-fold blindness”

In this commit, a change was made to the way Stockfish scores board positions that are draws due to 3-fold repetition or 50-move limits. Prior to this commit, a drawn position was assigned a score of ...
5
votes
1answer
187 views

Backwards Chess Program

Is there a chess program where you can create a position and the program creates a game, expecting the best possible moves to get there, or the most common? A problem I would see is some positions ...
5
votes
1answer
129 views

How can I speed up my check detection in Javascript?

I am trying to write a simple chess engine in Javascript. It performs very slowly but I have finally rooted down the problem to check detection. How might I speed up this check detection? If you have ...
5
votes
1answer
986 views

What is alternative to Zobrist hashing?

Zobrist hashing is very good method save position but it is not good to read position - is any good alternative to this algorithm which allow to store and restore position with minimum of bits. For ...
5
votes
1answer
1k 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 ...
5
votes
1answer
180 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 ...
5
votes
3answers
4k 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 ...
5
votes
1answer
895 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? ...