Questions tagged [chess]

This tag is for the game of Chess and problems getting computers to play it. Use this tag for questions about algorithms and other programming problems specifically related to chess playing. Do not use this tag for general programming questions just because your program plays chess.

Filter by
Sorted by
Tagged with
0 votes
0 answers
28 views

How do I declare multiple objects without all variables pointing to the same object in Java? [duplicate]

I am trying to develop a chess program using bitboards. I need a bitboard for each color piece on the board and I want to organize them using Object Oriented Programming. Currently I have a position ...
glibsy's user avatar
  • 1
-4 votes
0 answers
43 views

Chess Application on C# [closed]

I've written some code(algorithm for figures and logics and interface) for my game Chess and it has too much errors, actually I don't know how to fix them. and so if you have enough could you help me ...
lizaveta's user avatar
0 votes
0 answers
9 views

Using library react-chess-puzzle to create puzzle

I have a problem, I am working in react and I successfully made made fist puzzle but for some reason I can get to figure out how to use <Puzzle.Reset/> and <Puzzle.Hint/> components that ...
Milan Jovanovic's user avatar
0 votes
0 answers
40 views

How to integrate Stockfish in Html with chess.js and chessboard.js?

It is just a fun project but I could not get the Stockfish to give a move after my move. <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-...
Shubhajit Ghosh's user avatar
0 votes
0 answers
18 views

React starting position

Hello I am learning react.js and I choosed my project to be chess app. I was diong this for like 3 days and I still can't do it. I want to pieces be on their starting positions like king on e1 or ...
tajgel's user avatar
  • 31
-2 votes
0 answers
44 views

Checks in Chess game

I was following Eddie Sharick tutorial of creating Chess Game with Python video series and wanted to improve it a bit. Currently I have problem with correctly displaying checks and checkmates in the ...
asdfg's user avatar
  • 1
-1 votes
1 answer
61 views

Why can't I initialize a board with chess pieces here?

I'm trying to create a chess library from a template. I'm trying to initialize a chess board as a 2d-array containing chess pieces as a struct. I get a syntax error on this line: board:[0][0] = ...
The anus guy's user avatar
0 votes
0 answers
29 views

Some logical error in alpha beta pruning function

I am building a chess game in Python, and I was trying to add AI in it. I have successfully implemented the min max algorithm and it is working just fine, but when I am trying the alpha beta pruning, ...
Pratyush's user avatar
1 vote
0 answers
30 views

How to query moves in the Opening Book (.obk) of Xiangqi (Chinese Chess)

I'm creating a Xianqi GUI to read Opening Books ( .obk ), I'm stuck on the step how to get the moves from books that matching with current positions of pieces on the board, in books every the moves ...
biên nguyễn's user avatar
-3 votes
1 answer
45 views

Chess AI not evaluating more than 1 move ahead despite having depth of 3

I've been working on a chess bot, and I've finished up a draft for the minimax function, but it seems to be entirely disregarding any minimising or maximising past the 1st step. In order to make it ...
Aryan MP's user avatar
-1 votes
3 answers
75 views

Can't make Python Stockfish weaker

I’ve written a chess software in Python which use Stockfish via this library: https://pypi.org/project/stockfish/ The software works and plays well. Too well actually… Mi idea was the app can offer a ...
igoemon's user avatar
  • 175
0 votes
1 answer
44 views

Discord Chess.com Stats Bot?

It's my first time creating a Discord bot and I'm trying to pull data from the chess.com API. I want the bot to return if a user won their last chess.com game when you type !chessresult user in the ...
twellener's user avatar
0 votes
1 answer
57 views

why is my negamax function choosing dumb moves? (Hex chess)

func GetEvaluation(Turn, NextPositions = Positions): var EvaluationTable = { White = 0, Black = 0 } for Piece in NextPositions.Main.values(): EvaluationTable[...
D0RYU's user avatar
  • 3
0 votes
0 answers
49 views

How can I build a chess uci computer in python?

I am trying to make a chess engine in python, and so far, everything was fine. I want to make it compatible with uci so I can sign it up on lichess and also display the moves in a chess gui like arena....
Oliver Lacika's user avatar
0 votes
0 answers
33 views

How to add chess move validation to my function?

I have this function that takes in a piece (e.g wR would be white rook), the row its on and the column and returns a list of coordinates that it can move to. However, I would like to make it so that ...
BlitzedOblivion's user avatar
1 vote
1 answer
118 views

Chess.com API request not working when using Python Wrapper

I'm trying to retrieve various data from the Chess.com API using Python. I came across a pretty intuitive wrapper documented here, but when I try to run any of the given functions I keep getting a ...
Justin's user avatar
  • 31
-1 votes
1 answer
60 views

How can I make this code for finding legal chess moves more efficient?

I am trying to make a chess engine without use of the python chess libraries, so I can learn more about chess programming. Have generated a set of pseudo legal moves (- castling and en passant) and ...
bbqribs's user avatar
  • 19
0 votes
0 answers
18 views

component image does not render within parent component react js

I am running into an issue where I am trying to push the Pawns component in the second block of code on to a Tile, but the pawn img is not rendering on the Tiles. The console confirms that the pawn is ...
dmc's user avatar
  • 15
-1 votes
2 answers
47 views

C++ Chess Engine producing write access error

I am working on a basic chess engine in C++, and I want to make a move by getting a string from a user. I want to write a move like 1144, that means column 1, row 1, to column 2, row 2. I type that in,...
kai's user avatar
  • 27
0 votes
0 answers
31 views

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 ...
Hello's user avatar
  • 1
-1 votes
1 answer
52 views

How to use Python multiprocessing library in a chess search algorithm?

I am currently working on a chess engine, and I am looking at parallelization as a way to optimize the time it takes to search legal moves to find the best one. I found the Python module ...
kiraksi's user avatar
-1 votes
1 answer
72 views

How to give a board indices algebraic notation?

board = [ ['|__|', '|__|', '|__|', '|__|', '|__|', '|__|', '|__|', '|__|'], ['|__|', '|__|', '|__|', '|__|', '|__|', '|__|', '|__|', '|__|'], ['|__|', '|__|', '|__|', '|__|', '|__|', '|__|', '|__|', '|...
Justin Young's user avatar
0 votes
1 answer
54 views

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 ...
Kevin Mai's user avatar
0 votes
2 answers
27 views

Tensorflow CNN output as a matrix of a different shape than the input matrix

I have prepared myself a dataset of chess games which contains of features represented by 6x8x8 tensors (6 layers each one is a board representing a chess piece in both colors). The labels in the ...
milosz7's user avatar
  • 23
0 votes
0 answers
71 views

Chess UCI get position as FEN

Trying to code a chess engine for the first time. I have connected my engine to the cutechess GUI cutechess. Currently my engine is receiving the current position from cutechess as something like: ...
Cam's user avatar
  • 21
0 votes
1 answer
44 views

chess.js - unable to make a move using the permissive parser

I can only make moves using the SAN and object notations. The permissive parser doesn't work. I tried using the { permissive: true } option but it doesn't seem to do anything. Did I miss something? ...
Ituriel's user avatar
  • 75
0 votes
0 answers
59 views

Alpha Beta Pruning causes negamax to choose poor moves

I am setting up a basic chess AI using negamax and alpha beta pruning. If I remove alpha beta pruning, then it works as expected. After adding in pruning, it plays worse moves (but much faster). ...
Dylan Wolf's user avatar
0 votes
0 answers
40 views

How to add transposition table to Negamax?

I've recently been improving my Negamax algorithm for chess, adding a transposition table. The algorithm was working well before this addition. After this addition I can't see no big improvements in ...
SKAE's user avatar
  • 85
1 vote
0 answers
100 views

Chess Bot not playing to expected level - Monte Carlo Tree Search

I am creating a chess bot for Sebastian Lague's "Tiny Chess Bots" competition. It is using Monte Carlo Tree Search with Upper Confidence Bounds, and the issue is that it is playing very ...
Jakub Skop's user avatar
0 votes
0 answers
23 views

How to make the background color not to stick to the background Image when dragging?

I am making a chess game on React, and tried to add a drag and drop functionality to the chess pieces, the problem is that the background color style applied to the parent div sticking to the child ...
dervaken's user avatar
0 votes
0 answers
49 views

MiniMax algorithm breaks at any depth greater than two

I'm trying to implement a chessbot and i've been struggling with the following MiniMax function: int MiniMax(Board board, int depth, bool maximizingPlayer, int alpha, int beta) { if (...
Gioloh's user avatar
  • 13
1 vote
1 answer
28 views

How to fix LegalMoveGenerator "LegalMoveGenerator object is not callable" error in python-chess?

I am trying to make a chess Minimax algorithm. However, I encountered a problem. This is my code: import random import itertools from chess import Board, Move, LegalMoveGenerator def ...
hakdjhfkajhfe's user avatar
1 vote
0 answers
79 views

How to get number of moves in chess 3x3 [closed]

I'm new to python, I'm currently making a program that will take input from the user, which will have the positions of the chess pieces in a 3x3 chessboard, and I'm trying to find the steps it took to ...
Michael's user avatar
  • 11
0 votes
0 answers
63 views

Method to work with bitwise isolated "1s" from an unsigned long long in C++, works in C# but creates strange results in C++

I'm transferring my chess engine from C# to C++ to get a higher performance. I am using bitboards (unsigned long long's) for each chess piece, representing where they are located. So when looking ...
Paul's user avatar
  • 41
0 votes
1 answer
32 views

How do you create a unique key within a 2D array using React and JavaScript for a chessboard

I am new to building applications and coding, as a side project I am trying to make a chessboard with react and JavaScript. I am currently stuck trying to figure out a way to make a unique id key ...
dmc's user avatar
  • 15
1 vote
1 answer
68 views

Strange error when bit shifting uint64_t by a uint16_t in cpp

The function below is attempting to create a bitboard with the set bit being in the Nth position, by bitshifting 0x1 N times to achieve desired result. N is being given by the 1-6th least significant ...
Michael Haney's user avatar
1 vote
1 answer
101 views

Fastest way to generate magic numbers

I have some idea of how the magic bitboard works, really it just lessen the amount of bits on a certain occupied bitboard and to convert the already available to save occupied bitboard to a smaller ...
anata0's user avatar
  • 11
1 vote
1 answer
82 views

Pieces Moving Under Cells with Offset Animations in Jetpack Compose

I am implementing a chess game using Jetpack Compose in Kotlin. The chess board has 8x8 cells, and I have both white and black pieces. When white pieces are moving from the bottom towards the top, ...
Royss's user avatar
  • 13
0 votes
1 answer
90 views

Displaying imagebuttons on screen

I am trying to create a chess app in C# using Xamarin.Forms. Right now I am trying to implement the functionality of highlighting and moving pieces. I made code which should display every possible ...
pakaccio's user avatar
1 vote
1 answer
39 views

Sequential game but cannot apply Minimax

I am trying to create a 2-player Atlas game bot along the lines of chess bots by using the Minimax algorithm. I am using a database of just countries and capitals to induce strategy in the game. There ...
Pavan Alva's user avatar
0 votes
1 answer
67 views

What would be a good way to write a function that returns a random chess game played by two masters as a PGN file?

I am trying to create a function that returns a random master chess game as a .pgn file. The approach I have taken was I have downloaded the caissabase chess database which is quite large and contains ...
Curtis's user avatar
  • 253
-1 votes
2 answers
54 views

Need ideas for Chess Non-Random move response in Python

I'm trying to work out in Python (Pygame) how to make black play a pre-programmed line of moves in response to what white plays (like playing through a past player's game, or playing opening lines ...
Borispolking's user avatar
0 votes
2 answers
124 views

(Contest problem) Count the number of squares that are not attacked by bishops

My solution is in below. The bishop in chess is a piece that attacks all squares on the same diagonal (on both diagonals). Shakhriyar placed m bishops on a chessboard of size n * n. Now he wants to ...
Isa's user avatar
  • 55
0 votes
0 answers
49 views

How to test implementation of alpha beta pruning?

I'm working on a chess engine and have implemented Negamax with alpha beta pruning. I have noticed that fewer nodes are being searched (depth 5 in the starting position goes from 4,865,609 to 701,028 ...
Gwoodz's user avatar
  • 23
0 votes
1 answer
52 views

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 ...
ReliableAirRepair's user avatar
0 votes
1 answer
50 views

How can I make my Python program communicate with an .exe file to run a specific command line upon startup?

I am working on a project whereby I have to link Leela Chess Zero to the backend. However, I do not know how to do so. The following is my file, where lc0.exe is the exe file for Leela Chess Zero. ...
AlphanumericUsername's user avatar
0 votes
0 answers
23 views

Trouble implementing nested submenus and options in Chess Bot UI on CodePen

I am working on a Chess Bot project and struggling with the UI implementation in a CodePen project. Here is the link to the CodePen: https://codepen.io/tag4-21/pen/jOeojXW The main issue I'm facing is ...
EnVy's user avatar
  • 1
0 votes
1 answer
92 views

python - EXTREMELY low accuracy (<1%) on homemade chess engine

I am into chess. And no, I do not plan on using this engine for cheating. Right now, it has less than 1% accuracy. No doubt am I better than it. It generates the correct syntax I want it to generate, ...
DevBev3's user avatar
0 votes
1 answer
94 views

Wait for user mouse click in each while loop iteration

I am trying to build a chess game with a GUI interface using Java's Swing library. When I start the game, a window with the chess board opens. What I'm stuck on, is that each time, I want to wait for ...
nortain32's user avatar
0 votes
1 answer
72 views

chess program and check for legal moves doesn't work and always returns that the move is illegal even if it is

import chess board = chess.Board() print(board) legal_moves = list(board.legal_moves) while True: move = input ("type a legal move: \n") if move in legal_moves: board.push_san(move) ...
Duel_Clip's user avatar

1
2 3 4 5
28