# Questions tagged [chess]

This tag is for concepts involving the game of Chess.

126 questions
179k views

### Design a chess game using object-oriented principles

I would like to know if my approach is correct and how could it could be improved? Also, is there a way to get rid of the relation between the Piece and the ...
2k views

### Enum, constants, or other to represent chess pieces

I'm learning C# and I decided to write a chess program to help me practice the concepts I'm learning in my book. I started the Board class tonight, which is going to handle 1) the board state and 2) ...
46k views

### Chess game in Python

I have programmed for 2 months, and I began writing a Chess game. I am a beginner programmer in Python, so please assess my code. ...
4k views

### Simple Chess Game, Part 2: The Pieces

As I was writing my first part of my Chess question, I realized that I couldn't fit all my code into one question (I exceeded the character limit), so I will continue here. The pieces all share the ...
14k views

### Simple Chess Game, Part 1: The Board

I am currently creating a chess game, and have so far done the board. The board is pretty much a two-dimensional array, where Pieces are stored in their positions. ...
2k views

### N-Queens - Brute force - bit by bit

A discussion in The 2nd Monitor made me realize I had never 'solved' the N-Queens problem. Additionally, as I read up on it, I realized that the 64-squares in a chess board would work well if ...
1k views

### Yet another piece of Chess software

I've written a piece of chess software which does some validation checks (check, checkmate etc). I've not implemented some of the more exotic Chess moves (e.g. rooking, en passant, promotion). I've ...
355 views

### Grand Chess domain model and helper functions

So I am trying to write, essentially from a blank slate, a program that plays Grand Chess. In short, it is a chess variant that is played with two extra pieces, on a 10x10 board, no castling, and ...
4k views

### Chess application in Java

This is my very first project in java. I would love some feedback on my design. How the same implementation can be better written. Idioms, conventions, anything that comes to your mind. I hope I have ...
2k views

### Hackerrank Queen's Attack II

Problem statement A queen is standing on an $n$x$n$ chessboard. The chessboard's rows are numbered from $1$ to $n$, going from bottom to top; its columns are numbered from $1$ to $n$, ...
572 views

### N-Queens functional

I'm trying to get a better grip on the new functional possibilities of Java 8. As an example, I took this very elegant Haskell snippet: ...
4k views

### Chess engine in C++

I'm looking for experienced honest feedback on my chess engine. I don't know what you'd be looking for, but my goal is to become a better programmer. board.h ...
279 views

### Python Chess Game

I'm developing chess in python, and I've decided to make everything text-based before creating a GUI because it'd be my first time doing the latter. I haven't got around to the actual gameplay, but I'...
1k views

### Object-Oriented Chess Game in Ruby

I wrote a chess game in Ruby using object-oriented principles. One of the challenges was deciding which particular methods/actions belonged to a particular class, as there were some that felt as if ...
61 views

### Ruby chess engine gem

This is my first Ruby gem that claims to provide all the rules of the chess game. My goal was to keep this library as simple as possible via OOP principles, and I'd be glad to hear any feedback from ...
869 views

### First Chess project

I'd made a project using pygame in python around 3 months ago. This was my first big project after I started learning how to program in college. Now I'd like to know just how good my programming ...
2k views

### Chess Architecture

I am currently developing a chess game but have made the mistake of putting all my Java code in one .java file. I need help cutting up my code into more manageable chucks. Could someone show me how ...
478 views

### Function to test whether the source and destination squares represent a valid knight move

The following is my solution to a problem. While it works - I want to learn how to optimize this in a much better way (I'm new to C++). My original idea was the use a ...
129 views

### Game of Runes: a similar concept to chess

I have created a game called 'runes' in C. It is similar to Chess, but has a bigger board and different pieces. I would like to know how I can improve the code, for example, by adding proper error ...
143 views

### Queens placement

The code below is intended to be a learning material for high school intermediate programming class, as an introduction to recursion and backtracking. I was thinking of rook placement and found it too ...
150 views

### Finding a checkmate with two bishops using Python

I've written a Python program to find the fastest way to a checkmate from a starting position. The stronger side has a King and two Bishops, and the weaker side has just a King. The weak King always ...
2k views

### Chess Game in python

I started to try my hand at making a Chess Game. It works as a game, but I know this certainly not the most efficient way of doing it. I'm just looking for advice and critique on how to get better. ...
399 views

### Checking if a Chess space has been attacked

I have this list of at least seven else-if. When their condition is met, I change the same boolean is_attacked to ...
10k views

### Knight moves in Chess game

I am trying to learn Java by doing some (easy) ACM ICPC problems. The problem consist to check if the knight in a chess game can move from a point A(r1, c1) to <...
116 views

### Game of Runes: revised version

I have created a game called Runes in C. It is similar to Chess, but has a bigger board and different pieces. I would like to know how I can improve the code, for example, with user interface ...
622 views

### UVA 750: 8 Queens Chess

In chess it is possible to place eight queens on the board so that no one queen can be taken by any other. Write a program that will determine all such possible arrangements for eight queens given ...
2k views

### N-Queens Recursive Implementation in C++11

I created a recursive, optimized, N-Queens implementation in CPP. Any suggestions for improvement? ...
449 views

### Python program to calculate what pawns are safe

In chess there are eight rows numbered from 1 to 8 and 8 columns a-h. Pawns which are on the lowest row are always in danger to be captured. The objective of the program is to calculate which pawns ...
264 views

### PHP Chess Version 2

For programming practice, I created a chess program in PHP (my most comfortable language). The program reads a FEN (a string with the location of all the pieces on the board) from the URL, generates ...
561 views

### Python: Pawn race

Another day, another Chess related CodeFights problem. Pawn Race Pawn race is a game for two people, played on an ordinary 8 × 8 chessboard. The first player has a white pawn, the second one - ...
4k views

### Minimum number of moves for a knight

The problem is to find the minimum number of moves that a knight will take to go from one square to another on a 'n' cross 'n' chessboard. The code below is based on backtracking. It works well until <...
29k views

### Generating possible Chess moves

Here is the solution to generating possible moves and keeping the king safe. If someone is willing to look it over and come with some suggestion to perhaps improve it, I would appreciate it. Full ...
368 views

### Beginner's Knight's tour in Python (BFS)

I wanted to implement this as short and effective as I could without using anything that is not basics, in order to improve my skills. I would appreciate input about things like memory leaks I missed,...
6k views

### Enumerating moves for a chess piece

I'm just at the beginning stages of making a simple chess engine. I have a function that when passed the x and y coordinates on a 2D list can enumerate all possible moves for a piece. It assumes there ...
274 views

### Unicode Chess PvP with Move Validation

Main Purpose This script allows two players to play chess on a virtual chessboard printed on the screen by making use of the Unicode chess characters. Visual appearence ...
1k views

### First chess game

I am just new to programming I just have a 2 month experience in programming and a 2 week experience with python. This is my chess game written in python with pygame. Can some one help me how can I ...
2k views

### Really fast Knight's Tour using concurrency and Goroutines

In less that 5 seconds on a normal PC, I found the answer in simple brute-force. Before I met Go, I didn't believe that it will be so easy to use all the power of the PC by using Go Goroutines for ...
9k views

### Chess game in Windows Forms Part #1

I've recently created my own 2-player chess game, no AI... at least for now. I do plan to do that in the future, so one of my concerns is if the code is flexible enough to just use the same classes ...
2k views

### Chess game in Python - follow-up

Three weeks ago I wrote the first version of my chess game in Python and shared on Code Review. Thanks to your suggestions, I improved my code. I would like to know if I am going in good direction ...
606 views

### Python Amazon Checkmate

Found this challenge on CodeFights and would love a review of my style. Description An amazon (also known as a queen+knight compound) is an imaginary chess piece that can move like a queen or a ...
1k views

### 2 player chess game in C++

I have written a 2 player chess game in C++. Things I have accomplished so far: Legal moves validation Bit board generation Things I look forward to (would appreciate advice on them): Move ...
705 views

### Genetic Algorithm for N-queens is very slow

Using Genetic Algorithm to solve N-Queens problem where N=22. My program is functional and is capable of solving N-Queen problems up to around where N=15, but everything after that is absurdly slow. ...
2k views

### OOP Chess design job interview practice

please comment on game flow, Solid principle and OOP concepts. ...
355 views

### Chess puzzle improvement

Is it possible to optimize this solution to the N-queens puzzle? ...
248 views

### Find total of non-attacked positions in a Chess board - UVA 10284

The input is until EOF, give in the FEN notation. The output should be the count of non-attacked positions. My code passes in all test cases in uDebug, but it doesn't pass on the hidden cases. All ...
870 views

I built a chess game in C++. My main concern is the design. For example, in the board class it has a 2D array of pieces. This array represents the positions of the pieces, but the piece class also has ...
1k views

### Optimizing this Knight's Tour

My assignment in CS was to make a knight's tour application that could solve the problem from any starting position. I had just finished the code so excuse the lack of deeply descriptive comments. My ...
809 views

### Algorithm to say if win or lose using player's rating and randomness

I wrote a small simulator to understand the Elo rating system. I can create players, matches and tournaments, and I want to be able to predict the match ending depending on the rating of each player ...