chess

Cannot pass in parameter between classes despite being defined

Cannot pass in parameter between classes despite being defined Question: I am a beginner programmer writing a chess program that makes use of multiple classes. One class, the chessboard class, defines some variables that are used through out my program. The relevant ones are board and pieceCaptured. class chessboard( ): #creates a chessboard visualised through …

Total answers: 1

how can I represent tuple as a 2D array in python?

how can I represent tuple as a 2D array in python? Question: Imagine a NxN chess board, I have a tuple t = (0,3,2,1) which represents chess pieces location at each column (col = index), and each number represents the row, starting at 0 from bottom. For this example, it has 4 columns, first piece …

Total answers: 3

Inserting Millions of Rows in a an SQLite Database, Python is Too Slow

Inserting millions of rows in an SQLite database, Python is too slow Question: For my chess engine I use statistics to choose optimal moves. I collected them from millions of games. I’m interested in the current move, the next move and how much times the next move was played given the current move. For using …

Total answers: 1

how do i fix the notation of my chess board?

how do i fix the notation of my chess board? Question: I’m making a chess game with python 3.10.7 in pycharm and using pygame 2.1.3. This is some of my code in my main() function. I’m trying to get the position of the pieces the user clicks on and it works, but the number position …

Total answers: 1

Top 5 moves using chess.engine.SimpleEngine

Top 5 moves using chess.engine.SimpleEngine Question: 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 already tried getting all the result and then keeping just …

Total answers: 1

How to draw a chessboard with Pygame and move the pieces on the board?

How to draw a chessboard with Pygame and move the pieces on the board? Question: I’ve been trying different ways how to get my chess pieces to drag and drop I’ve found ways, but the problem is that I’m using a dictionary to load my images via pygame.image.load. I’ve created a dictionary for my images …

Total answers: 1

How to Communicate with a Chess engine in Python?

How to Communicate with a Chess engine in Python? Question: On Windows 7 I can communicate with a chess engine via command line. Small example session with Stockfish on Win 7: C:runStockfish>stockfish-x64.exe Stockfish 2.2.2 JA SSE42 by Tord Romstad, Marco Costalba and Joona Kiiski quit C:runStockfish> The first line was output by the engine and …

Total answers: 3