Questions tagged [programming]

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

Filter by
Sorted by
Tagged with
4
votes
1answer
251 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
71 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
69 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 ...
3
votes
1answer
79 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
98 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
102 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
119 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 ...
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 ...
6
votes
2answers
189 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
1answer
66 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
53 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 ...
4
votes
2answers
120 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 ...
2
votes
1answer
92 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 ...
5
votes
3answers
820 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, ...
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
177 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
68 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'...
7
votes
3answers
592 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 ...
2
votes
2answers
114 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 ...
2
votes
3answers
145 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
3answers
180 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 ...
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
1answer
88 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 ...
6
votes
3answers
139 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
159 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 ...
1
vote
2answers
145 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 ...
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
0answers
127 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 "...
2
votes
2answers
219 views

Tips for debugging and progressing a chess engine's implementation

As I mentioned in previous questions I'm currently following this tutorial for building my chess engine. The code was written in C#, but mine is in C++ and I'm in the phase of finalizing the board / ...
4
votes
1answer
790 views

Efficient ways to go from pseduo legal to fully legal move generation [closed]

so I've written an entire pseudo legal move generator as well as a simple gui to interface with. I also have my AI only play the best move available without going into a minimax tree. Before I begin ...
6
votes
1answer
414 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 ...
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
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 ...
2
votes
2answers
238 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 ...
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 ...
3
votes
4answers
3k views

Programming three-fold repetition for my chess engine

I'm making a chess engine that has to implement a three-fold repetition as my AI vs AI engine repeats the same moves over and over again (Have a look at my post here - My chess AI makes the same ...
5
votes
4answers
397 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 ...
3
votes
1answer
176 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 ...
4
votes
1answer
147 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
577 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 ...
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
1answer
119 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 ?
4
votes
2answers
320 views

Compiling asmFish on macOS

I have been able to make a custom build of asmFish on Linux. However, I have been unable to do so on macOS. I've seen a Mac version of the FASM compiler on the Internet. But when I tried using it for ...
5
votes
1answer
776 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? ...
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 ...
3
votes
0answers
185 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 ...
5
votes
1answer
299 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
328 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 ...