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
0
votes
1 answer

How can I change the notation in chess-python?

I am trying to change the notation of the moves, I mean the library returns for example g1f3 and I want to change to Nf3 (algebraic notation). I try this method but it doesn't work: board.parse_san(move.move) How can I do it? There is any method in…
Michael
  • 19
  • 4
0
votes
0 answers

Using two autoencoders side by side and bulid model on top in Keras

For a chess engine I want to use two autoencoder models, which extract key-features out of a chess-position, concatenate them and build a model on top to compare two chess positions. My code looks like this so far: enc1 =…
Valentin
  • 1
  • 1
0
votes
1 answer

python-chess: replace . with #

A python-chess board can return an ascii representation of the board with dots as empty squares based on this part of its source code: def __str__(self) -> str: builder = [] for square in SQUARES_180: piece = self.piece_at(square) …
dig dug
  • 36
  • 4
0
votes
0 answers

ModuleNotFound errors on PyPy

I recently started using PyPy, and the chess engine I'm working on uses import chess- This runs on CPython well, but if I run the program on PyPy, it just gives me a ModuleNotfound error- ModuleNotFoundError: No module named 'chess'. I tried pip3…
user19770271
0
votes
1 answer

Why does my python notebook need excessive amounts of ram?

I read a pgn file, extract some information and then write my results back to a file. Why does the python process Way more RAM than my variables combined? Example: After loading 10000 chess games, python needs 700mb of RAM, but the list is only 85kb…
0
votes
1 answer

Top 5 moves using chess.engine.SimpleEngine

I'm having trouble with the engine encapsulation of python-chess, I would like to use the Stockfish function top = stockfish.get_top_moves(5) but it seems like there is no way to do it using chess.engine.simpleEngine, do you have any advices? I…
0
votes
0 answers

Trying to get Maia chess engine to work with python-chess

I'm trying to get the maia chess engine (using maia-1900 weights https://github.com/CSSLab/maia-chess/tree/master/maia_weights) to run in python-chess. I have the following code: engine_path =…
0
votes
1 answer

Chess Engine Options Configuration

I modified the Goratschin Chess code so that it can run 8 chess engines at the same time, and it works; however in the code the options management of each single chess engine is missing, so the system reads the default parameters of each exe file…
Marco C.
  • 1
  • 1
0
votes
0 answers

Not sure what's wrong with my chess Ai Minimax Algorithm - Running to Max recursion depth

As the title says, I've been running into issues with my code not running properly. It reaches maximum recursion depth, and after some debugging with print statements, it seems like it runs through the pawns possible moves, but then gets stuck on…
AKapoor30
  • 13
  • 2
0
votes
1 answer

Chess Programming, Board Representation - Python

Saw this style of board representations and was wondering what kind of style this is? Bit-board or 0x88? Im newer to programming and even newer to Chess programming so this Board representation choice seemed a bit different than the array versions…
0
votes
1 answer

Fill in a cell of grid with a picture using Tkinter Python

I am creating a chessboard to display my NQueensProblem search. I have made a grid and filled in the cells with colors. However, I can't fill the positions of queens with 'queen picture'. For example, I have a queen at (0, 1) and I want this cell…
0
votes
2 answers

Stockfish does the same moves everytime for a given postition

Using stockfish for a chess program. It gives the same moves every time for any position. It even opens with the same moves. I'm using the python-chess library for communicating with stockfish I'm not sure if that's where the issue lies or if it's…
0
votes
0 answers

While loop only iterating once through nested classes

I'm building a chess gui using pygame, in which the main game loop calls a method in a seperate class (Move in GameState class), which then further calls another method in the same class(pawn_promotion). In the pawn_promotion method, a surface,…
0
votes
1 answer

Very weird error in chess __init__.py file

I import chess in python and I finished everything in the project but when I click run I find a very weird error in file __init__.py the error File "D:\pythonProject\pythonProject3\venv\lib\site-packages\chess\__init__.py", line 37, in
0
votes
1 answer

Minimax returning illegal uci move - move generation doesn't update?

When I test my code with the position r1bqkbr1/pp2pppp/2n1p2n/2p5/3P4/7N/PPP2PPP/RNBQKB1R w KQq - 3 6 the code below outputs ValueError: illegal uci: 'd8d7' in r1bqkbr1/pp2pppp/2n1p2n/2p5/3P4/7N/PPP2PPP/RNBQKB1R w KQq - 3 6 when run. The issue seems…
Ariel
  • 37
  • 1
  • 5
1 2 3
8 9