Chess is a strategic game played with two players on a checkered grid. This tag is for challenges related to chess or any derivative of it.

learn more… | top users | synonyms

24
votes
12answers
2k views

Tell me the moves

Jack and Jane decided to play a game of chess to while away time. Unfortunately, Jack is rather bad at visualizing. He finds it tough to figure the moves possible for a given piece other than a ...
14
votes
3answers
833 views

king + rook vs king

It's the ending of another well played chess game. You're the white player, and you still have a rook and your king. Your opponent only has his king left. Since you're white, it's your turn. Create a ...
20
votes
11answers
1k views

Smallest chess board compression

Write an algorithm or program that can encode and decode a chess board. The goal is to make the smallest representation of a chessboard that could be used (once decoded) to determine all movement ...
5
votes
7answers
356 views

n-queens problem, displaying more than one solution available

as some of you may know, n-queens problem is a set of algorithm puzzle that given a 'n x n' where n is the board size of a (let's say) chessboard, and the main goal is for the n queens (where n is the ...
2
votes
0answers
307 views

Simple chess bot

Inspired by this Implement simple chess bot (with console or GUI) that has following features: [Pseudo-]graphically showing the board; Accepting user moves and making their own moves; Playing by ...
5
votes
7answers
310 views

Chess960 position lookup

This is a follow-up to Chess960 position generator. In Chess960, there are 960 possible starting positions that can be enumerated from 0 to 959 (or, at your choice, from 1 to 960). The enumeration ...
10
votes
6answers
589 views

Chess960 position generator

Context Chess960 (or Fischer Random Chess) is a variant of chess invented and advocated by former World Chess Champion Bobby Fischer, publicly announced on June 19, 1996 in Buenos Aires, ...
4
votes
9answers
596 views

Eight Queens Obsfucation

You've probably heard of the classic Eight Queens Puzzle. For those of you who haven't it goes something like this: Position 8 queens on an 8×8 chessboard so that no two queens threaten each ...
6
votes
6answers
589 views

Neustadtl score

Write the shortest function that takes a two-dimensional square array representing the scores of a chess round, and outputs an array of the Neustadtl scores of the players. The two-dimensional array ...
5
votes
0answers
366 views

chess - calculate all legal moves from fen string ignoring castling and en passant

Write the shortest code that calculates all possible (legal) moves of current player from a given FEN string. What is FEN string? (Wikipedia) Shortest code wins, language doesn't matter. Output ...
5
votes
1answer
346 views

The smallest Chess arbiter

Write a program, which, upon gazing at a chess table, can say whether there is a check or a checkmate. Input: a chess table in text form, the last line of the input being the first rank (the starting ...
5
votes
4answers
1k views

A simple Knight's problem

How many ways are there to place a black and a white knight on an N * M chessboard such that they do not attack each other? A knight can move two squares horizontally and one square vertically, or ...
1
vote
7answers
649 views

Knight's tour on a rectangle

Given an a-by-b sized grid, and a chess knight, determine: A starting point and path the knight can take to visit every square in the grid or "NOT POSSIBLE", if not possible. Input: Two integers, ...
10
votes
3answers
865 views

Play a valid chess move, given a board on stdin

The program plays white. Example stdin: 8 ║♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜ 7 ║♟ ♟ ♟ ♟ … ♟ ♟ ♟ 6 ║… … … … … … … … 5 ║… … … … ♟ … … … 4 ║… … … … … … … … 3 ║… … ♘ … … … … … 2 ║♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙ 1 ║♖ … ♗ ♕ ♔ ♗ ♘ ♖ ...
3
votes
2answers
343 views

Build a working chessboard

The challenge Create a program that mimics a chessboard. The datails The chessboard must be surrounded by the labels of each row and column, being the columns labeled from 'a' to 'h' and the rows ...
2
votes
1answer
673 views

Determining the winner of a Chess game

Challenge Being someone who plays far too much chess in his spare time, I thought I'd set a code golf challenge inspired by the game of chess (with a software flavour), for those interested. The ...
3
votes
1answer
374 views

Set the chessboard

Objective Given an arbitrary chessboard as standard input (in which each piece is on a square), produce as standard output a list of moves needed to regularize, or set up, the chessboard. The moves ...
16
votes
1answer
794 views

Chess endgame: White to Mate In One

Given an 8x8 grid of letters representing the current state of a game of chess, your program's task is to find a next move for white that results in checkmate (the answer will always be mate in one ...
2
votes
2answers
239 views

How many squares are guarded by chess queens?

Today marks the 15th anniversary of Garry Kasparov's defeat against Deep Blue. Speaking of chess... Input is a string that represents an 8x8 chess board containing only empty squares (.) and queens ...
6
votes
4answers
1k views

N-Queens problem

In chess, a queen can move as far as as the board extends horizontally, vertically, or diagonally. Given a NxN sized chessboard, print out how many possible positions N queens can be placed on the ...