Questions tagged [programming]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
35 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 ...
1
vote
2answers
47 views

Alpha-beta add variance/handicap

I want to implement a handicap for my engine and Im 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 ...
4
votes
1answer
276 views

Is there a method to efficiently generate moves for bishops?

I currently have a function which returns the closed off squares for a piece in a particular position based on pieces blocking it. This function iterates over the rays of a piece and is sufficiently ...
1
vote
1answer
76 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 ...
3
votes
1answer
87 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
73 views

Faster bit-board implementation in Javascript

In a previous question I asked, linked here: How can I speed up my check detection in Javascript? I was told to implement bit-boards to speed up my engine. I can say that bit-boards have improved my ...
1
vote
1answer
103 views

Chess move generation with bit boards in Javascript

To make my engine more efficient, I am writing my engine such that it uses bit-boards in its move generation. But I have a question, suppose I have a rook move mask centered at a specific spot, how ...
4
votes
1answer
104 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 ...
4
votes
0answers
123 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 ...
6
votes
2answers
192 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 ...
3
votes
2answers
92 views

A script that can create a chess tree from an EPD file

Is there any script (any language) that can make a chess tree from an EPD file? Or what algorithm (any example) should be use to create it on my own? I am looking for one like the Chessbase opening ...
2
votes
1answer
58 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 ...
2
votes
1answer
93 views

Debugging my chess engine through the Arena GUI

I coded (with visual studio 2019 on windows 10) an ultra naive chess engine that complies with UCI engine interface rules. Before starting to develop it in more fancy ways, I want to make sure that I ...
4
votes
2answers
127 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
74 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
2answers
179 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 ...
1
vote
1answer
71 views

How to write an interface to lichess for a millenium board using chesslink?

I am aware of the python chess and chesslink mchess work but would like to attempt to interface it with lichess.org. My purpose would be to play others on lichess using my Millenium board. The API'...
3
votes
2answers
67 views

Creating program for finding top players with respect to elo and age

I want to create a program for personal use but also maybe for publishing it on the web, in order to detect the top players with respect to elo and age. There will be two cases: A) In this case, ...
4
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 ...
3
votes
3answers
182 views

File format/interface for home-brew engines (and implementation in lichess)

I'm a hobbyist chess programmer. I've built a few engines from scratch, had lots of fun, and am generally pretty proud of what I've made (I estimate ~1400-1500 though it's hard to tell). I was very ...
2
votes
2answers
115 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 ...
6
votes
3answers
140 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/...
1
vote
2answers
155 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 ...
1
vote
2answers
162 views

How many moves can be expressed with algebraic chess notation?

I am wanting to write a chess engine (see here: Creating chess engine, machine learning vs. traditional engine?). The first step I am doing is taking a position in as an FEN and converting this ...
2
votes
2answers
135 views

How can I set up en passant in 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 ...
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 ...
2
votes
3answers
148 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 ...
2
votes
2answers
239 views

If a pawn promotes to a checking piece while also revealing a check, it is a double check?

I'm writing a chess engine just for fun, and during the validation of movement generation, I found some positions in Perft Results that differ from what my engine is producing. As an example, take ...
4
votes
1answer
151 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 ...
3
votes
1answer
180 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
595 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 ...
2
votes
0answers
128 views

Wrong perft result?

I'm writing a chess engine for fun. Currently I'm finishing writing the move generator. During the research I leaned about PERFT for debugging my software. Indeed, I found many bugs, some of them was "...
3
votes
1answer
91 views

What is the format for USCF's Golden Database?

I was wanting to collect some statistics about players, and also just easily update player ratings for my local club. I tried the web crawls on USCF's Member Services Area (even using the thin pages ...
4
votes
1answer
120 views

Leela Chess PUCT Mechanism

How do we know w_i which is not possible to calculate using the tree search only? From the lc0 slide, w_i is equal to summation of subtree of V ? How is this equivalent to winning ?
5
votes
1answer
302 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 ...
6
votes
2answers
342 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 ...
-1
votes
1answer
243 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 ...
2
votes
2answers
423 views

Where is the neural network used in MCTS?

Where does an engine (such as AlphaZero) use its neural network in MCTS? It shouldn't be needed to evaluate positions reached via MCTS, since I'm under the impression that only terminal game states ...
3
votes
2answers
377 views

AlphaZero and the revenge of the Artificial Intelligence

Answering this question, @SmallChess offered this answer: Before Google's chess journey, the chess engine community believed: AI chess will not beat classical programming because neural networks ...
1
vote
2answers
161 views

Testing an engine (UCI) against an older version of itself

I am making modifications to a chess engine. I want to get quick feedback on whether the modified version seems stronger than an unmodified version or not, by fighting the older version multiple ...
2
votes
1answer
111 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 ...
4
votes
2answers
247 views

What's the rationale behind chess engines conditionally allowing threefold repetitions when assigning a draw score?

When a chess engine sees a position p repeated once (i.e. position p occurred twice) it immediately assigns the second occurrence of position p a draw score. This makes sense because position p doesn'...
2
votes
1answer
212 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 ...
7
votes
3answers
597 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 ...
1
vote
2answers
214 views

Android Stockfish communication works differently than on PC? [closed]

How is number of threads to use written on Android versions of Stockfish? Whole communication works but somehow I still can't change number of threads. I even have working code for PC version of ...
1
vote
0answers
47 views

Chess engine used to point out common tactical blunders [duplicate]

Does anyone know of chess engines that have been programmed to point out a tactical blunder in plain English? I.e. “you missed a skewer”, or something to that effect. Not simply “this move -3”. ...
1
vote
2answers
100 views

Can an Optimal Stopping strategy be applied to search functions?

Can the solution to the famous Secretary Problem be applied to the search function of a chess engine? Rejecting the first 37% moves and choosing the best one after that,or maybe even just checking the ...
1
vote
1answer
125 views

Is there a way to get MANY and FAST (but not deep) position evaluations in javascript?

I am working on a statistical chess project that needs to evaluate many (about 20-30) different positions per turn. They do not need to be deep but fast. Is there a possibility to use engines (...
3
votes
0answers
187 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 ...
4
votes
1answer
161 views

Standard for receiving live chess broadcast

I was making live broadcast recent days and I'm quite surprised how it technically worked. We were downloading whole new PGN file every 5 seconds with format shown it the code below. Is this how ...