Questions tagged [python]
Python is a general purpose and high level programming language. You can use Python for developing desktop GUI applications, websites and web applications.
30
questions
4
votes
0answers
80 views
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 ...
1
vote
1answer
146 views
Is there a chess.com Python api?
I want to program a bot and implement it on chess.com, but are there any types of chess.com Python api which will make the bot use the chess.com interface?
4
votes
1answer
148 views
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 ...
1
vote
1answer
217 views
running stockfish with docker and docker-compose
I have access to a powerful computer at work so naturally I want to run a chess engine on it (stockfish for now and later leela). I am trying to use docker-compose to link a stockfish image and a ...
2
votes
0answers
179 views
How to turn off Contempt in engine analysis?
I'm trying to analyze a game with the python-chess package, and for that I want to turn off the "Analysis Contempt" option in Stockfish. However, it seems it doesn't work, and I don't know ...
2
votes
1answer
527 views
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.
...
2
votes
1answer
90 views
What's the best way to get the top n engine moves?
I want to use python-chess to get the top 5 Stockfish moves from a given position with a numerical evaluation for each move. Is it more accurate to run the engine for 10 minutes with MultiPV=5, or to ...
2
votes
1answer
165 views
Chess Engine with Python-Based / API?
I went through the most popular chess engines, e.g. StockFish, Komodo, Rykba and so forth, but I wasn't able to a.) find an API or b.) a python based Engine - does anyone know a suitable project?
I ...
4
votes
2answers
379 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('...
4
votes
2answers
367 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
101 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
1answer
591 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
1answer
195 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
134 views
Export KPvK endings positions (up to black/white symmetry) from ChessBase 15 using python-chess
I have the Mega Database 2020 from ChessBase and ChessBase 15. I am using ChessBase 15 to search the Mega Database 2020, my search criterion being all games ended through a KPvK (king and pawn vs. ...
2
votes
1answer
218 views
How can I send a UCI command to a chess engine in Python?
I have a followup question to my previous thread:
Python script to let stockfish selfplay 10 games from a given position
There are some engines that allow you to set a command that imposes that the ...
2
votes
1answer
705 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 ...
4
votes
1answer
580 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 ...
3
votes
2answers
473 views
How to install chess.pgn on python?
I don't know how to import chess.pgn on Python.
I searched everywhere, but I didn't find anything. Can anybody here help me?
2
votes
3answers
442 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
522 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
2k 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 ...
0
votes
1answer
339 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 ...
0
votes
1answer
2k views
Why can't I use my stockfish engine with python chess? [closed]
I'm using python chess and I'm trying to use my stockfish 10 engine downloaded from the stockfish website.
import chess.uci
engine = chess.uci.popen_engine(r"stockfish-10-linux/Linux/...
4
votes
2answers
2k views
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 ...
2
votes
1answer
218 views
Python Engines to Beat to Take the Crown
Since Python is extremely slow, chess engines are almost never written using it. I've been building a Python engine to avoid this issue (through JIT compilation), and want to compare my engine ...
3
votes
2answers
205 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
1k views
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:
1
vote
3answers
283 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(...
4
votes
3answers
2k views
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 ...
13
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 ...