Questions tagged [programming]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
95 views

Magic bitboards not speeding up my engine

I'm new to writing chess engines but just recently finished my first program. It ran slowly however so I switched over to bitboards, and now to magic bitboards. I used the chess programming wiki a lot....
8
votes
2answers
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 ...
4
votes
1answer
262 views

How do I complete this implementation of magic bitboards?

I'm currently coding a chess engine in C++, and have run into a bit of trouble with my magic bitboard implementation. So far, I have a function that calculates blockerBoards (all the possible pieces ...
1
vote
1answer
188 views

How to store moves for a magic bitboard system?

I am currently trying to implement magic bitboards into my chess engine. Let's just talk about rooks here. Given a square, what I can currently do is: -Calculate the sliding moves on an empty board. ...
3
votes
1answer
116 views

How can I convert a possible pieces' moves to an actual move in a bitboard?

If I have a bitboard (e.g. for knight squares he can move to) like this: 00000000 00000000 00000000 00000000 00000000 01000000 00100000 N0000000 How can I "convert" it into a move or "...
4
votes
1answer
455 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 ...
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 ...
-6
votes
1answer
228 views

Ok fine, how do I answer questions like records for youngest to obtain a certain title?

A. Background: Under Mobeus Zoom's suggestion here: List of records for youngest superGMs since 1950? (or 1970 or whenever FIDE started rating people. or basically after 2700s after Fischer) (this is ...
2
votes
0answers
37 views

How can I query an endgame tablebase for multiple positions using loops/conditional statements?

In textbooks you find diagrams about key squares and similar concepts. For example, white can promote a pawn if white's king can control three particular squares infront of the pawn. I would like to ...
3
votes
1answer
108 views

Position Similarity Metrics

I'm looking for metrics that quantify how similar/different two positions are. I have found a paper that used pawn structures to search for similar games in a database. This one tries to use reachable ...
1
vote
0answers
64 views

Why is futility pruning causing an Elo drop in my engine?

I'm getting weird results when introducing futility pruning into Blunder. On the one hand, I'm getting a pretty sizeable reduction in nodes, and I'm searching a full ply deeper for some positions (e.g....
4
votes
2answers
184 views

Techniques used for Stockfish engine selectivity

Example puzzle (I'm sure there are numerous that fit this bill): [FEN "rnbq3r/pppp4/3b1pkp/5p2/2BP4/4P3/PPP2PPP/RN1QK2R w KQ - 0 1"] [Site "Earth"] [White ""] 1. Qh5+ ...
3
votes
2answers
97 views

How can I use JaVaFo in my pairing program?

JaVaFo is the official pairing engine for certifying implementations of the Dutch pairing algorithm for Swiss tournaments. When I look at FIDE's list of endorsed pairing programs I see that most of ...
5
votes
0answers
131 views

How engines accomplish calculation speeds of 1000kN/s per Core and above?

I am developing a chess engine to improve my Cpp. It works, which means it generates legal moves and it can play them out. I optimized a bit and now achieve ~20k N / s, which is way better than my ...
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
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 ...
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
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 ...
4
votes
2answers
2k views

How to use Polyglot opening book bin file

I previously asked how to use polyglot in c# with a chess engine. My question then was not accurate. What I want to know is, what property(ies) of the bin file object I need to do the following: I ...
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 ...
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?
3
votes
1answer
146 views

How can a check evasion move generation algorithm be done efficiently?

In my chess engine, I'm attempting to create a strictly legal move generator, instead of generating pseduo-legal moves, then discarding them later in the search and evaluation phase. So far, here is ...
4
votes
1answer
682 views

Problems with computing the Zobrist hash for a chess position?

I'm attempting to use Zobrist hashing in my chess engine, but I'm running into some difficulties getting it to work correctly. I'm using the random numbers from this site so I can test my results ...
2
votes
0answers
87 views

Chess Engine Using LazySMP

I was hoping to parallelize the chess engine I was currently working on. I have done some research on some of the various types of algorithms such as YBWC, ABDADA, and LazySMP which is currently used ...
2
votes
1answer
235 views

How can I make my chess engine more efficient?

First, here's some context. My chess engine uses bitboards and works like this: A single gameboard is created as a 2d array at the start of the program. Like this: [[-4 -2 -3 -5 -6 -3 -2 -4] [-1 -1 -...
2
votes
3answers
779 views

When to use Clear Hash

I am developing a program that analyzes games sequentially, i.e. one game after another. Below are the parameters. Engine: Stockfish 10 Threads: 2 Hash Table: 4000 Depth: 30 My question is about ...
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)?
4
votes
2answers
146 views

Looking for an opening where stockfish puts out a queen early

I am by no means a chess person (like 1200 haha). I am designing a computer science challenge where the player has to find a bug in my chess program to beat stockfish in a game of chess. The bug is ...
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 ...
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 ...
5
votes
1answer
192 views

Obtain information about a a position from Stockfish

I want to know from Stockfish: All possible moves in a position, a.k.a. a depth 1 analysis with no score. If the king is in check, is checkmated, or if there is a draw. The current FEN string, after ...
3
votes
1answer
108 views

Live statistics chess960 from chess.com?

Cross-posted stackoverflow, but nothing. Both lichess and chess.com have the feature to play the variant chess960 live. However, only lichess has a graph showing how your live chess960 rating has ...
2
votes
3answers
255 views

How do convert/parse/extract data from a PGN into a spreadsheet/google sheet/excel file?

Sequel to this question: Live statistics chess960 from chess.com? So suppose I go to like https://api.chess.com/pub/player/gmwso/games/2020/12 or https://api.chess.com/pub/player/gmwso/games/2020/12/...
3
votes
2answers
2k views

Program that will give all available moves given the state of a board, including check

I am trying to write a program that will give out every possible move for every piece (one move deep) given the state of a board. I have already done this such that it works with everything except ...
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? ...
2
votes
2answers
1k views

Is there Python code to use the Leela neural network?

I am interested in doing some analyses of chess games using the neural network trained for Lc0. To that end I need to be able to turn PGN into the right kind of input vectors and to load and use the ...
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 ...
-1
votes
1answer
87 views

How to parse PGN string from an API with PHP?

I'm sending a request to the chess.com API to https://api.chess.com/pub/player/hikaru/games/2021/03 It will return all the games played by Hikaru in March of 2021, the interesting data is in the PGN ...
2
votes
5answers
346 views

Storing chess position in 24 Bytes

I want a fast way to search how many times a certain position has appeared in a database of hundreds of thousands of games. I researched the best way to store positions in a database but all of the ...
4
votes
2answers
746 views

Quickly converting board to bitboard representation using python-chess library

I would like to convert a given chess board into its bitboard representation, but my implementation is rather slow. Here is what I'm doing (using the python-chess package): board = chess.Board('...
3
votes
1answer
69 views

Free tablebase generator software?

I'd like to play a bit with fairy tablebases (Vaclav Kotesovec published quite a few) and am far too lazy to program them anew, especially as I wouldn't wonder if there is free code floating around, ...
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.
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
3
votes
2answers
781 views

Compile StockFish optimized for arm64-v8a

I cloned StockFish from GitHub and did a make inside the src folder and found that supported archs are: x86-64-bmi2 > x86 64-bit with pext support (also enables SSE4) x86-64-modern ...
3
votes
2answers
315 views

How can I get multiple computer recommended lines in python-chess module?

In python-chess you can communicate with the engine on a given position. However the method presented in https://python-chess.readthedocs.io/en/latest/uci.html using the engine.go() function with only ...
5
votes
1answer
189 views

A question about draw detection in chess engines

Let us look at this position. [FEN "4k3/8/8/p1p1p1p1/P1P1P1P1/8/8/4K3 w - - 0 1"] This is obviously a draw. Analyzing this with the Stockfish engine says that it is a balanced position. ...
2
votes
1answer
169 views

Why does AlphaZero implement time steps in its input layers?

I'm trying to build my own chess engine using neural nets, and have been researching papers from Deepmind about their algorithm implemented in AlphaZero. Since chess is a game with perfect information ...
4
votes
1answer
907 views

Python script to let stockfish selfplay 10 games from a given position

I would like to have Stockfish to selfplay 10 games starting from a given position. Game should end after 10 moves. From the python-chess documentation there is an example of playing only one such ...
2
votes
1answer
51 views

Features for evaluation a position

I am programming a (relatively basic) chess engine: while it is a lot of fun, it is also an interesting way to improve my chess skills! In order to evaluate a position, I need to extract features from ...
0
votes
1answer
58 views

Looking for a simple GUI for variants of chess

I am currently coding an engine for a variant of chess called Monster Chess. I was wondering if there a GUI existed that would simply take pieces from a square to another (eg e4 to e5) without ...

1
2 3 4 5