Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chessattack logo
Chess Attack
The 5x6 chess gameboy game that we deserve
Chess, but small enough to fit in your pocket — and on a Game Boy cartridge.


Load the .gb file into an emulator


Chess Attack is chess with the waiting taken out. Same pieces, same rules, same instincts, on a board of 30 squares instead of 64. There are no long quiet openings here: the armies start close enough to touch, so the fight begins on move one and a whole game fits into a bus ride. If you know how to play chess, you already know how to play this.

Screenshots

title-quote menu-play-white menu-play-black menu-difficulty

new-game select-pawn-moves queen-legal-moves long-play

castling-available castling-done pause-menu game-over

Where it comes from

Chess Attack isn't something we invented. It's a real game, made in 2008 by the Norwegian designer Werner Kling and published in a box by Yes Games, meant for children learning chess on a board small enough not to be daunting.1 It found some distinguished players anyway: it was promoted by Magnus Carlsen, Simen Agdestein and Alexandra Kosteniuk — a world champion, a seven-time Norwegian champion, and the women's world champion of that same year.2

The Norwegian Wikipedia article puts the appeal well: Chess Attack is immediately in the endgame once the first piece has moved.1

This project is that game, brought to the Game Boy — the whole thing in a 32 KB cartridge, with an opponent to play against, a clock ticking on each side, and a chiptune to lose to.

The pieces

Each player gets a King, a Queen, a Rook, a Knight, a Bishop and five Pawns. Sixteen pieces have become nine, and every one of them matters.

They line up the way you'd expect. From White's left: rook, knight, bishop, queen, king, with the five pawns standing in front of them.

    a  b  c  d  e
 6  r  n  b  q  k     Black
 5  p  p  p  p  p
 4  .  .  .  .  .
 3  .  .  .  .  .
 2  P  P  P  P  P
 1  R  N  B  Q  K     White

Files are lettered a to e from the left and ranks numbered 1 to 6 from White's side, so every square has a name — c6 is the square on the c-file, sixth rank.

The rules

They are the rules of chess. That's the whole point of the game: nothing new to learn, just less board to learn it on.

Every piece moves as it always has. Pawns step forward one square, or two from their starting rank, and capture diagonally. En passant is there. Castling is there — with only one rook each, the long castle is the only one available, so the king crosses to c1 and the rook hops over onto d1. A pawn reaching the far rank promotes.

White moves first, and you must move — you can never pass.

You may never leave your king to be taken. Move into check and the move simply isn't offered; if you're in check already, the only moves you'll be given are the ones that get you out.

How a game ends

Checkmate. In check, with nothing legal to play. That's the win.

Stalemate. Nothing legal to play, but not in check — a draw, and the cruellest way to throw away a winning position.

The clock. Ten minutes each. Run out and you lose, however good your position was.

Resignation. Sometimes you can see it coming.

Nothing left to mate with. Bare kings, or a lone king against a king and one minor piece, and the game is drawn — neither side could force a mate however long they played.

Playing it

The title screen asks which colour you want; the page after it sets how deep the engine looks. Move the arrow with the D-pad and confirm with A.

Difficulty Depth Time per move
EASY 2 under a second
MEDIUM 3 about two seconds
HARD 4 around eight seconds, and much longer when it smells a mate

Black's clock keeps running while the engine thinks, exactly as a real chess clock would, so HARD costs the machine real time as well as yours.

Button Choosing a piece Choosing a move
D-pad Move the selector Cycle through the destinations
A Pick up the piece under the selector Play the move
B Put the piece back down and choose again
START / SELECT Open the pause menu Open the pause menu

Pick a piece up and every square it may legally move to is outlined, captures included. Since only legal moves are ever offered, the outlines are also the answer to "am I still allowed to do that?"

Moves are listed down the right-hand side in the usual notation — 3.Pb2-b3 for White, 3...Pa4xb3 for Black, O-O-O for a castle, + for check and # for mate.

Requirements

The ROM is 32 KB, ROM-only, no memory bank controller — it runs on a DMG Game Boy, on anything since, and on any emulator.

Building it needs one thing: GBDK-2020, release 4.5.0 or newer. Download the release for your platform and unpack it. No other dependency — the generated data (pst.h, title_art.h, font.h, song.h) is checked in as finished source, so nothing here needs Python.

The Makefile expects the SDK next to this checkout:

somewhere/
├── chessattack/     <- this repository
└── tools/gbdk/      <- GBDK-2020

If yours lives elsewhere, point GBDK at it — no file needs editing:

make compile GBDK=/path/to/gbdk-2020
Command Does
make compile Builds build/chessattack.gb
make execute Builds and runs it, needs PyBoy (pip install pyboy)
make usage Reports how full each ROM bank is
make clean Removes build/

make execute is a convenience; any emulator will play build/chessattack.gb, as will a flash cart on real hardware, where it identifies itself as CHESSATTACK.

Working on it

board.c, rules.c, movegen.c and engine.c include no Game Boy headers on purpose, so they compile and run on a desktop with clang. The move generator's regression test is perft — walk every legal move to a given depth and count the leaves. From the starting position the answers are 12, 135, 1734 and 20892 at depths 1 to 4; one wrong square anywhere moves the count. There is more on this at the top of movegen.h.

Bank 0 is 95% full, so run make usage after adding anything to it.

Licence

MIT — see LICENSE.md. An independent implementation of the rules of Chess Attack, a game by Werner Kling published by Yes Games; not affiliated with or endorsed by either.

Footnotes

  1. "Chess Attack", Norwegian Wikipedia — https://no.wikipedia.org/wiki/Chess_Attack. Source for the 2008 date, Werner Kling, Yes Games, the game's intent as a first board for children, and the promotion by Magnus Carlsen, Simen Agdestein and Alexandra Kosteniuk. The quoted line reads, in the original, "I motsetning til vanlig sjakk, er Chess Attack umiddelbart i sluttspillet når første brikke er flyttet"; the English above is a translation. 2

  2. "Women's World Chess Championship 2008", Wikipedia — https://en.wikipedia.org/wiki/Women%27s_World_Chess_Championship_2008. Kosteniuk beat Hou Yifan 2½–1½ in the final at Nalchik, 28 August – 18 September 2008.

About

A Game Boy game. Chess Attack is chess with same pieces, same rules, same instincts, on a 5x6 board of 30 squares instead of 64.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages