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.

Chess is a strategic, symmetrical board game with the goal of placing the opponent's leader piece, known as the King, under attack from one of your pieces such that they are unable to avoid being captured by the next turn. This is known as being placed in "checkmate".

Computer chess engines have become increasingly complex since the early 2000s when they became able to beat the world's leading chess grand masters. Some of the leading chess engines as of 2022 are the opensource Stockfish and Google's AlphaGo.

One might presume that due to the deterministic nature of chess it might be possible to "solve" the game such that a victory or draw would be guaranteed. However, due to the enormous number of possible variations in Chess it remains unsolved even by the most advanced chess engines.

Some current popular evaluation methods used are the Monte Carlo tree search and Minimax search.

External links

1386 questions
-2
votes
1 answer

ZeroDivisionError: division by zero in chess.py

I have created an chess seeing video and when it completes i got an error ZeroDivisionError: division by zero my whole code: https://onlinegdb.com/HJR_9t2nD board = [ ['Rb', 'Nb', 'Bb', 'Qb', 'Kb', 'Bb', 'Nb', 'Rb'], #8 ['Pb', 'Pb', 'Pb',…
-2
votes
1 answer

About C, C# and Unity compiling time

If I write a library for chess ai in C or C++ and I used in Unity with C# then is this library compiling fast like in C or slow like in C#. For example; There is a code compiling in C 7secs and C# 1min. So, what will I see in Unity? (F. Sorry for my…
Bahattin
  • 25
  • 5
-2
votes
1 answer

Backtracking and chess

There's a chess field N*N where some black figures are already presented. Find the minimum of white queens that you need to put in the field so they can beat all black figures. Using backtrack-algorithm. Firstly, I put all the possible queens to the…
user13353974
  • 125
  • 7
-2
votes
1 answer

Condensing multiple while loops

I am undertaking the (somewhat ambitious) project of writing a chess game to be played in a Mac Terminal, using algebraic notation inputs to effect the moves. I have written my board as a list of lists, with each nested list serving as a rank…
-2
votes
1 answer

How to attach an object of any type to a JButton in java?

I'm currently creating a GUI for a Chess game. It's a college assignment. Currently, We've finished the engine. So, for the board, I've created a 2D array of JButtons with the code below. public class GUI extends JFrame implements ActionListener…
JayJay199
  • 1
  • 2
-2
votes
2 answers

How do I structure my program to avoid having to query for the types of objects?

I'm new to programming, and as one of my first projects that is unguided by a tutorial, I'm implementing a chess program. The way I have it structured now, there is a base class called Piece, and each kind of piece is derived from that base class.…
Alex Kindel
  • 173
  • 7
-2
votes
1 answer

Java/Chess Odd Gui Bug

So I have absolutely no clue why this doesn't work-- but the GUI doesn't respond to anything inside the getMove(GameState gameState) method. Even with a sleep to pause it after I make the move-- it simply does not show anything. Any help would be…
thePanthurr
  • 104
  • 1
  • 9
-2
votes
1 answer

check if 2d array of string forms a chess board pattern

Given an N array of strings of N length, return the minimum number of character changes required to create a chessboard pattern (a change means replacing characters). for instances ["ab", "ba"] --> 0 ["aba", "bac", "aba"] --> 1 i am really lost,…
Antonia Calvi
  • 127
  • 1
  • 3
-2
votes
1 answer

C++ Builder - Moving a chess piece on board moves the next piece

I've got a problem. I have a chess game and I wanted to make my pieces move random on board. I don't know why, but when I move a piece, the next piece moves, so I wrote move(piece-1). In that case, only the first piece can't move. How to solve…
-2
votes
1 answer

Image flickering when moving a piece in chess game #c .visual studio 2010

I've been searching regarding to this problem but i can't make it work :( here's my code : using System.Drawing; namespace Chess.Source { public sealed class GraphicsBuffer { private Graphics graphics; private int height; …
-2
votes
1 answer

Chessboard GUI 2D View

I would like to create a 2D chessboard representation for the GUI of my chess game with Tkinter. I programmed this code but it doesn't display the chessboard, it just displays the grey background. There is no indentation problem. What's the problem,…
titi157
  • 157
  • 4
  • 12
-2
votes
2 answers

Design a Chess game (using OOPS and Java Design Pattern)

Can someone help me build a chess game from the scratch using Java OOPS and Design patterns concepts. A rough model is enough. Are there any links/blogs for this?
fnaticRC ggwp
  • 955
  • 1
  • 11
  • 20
-2
votes
1 answer

Java: Chess - Moving a piece

I would like to move the piece using my mouse. For example, say there's a pawn sitting on a square on the chess board. If my mouse was to click (press and release) in the square that the pawn is in, it would be selected. Afterwards, I would click…
-2
votes
1 answer

Can someone help me fix "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7" error?

I am fairly new at java programming, and i haven't come up with this error before. I will accept any and all advices,so if you know anything about this please help. package proba; public class Kraljica2 { public static void main(String[] args)…
-2
votes
1 answer

Chess in Python: list indices must be integers, not str

I wrote early version of chess in python. I have a problem with this: File "C:/Users/Goldsmitd/PycharmProjects/CHESS/chess_ver0.04.py", line 39, in move self.board[destination_x][destination_y] = 1 TypeError: list indices must be integers,…
Rafail
  • 149
  • 1
  • 1
  • 4