Python is a general purpose and high level programming language. You can use Python for developing desktop GUI applications, websites and web applications.
Questions tagged [python]
45 questions
14
votes
1 answer
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 easy way to make the conversion? i.e. from SAN…
fastmultiplication
- 243
- 2
- 6
6
votes
0 answers
Stockfish position evaluation component terms in Python?
I saw the excellent Javascript-based guide to how Stockfish evaluates (non-NNUE). Is there a python version out there, perhaps using python-chess?
What I am trying to do (in case you have other suggestions for skinning this particular catfish): I…
Abhijit Mahabal
- 69
- 1
5
votes
2 answers
How to run lichess stockfish analysis locally?
I am working on a research project where we need to run stockfish on hundreds of thousands of pgns we have collected. We need to extract all information generated from stockfish like centipawns, inaccuracies, blunders, mistakes, etc.
I know you can…
Elias
- 51
- 2
5
votes
2 answers
Quick method for generating FEN strings from PGN using Python Chess
Is there a fast way to generate FEN strings for every move in a PGN?
I'm generating an opening book using the Lichess elite database and Python Chess, but Python Chess is taking a surprisingly long time to analyze games and generate FEN strings for…
MattY
- 153
- 1
- 4
5
votes
1 answer
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 game, starting from the initial position. Thanks in…
Arturo
- 273
- 1
- 5
5
votes
2 answers
Looking for a Python chess engine
I am looking for a Python chess engine package. It must be fully contained in Python, I don't want to download separate files for the engine itself and link them up somehow.
All I want it to be able to do is take a FEN and provide best move. It…
Fourth
- 51
- 2
4
votes
1 answer
How do I get the solutions of the puzzle using stockfish?
I have a list of PGN files that are games between top grandmasters where one player resigned at the end of the game. I am looking to find solutions to those position using stockfish/or another chess engine(programmatically). Ideally - I should be…
sebastian
- 41
- 1
4
votes
1 answer
How do you nerf Stockfish to analyze the same position multiple times?
I want to make some statistics by analyzing the same position, multiple times, at different levels of Stockfish.
Precisely, I would like Stockfish to analyze a specific position at different "Skill Level" but what I've noticed is that there is the…
Giorgio
- 43
- 2
4
votes
1 answer
Obtaining the correct move from syzygy tablebases (Python)
I have created a chess engine in Python and now want to start using the endgame tables in syzygy. I have downloaded all the relevant files and is now ready to start.
I have found how to access the files in Python via e.g. the Python Chess module…
Eli
- 43
- 2
4
votes
2 answers
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('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0…
Arman
- 171
- 1
- 5
4
votes
2 answers
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 this is because my alpha-beta pruning isn't…
Destaq
- 193
- 7
4
votes
2 answers
Python and UCI engine
I'm working with Stockfish in Python 3.
And when I do something like this:
I get just "bestmove e2e4". How can I retrieve full information?
Like this:
MrTrushka
- 43
- 5
4
votes
3 answers
Play chess in Python programming language?
I am searching for a program/library in Python which will let two users or a user and an AI play chess with each other.
PS: I have found python-chess. Can this be used for the above along with a chess engine?
theshepherd
- 41
- 2
3
votes
1 answer
Unable to run Stockfish on Python
I know this isn't a programming forum, though it's chess-related, hence the placement on here. Basically, I'm trying to setup stockfish with Python on my PC. I installed it via pip install stockfish.
So I went on and tried to setup the Stockfish…
velotoy
- 33
- 1
- 4
3
votes
1 answer
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 to understand how I access the moves for a…