Questions tagged [python-chess]

For questions about the python-chess library (for questions about your own chess algorithm, use the [chess] tag instead).

Refers to the python-chess library, developed by Niklas Fiekas.

python-chess is a pure Python chess library with move generation, move validation and support for common formats.

This tag should be used only for questions about the python-chess library.

For general questions about chess-playing algorithms, use the tag combined with the tag. If your question is not actually about chess or the algorithms involved, you should not use the tag.

External Links

129 questions
1
vote
2 answers

Writing an API/wrapper for GNU Chess using Python 3

I am currently working on a Python 3 API/wrapper for GNU Chess. I've been doing a bit of research and I am pretty much stuck at the moment. There is the Chess Engine Communication Protocol, but I am not sure if that's the path I should go down.…
kuwze
  • 411
  • 4
  • 13
1
vote
1 answer

Heroku -> Python: Using subprocess to launch an executable gets [Permission Denied]

The problem: I have a python webapp running on heroku which creates a subprocess for communication with the Stockfish chess engine. Everything JustWorks™ on my local machine, however upon attempting to deploy the project on Heroku, I get an error…
1
vote
1 answer

adding moves to game with python-chess

I've been playing around with python-chess, I am loading a PGN file (A), reading the game from it. I then make a move, which creates a second updated PGN file (B). I read the last move from B and want to make that same move in A, and make a comment…
ravl1084
  • 291
  • 4
  • 11
0
votes
0 answers

why does this minimax algorithm output the same moves every time no matter what?

I'm trying to make a simple chess AI in python but when I try to play a game using this algorithm to find the best move it outputs the same thing every time (Nh6, Rg8, Rh8, Rg8...). # Minimax algorithm with alpha-beta pruning def minimax(board,…
Hello
  • 1
  • 3
0
votes
1 answer

Looking to create a simple chess game, getting stuck

I need help setting up the write logic for the winning condition "The game end when either player's king reaches row 8, unless it is white's turn and black's king is in row 7, then black has one turn to reach row 8 to tie game." I have tried this…
0
votes
1 answer

What does stockfish.py log as a move when promoting?

So I was just messing around with the stockfish library and am converting the moves to a PGN text format and errored parsing the move Right now every move comes in this format "a1b2" and I'm assuming a promotion would be something like this "c7c8=Q"…
0
votes
0 answers

can negamax be implemented for 4 player chess?(bughouse)

I am seeing that negamax is often used for chess engines.However there is only popular instances of it being used in the conventional game.Is negamax good for the variants of chess like bughouse or is there an alternate algorithm? Im looking to…
0
votes
1 answer

Using python tkinter, how do I make buttons invisible?

As someone who is relatively new to coding, I am trying to create my own chess game. Currently, I am facing a challenge in attempting to make my buttons invisible while still allowing them to execute piece movements. Any advice or guidance would be…
0
votes
1 answer

Failure to properly load a chess board in Pygame

I am attempting to create a chess GUI. I was able to make it so that when the player is White, everything loads perfectly. However, when I try to load when the player is Black, it does not load anything on White's side. Here is the relevant code…
Hantalyte
  • 72
  • 6
0
votes
0 answers

Error when analyzing position with Stockfish engine in Python

I am trying to retrieve the evaluation scores of each move from the perspective of white in a PGN file by analyzing the positions using the Stockfish chess engine in Python. I am using the python-chess library to interact with the Stockfish…
0
votes
0 answers

jupyter notebook output cell pychess and print in 2 columns

i'm using pyches and ipywidgets what i would like to do is have a jupyternotebook cell's output split horizontally so that on the left i show the board on the right i show the past entered moves, allthough my varaibles are fine i just cannot get a…
Peter
  • 2,043
  • 1
  • 21
  • 45
0
votes
0 answers

SimpleEngine module of python-chess library has no attribute position

I am using the python chess library to make a chess bot, it works fine until self.engine.position(self.board), I am then given this error:AttributeError: 'SimpleEngine' object has no attribute 'position'
COHEJH
  • 1
  • 5
0
votes
0 answers

Chess module does not have attribute uci

I am making a chess bot, using stockfish and python. I have installed the chess library and all works fine until this line of code: chess.uci.popen_engine("stockfish"). I am then given the error: AttributeError: module 'chess' has no attribute…
ECMC
  • 1
  • 3
0
votes
1 answer

Python chess FileExporter and open() function don't export a game

I've been working on project in python chess playing with lichess opening explorer API. I have succeeded in doing all the hard work and finally got the PGN tree that I wanted but when I try to export my PGN tree to a text file all I am left with is…
0
votes
1 answer

I'm getting an error in the loop on line 36 and 68, and I don't know why

I'm making a chess engine using alpha-beta pruning for a project, and here is my code. I'm getting an error on line 36 and 68,and I'm not sure how or why. Please help me. Thank you for your answers in advance. import chess def evaluate() : if…
Yash
  • 1
1 2 3
8 9