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

How do i shorten the code in Pascal if I have one part repeating in multiple if functions?

i started learning Pascal on my own and i want to create a program where i will calcualte the number of possible moves for a horse to make in 2 moves if i know it's starting possition. So i know how to do it, first i calcualte if it's possible to…
-2
votes
1 answer

How to programm the AI for a chess game

I am considering making a chess game for android apps. The only thing I don't know how to do is write code for the opponent AI or how it even works. Do I have to write the code for the AI from scratch or are there packages that I can just implement?
user2817240
  • 195
  • 1
  • 5
  • 13
-3
votes
1 answer

How do I see if a chess piece can move to block a check?

I'm working on a chess bot for a personal project (in Java) and for the life of me, I can't figure out how to see if a piece can block a check. Here is the setup: Board: Holds a 2d array of Squares, all of the Squares on the Board, and all of the…
deprexit
  • 7
  • 2
-3
votes
1 answer

How can I fix a java.lang.OutOfMemoryError exception?

Ok, so I´m trying to make a chess game, primarily a terminal based one. I´m first trying to code possible moves a piece can make according to it´s type, like rook, queen, u know how chess works. But, this java.lang.OutOfMemoryError appears everytime…
-3
votes
1 answer

Command Line Issue for uci-analyser chess program

I'm currently trying to use uci-analyser found at this link: https://www.cs.kent.ac.uk/people/staff/djb/uci-analyser/ I'm trying to run it on Ubuntu 21.0 impish. Used the source file. Confirmed C++ compiler and confirmed installation by going with…
hangejj
  • 97
  • 3
-3
votes
1 answer

Python: modifying a value in one dictionary changes another dictionary

I'm making a chess program on Python by using dictionaries, and to set up my board I do: EmptyBoard = { 8:['☐','☒','☐','☒','☐','☒','☐','☒'], 7:['☒','☐','☒','☐','☒','☐','☒','☐'], 6:['☐','☒','☐','☒','☐','☒','☐','☒'], …
youssef
  • 13
  • 4
-3
votes
1 answer

Given an N x N chess board and a White King that can move one step in only two directions: right and up

Given an N x N chess board and a White King that can move one step in only two directions: right and up. (Assume that the King is at the bottom left square in the starting position). Moreover, once the King starts moving, it can change direction…
An Nam
  • 1
-3
votes
1 answer

Chess Game in C - Some Pieces are not moving

I am making a chess game in C. It needs to be strickly c. But my chess pieces are not responding to movement as they should. The movement of the pieces is defined by coordinates. I think the problem should be in this function: // função mover peça…
Diana Moura
  • 31
  • 11
-3
votes
1 answer

Merging lines in chess ply sequences

I have a file containing the ply sequences of multiple chess games. Games are separated by one or more new lines and the corresponding ply sequence of each game can be also split into multiple lines. I would like to merge all lines corresponding to…
-3
votes
2 answers

How to initialize bitboards in c++?

I've pored over the chess programming wiki on bit-boards, but i'm still struggling with how i'm supposed to actually create them. From what I've gathered they're supposed to be a uint64_t right? Sometimes I see them represented as long hex looking…
Max C
  • 369
  • 5
  • 16
-3
votes
2 answers

Interact with GUI Elements of a Windows Application

First of all, I want to appreciate the work for the SCIDvsPC Project. I know that the basic SCID one has been discontinued many years back and the developer have done a great job with expanding it and doing his share for the Chess Field. We have a…
Baahubali
  • 163
  • 3
  • 14
-3
votes
2 answers

warning: control may reach end of non-void function [-Wreturn-type] }

I am a beginner in c++ and I am trying to make a chess game and when I compile : bool isValidMove(int inCol, int inRow, int outCol, int outRow, char board[8][8]) { if (board[inRow][inCol] == '-') return false; else { …
Ian
  • 687
  • 3
  • 8
  • 17
-3
votes
1 answer

How to recursively get the number of elements until reached all squares in 5 x 5 grid in scala

I have a grid 5 x 5 grid. And my initial position is at (0,0) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 0 0 0 0 I have a method that finds all possible position in 'L' shape from that position So from (0,0). So either ( x + 2 )( y + 1 ) or ( x…
-3
votes
1 answer

How to make a chessboard in C?

I am new to C and I am trying to make a program that would output a chessboard pattern. But, I don't understand what my next steps are going to be . Could anyone help me with this? Main: #include #include #include…
Shamveel Ahammed
  • 266
  • 2
  • 3
  • 12
-3
votes
1 answer

Do-While loop is exiting prematurely

I tried writing a PvP Chess program. However, when an invalid move is played, it ends the turn. do { boolean q = askMove(board, white , in); if (q == true){ white.move = false; …