Questions tagged [programming]

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

Filter by
Sorted by
Tagged with
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 ...
2
votes
1answer
348 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 ...
2
votes
1answer
54 views

Getting wrong results in perft stats with checks and mates

The perft count works well after testing with many positions from epd files from the web Now I want to see some perft stats like this one: https://www.chessprogramming.org/Perft_Results, from the ...
3
votes
1answer
48 views

How to watch PGN at different speeds?

I am looking for a program for Windows or an online service for viewing PGN at variable speed. I know that lichess has fast and slow speed, but I want more adjustable settings.
3
votes
1answer
220 views

Elo rating software with automatic random matchups

This question is not about chess per se, but I am looking for a software that could generate random matchups through a list of 200ish options/people, then I could choose the winner and it would rank ...
3
votes
1answer
61 views

How to I apply moves (bitboard) and continue searching? My current attempt is throwing a strange error!

Explanation I have a list of all possible current moves in a position. At each node, I want to then generate all possible moves and continue. The problem is that my code is modifying the list of moves ...
3
votes
2answers
100 views

Compiling Stockfish to disable own castling while allowing opponent castling

For artistic purposes, I would like to create and study engine games in which only one side is able to castle. For this, I need to compile a version of Stockfish which never castles, and doesn't ...
5
votes
4answers
651 views

Extract anonymized games out of a pgn

I'm a big fan of pgn-extract, but I am open to other linux-friendly tools. I have a big pgn file (over 5 million games) and a set of ECO codes. My goal is to fetch all the games matching those ECO ...
4
votes
1answer
200 views

Are these magics wrong?

I am working on my chess engine and wanted to finally implement magic bitboards to get a huge increase in performance. Basically I was writing a method to check if a number can be used as a magic for ...
1
vote
1answer
53 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
2answers
98 views

Discovered attack in quiescent search

I'm implementing quiescent search in my chess engine, although just capturing moves have been generated. In the below position, at 1 ply, the white queen captures the pawn, but the quiescent search ...
2
votes
1answer
67 views

Engine is evaluating the same position at the same depth with different score

My engine is evaluating the same position at the same depth with a different score inside the search tree, is that normal? [Title "depth 1 ply 3 alfa -20 beta -15 score -15 (1.Na3 a5 2.Nh3)"] [FEN ...
1
vote
0answers
50 views

Magic bitboards: My indexing doesn't seem to work!

I am beginning to understand magic bitboards. I have successfully implemented them with Rooks, and I am currently working with Bishops. The method is very similar though. Problem I have a bishop on g7 ...
4
votes
1answer
102 views

Trapped Rooks: Does Stockfish penalize more if the king can't castle temporarily?

In this talkchess thread, they discuss trapped rooks and castling rights. In post #5, user @Lyudmil Tsvetkov posted: I would give at least some 10-15cps for temporary prevention of castling. Here is ...
2
votes
0answers
38 views

Multi-thread performance

I'm implementing multi-thread in my engine but I think I'm not getting the expected performance boost. Below are the results from the initial position to depth 10. The single thread version takes ...
1
vote
1answer
73 views

Using Stockfish in an automated way, for example, to analyze games in pgn format

I am looking for a way to use Stockfish for an automated analysis of games which I have in pgn format. Similar to Fritz/Chessbase's Blunder Check function I would like Stockfish (or any other UCI ...
3
votes
0answers
49 views

Probability of given position/piece configuration

I'm currently working on an image based FEN generator. I found a paper doing the same and they have used Stockfish to calculate the most probable piece configurations. Now I wonder if Stockfish has ...
4
votes
1answer
99 views

Creating a New Neural Network for chess

I'd like to have my own chess engine similar to Leela for personal use. I’d want it to have a decent strength, let’s say 2k, and be able to play with it. I'm wondering if I can use Leela to create a ...
5
votes
1answer
224 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 ...
1
vote
1answer
26 views

Static null move CPW engine

I have two questions about a code implementing a static null move. The questions are in the code. The code is extracted from here: CPW engine search code if (depth < 3 && !...
1
vote
0answers
19 views

Script for finding undefended pieces

I am looking for a script/code/CQL that searches for undefended pieces in a given position. I know that is possible to do it in the python chess library, but that is too complicated for me. Is there ...
5
votes
2answers
173 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 ...
2
votes
1answer
102 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('...
2
votes
1answer
118 views

Is this implementation of Killer Move heuristic correct?

I implemented the killer move heuristic based on my understanding, but is it correct? Inserting a killer move when a non-capture causes a beta cutoff (i is a Move pointer) // Stuff if(val >= beta){...
1
vote
1answer
151 views

Chess Engine: Faster Move Generation

Introduction I'm in the process of rewriting my chess engine for better performance. I've started with the move generation function first. I've been looking at this person's article (Their Article) ...
3
votes
4answers
9k 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 ...
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 ...
2
votes
1answer
108 views

How can I increase the search ply depth of my minimax function for my chess engine?

I have programmed a minimax function with alpha-beta pruning for a chess engine I am building. However, it is very slow and I cannot analyze to a deeper depth as it would take too much time. I believe ...
2
votes
1answer
129 views

Magic Bitboards, Feeding in Randoms - Why have to find magic instead of just loading from disk?

I read about Looking for Magics for Magic Bitboard, they mentioned the method "Feeding in Randoms". As I understand, this method works like this: label RETRY; magic = random();//trial for (all ...
2
votes
1answer
299 views

Is this the correct flow of a chess game?

I am trying to program a chess game as a challenge to myself, however, I am unsure if I have all the moves correct to play a legal game (not any advanced moves, that would be a challenge for another ...
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 ...
4
votes
1answer
614 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 ...
0
votes
1answer
1k views

Stockfish 11 for Android - binaries

I have an Android app that uses precompiled binary files of Stockfish. There are both arm64-v8a and armeabi-v7a binary files for direct use in version 10. On Stockfish site there's however not such ...
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)?
2
votes
1answer
228 views

Communication with Stockfish engine via Python

I try to access the Stockfish engine via Python, but only get bestmove = a2a3. If I enter the same commands into the MAC-terminal, the engine calculates the correct move. Can anyone help me, please ?...
2
votes
3answers
338 views

Chess Psychology

I have a friend who is an improving chess player. He wants to progress in his game. The problem with him is that he plays really good with much stronger opponents but, often lose many games ...
2
votes
1answer
60 views

Question on how to access a move on a line outside the main line using python-chess

I'm trying to write a simple code that is capable of reading a PGN file and searching for moves and comments throughout the variant tree. However, I have not been successful, I have not yet been able ...
2
votes
3answers
272 views

How to use Arena GUI outputs in a python program

I'm currently developing a self-playing chessboard on which I'd like to implement an Artificial Intelligence (AI) (currently it's Stockfish. I would like to know how I could, if I can, export Arena ...
3
votes
1answer
311 views

Python-chess : Are the move scores enough to rank moves from the most to least likely moves played by an engine?

My goal is to make a script to finding the most and least likely move an engine will play, and then make a list it. I tried using the scores to make such a list, with the best score equalling the most ...
3
votes
1answer
1k views

Python-chess : how to get a list for the best engine moves

I am working on a simple cheat detection script to find if a user used one of the top engine moves in a game, so I found this great python-chess library Additionally, I found this example to getting ...
1
vote
3answers
237 views

Python-chess is_zeroing and is_capture operation outputs

I'm using python-chess to analyze a game. I have my code like this, and I expect 3 boolean outputs. print("is_castling: " + unicode(board.is_castling(node.move))); print("is_zeroing: " + unicode(...
2
votes
1answer
133 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 ...
0
votes
1answer
304 views

Python and Stockfish [duplicate]

I am trying to get Stockfish to work in Python 3. Just to get started on my project, I tried to have Stockfish think until a depth of 20. However, the program instantly returns that Stockfish ...
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 ...
3
votes
1answer
266 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 ...
1
vote
1answer
128 views

PythonChess - Get engine to predict a list of the best moves in a position

Say that I currently have a board, and then on that board I move my e2 pawn to e4. I'm looking for a way to get the engine to predict the X amount of best moves for black. I know how to predict the ...
2
votes
2answers
147 views

How can I set up en passant in the Popeye engine?

I want to solve a problem with Thomas Maeder's excellent Popeye engine, and to specify that a possible en passant in the diagram is ok. How can I do this please? The documentation seems opaque. Thanks ...
1
vote
2answers
55 views

Alpha-beta add variance/handicap

I want to implement a handicap for my engine and I'm struggling with it. I using alpha-beta pruning. In my current approach I set a variance variable in centipawns and let the engine choose a move in ...
8
votes
4answers
394 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 ...
2
votes
1answer
68 views

Best way to loop through all possible moves (Alpha Beta)?

Essentially I'm just trying to create a somewhat efficient chess ai using an Alpha Beta Pruning approach for a future neural network to train against. I know I could use an existing program but this ...