We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [chess]

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

Filter by
Sorted by
Tagged with
28
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 pawn,...
8
votes
1answer
683 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 ...
-2
votes
7answers
1k 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, <...
24
votes
9answers
2k views

Chess Tournament

This is a chess-KOTH with simplified rules (because chess itself is already complicated, playing it via a simple program doesn't make it easier). At the moment it is limited to java (version 8), but ...
59
votes
77answers
10k views

Determine the color of a chess square

Your challenge is to write a program that outputs the color of a given square from the chessboard. This is how a chessboard looks: You can see that the square a1 is dark, and h1 is a light square. ...
18
votes
4answers
4k views

Smallest chess program

Inspired by this recent article telling of a French programmer who wrote a 487 byte 2-player (human vs. human) chess program in Assembly, I wondered how small chess programs could be in other ...
19
votes
6answers
2k views

Chess - Find all legal moves (except 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 ...
12
votes
4answers
2k views

Shortest path for a chess knight

Your program should compute the number of moves it takes a chess knight to reach each square of the chess board. The input will be two space-separated integers representing coordinates of the ...
11
votes
6answers
889 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, Argentina. ...
14
votes
1answer
676 views

Is it a valid chess move?

Alternate name: ChessMoveQ Given a list of up to 32 elements, each consisting of 4 elements, and a second list with 4 elements, determine whether the move detailed ...
11
votes
3answers
1k views

Play a valid chess move, given a board on stdin

The program plays white. Example stdin: ...
23
votes
3answers
2k views

The Path Of The Wildebeest

Golf a program or function which gives the \$n^{\text{th}}\$ location of the wildebeest who starts at square \$1\$ on an infinite chessboard which is numbered in an anti-clockwise square spiral, where ...
19
votes
1answer
683 views

Seeking Leapers

I recently got a really weird irregular chess board. It's squares are all over the place and not even all connected. At least they're still laid out on a regular grid. I want to adapt the chess rules ...
39
votes
16answers
6k 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 ...
48
votes
17answers
5k views

Knight on the Rim is Grim

Introduction Aron Nimzowitsch was a leading chess master and a influential chess writer. In his book 'My System', the first chapter deals about the importance of the center and why you should ...
23
votes
2answers
780 views

Escape a chessboard

You find yourself on a chessboard, as one does. You can see the exit but it is awfully far away and you would rather not walk all the way. Luckily some locals have offered you a ride. A Knight, a ...
19
votes
1answer
2k 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 ...
17
votes
14answers
688 views

Evaluating the score based from a chess FEN string

Challenge Forsyth–Edwards Notation (FEN) is a standard notation for describing a particular board position of a chess game. Your challenge is to evaluate the score using the FEN string. This is an ...
10
votes
4answers
584 views

Too many pawns on a chess board

Given an integer 2n, find the number of possible ways in which 2n^2 black pawns and 2n^2 white pawns can be arranged on a 2n by 2n chess board such that no pawn attack another. A black pawn can ...
6
votes
0answers
984 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 ...
15
votes
1answer
364 views

Chess conversion

There's quite a lot of work that's been done in the world of chess. For example, there is a standardized file format, .pgn, that describes a chess game, including ...
9
votes
4answers
2k views

N-Queens problem [closed]

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 ...
17
votes
12answers
1k views

N-Queens Puzzle

(Despite 60+ questions tagged chess, we don't have a simple n-queens challenge.) In chess, the N-Queens Puzzle is described as follows: Given an n x n chessboard ...
8
votes
1answer
267 views

The knight's next tour

We've all heard of the Knight's Tour puzzle: find a route for a knight that passes through all the squares on a chess board. But let's be honest, it's a little bit boring. So, let's give the knight a ...
15
votes
4answers
543 views

Peaceable coexisting armies

In the game of chess, there is piece called the queen that may attack any other piece that is on the same row, column or diagonal. In chess there are typically two sides, black and white, with each ...
7
votes
5answers
3k 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 ...
7
votes
10answers
584 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 ...
2
votes
0answers
246 views

Write the shortest code that bring to a solution of “The old curious knight with a lazy horse” problem [duplicate]

The Story: Once upon a time there was a curious Knight that lived on a never used chessboard in the Realm, an antique store. He spent all his career over there and when it came the moment of the ...