Questions tagged [programming]

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

Filter by
Sorted by
Tagged with
18
votes
4answers
6k 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 ...
17
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 ...
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
314 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
3k 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 ...
10
votes
5answers
14k 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
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.
10
votes
2answers
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 ...
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
816 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
577 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
2k 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
1answer
3k 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? ...
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
526 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
4answers
329 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 ...
7
votes
1answer
223 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
1k 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
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
3answers
453 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 ...
6
votes
2answers
979 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
138 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
4answers
313 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
2answers
295 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
409 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
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
883 views

Help with game phase identification

I'm working on a chess AI for a school project and I am looking into ways to identify the current phase of a board, meaning the opening, middlegame, and endgame. I have seen an article explaining ...
5
votes
4answers
388 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
1answer
6k 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 (...
5
votes
3answers
808 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
2answers
183 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 ...
5
votes
3answers
2k 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
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
1answer
289 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
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.
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
3answers
3k 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
767 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? ...
4
votes
4answers
3k views

Which is the most CPU efficient chess engine?

I am learning artificial intelligence and chess programming. I want to analyze the architecture and read the code of existing chess engines. But I am confused between multiple choices. There are ...
4
votes
2answers
175 views

How to calculate pinned chess moves

I am writing a legal move generator, and the last piece of the puzzle is preventing pinned pieces from being moved such that the king will be in check. I have read a lot of posts here and on ...
4
votes
2answers
958 views

How to generate hash keys for chess positions

Is there a standardized method for generation of hash keys for chess positions. I want to implement hash key generation in my program, so wanted to know the best way to do it. It would be great if ...
4
votes
1answer
71 views

How to count pieces from PGN notation?

I am trying to figure out an algorithm to extract the number of each piece that both black and white have from a PGN file. Right now I have all of the moves tokenized(i.e. c("e4", "d6", "Nc3", "f5", ...
4
votes
1answer
346 views

How to iterate over all FENs in Syzygy table?

This is a programming question related to chess syzygy endgame tables. I believe that it is better suited on chess stack exchange than on SO because it is too specific to chess and asks for a ...
4
votes
1answer
2k 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 ...
4
votes
2answers
112 views

Minimax with alpha-beta pruning for chess

I am creating a chess AI using the minimax method with alpha-beta pruning. I am trying to understand how the alpha-beta pruning works, but I can't get my head around it when it comes to chess where ...
4
votes
1answer
138 views

Chess Engine: Generate a Bitboard of Pinned Pieces

I'm currently working on a chess engine and have a pseudo-legal move generator working. I'm looking for a way to efficiently generate a bitboard of pinned pieces, so I could skip them when generating ...
4
votes
2answers
2k views

C++ vs Java Engine move generation performance

I've just finished translating my Java Engine to C++11, expecting great speed improvements in move generation. The code is very straightforward and uses a pre-generate bitboards approach. I also ...