Skip to the content.

Chess

Overview

Chess is a two-player strategy board game played on an 8x8 checkered board. Each player controls 16 pieces with the goal of checkmating the opponent’s king.

Status: ✅ Available
Players: 2
Difficulty: Hard
Board: 8x8 checkered board (64 squares)

Objective

Checkmate your opponent’s king by placing it under attack with no legal moves to escape.

Rules

The Board

The Pieces

Each player starts with:

How Pieces Move

King (K):

Queen (Q):

Rook (R):

Bishop (B):

Knight (N):

Pawn (P):

How to Play

Step 1: Setup

Step 2: Starting the Game

Step 3: Making Moves

Step 4: Special Moves

Castling:

En Passant:

Pawn Promotion:

Step 5: Check and Checkmate

Check:

Checkmate:

Stalemate:

Step 6: Winning the Game

Win by:

Draw by:

Strategy Tips

Opening Principles

  1. Control the center - Place pawns and pieces in center squares (d4, d5, e4, e5)
  2. Develop pieces - Move Knights and Bishops out early
  3. Castle early - Protect your King
  4. Don’t move same piece twice - Develop all pieces
  5. Don’t bring Queen out too early - Can be attacked and chased

Middle Game

  1. Look for tactics - Forks, pins, skewers, discovered attacks
  2. Control key squares - Outposts for Knights, open files for Rooks
  3. Coordinate pieces - Work together to attack
  4. Pawn structure - Avoid weak pawns, create passed pawns
  5. King safety - Keep King protected

End Game

  1. Activate King - King becomes strong in endgame
  2. Passed pawns - Push pawns toward promotion
  3. Rook activity - Rooks on 7th rank are powerful
  4. Opposition - King positioning in pawn endgames
  5. Calculate precisely - Every move matters

Common Tactics

Implementation Details

Current Features

Planned Features

Technical Implementation

class ChessGame {
  final List<List<ChessPiece?>> board; // 8x8 grid
  final ChessColor currentTurn;
  final bool whiteKingMoved;
  final bool blackKingMoved;
  final bool whiteKingsideRookMoved;
  final bool whiteQueensideRookMoved;
  final bool blackKingsideRookMoved;
  final bool blackQueensideRookMoved;
  final ChessPosition? enPassantTarget;
  final List<ChessMove> moveHistory;
  final ChessGameStatus status;
}

class ChessPiece {
  final ChessPieceType type;
  final ChessColor color;
}

enum ChessPieceType { king, queen, rook, bishop, knight, pawn }
enum ChessColor { white, black }
enum ChessGameStatus { ongoing, check, checkmate, stalemate, draw }

Algorithms Implemented

  1. Move Generation: Calculate all legal moves for each piece
  2. Check Detection: Determine if king is under attack
  3. Checkmate Detection: Verify no legal moves escape check
  4. Stalemate Detection: Verify no legal moves but not in check
  5. Castling Validation: Check all castling requirements
  6. En Passant Detection: Track pawn double-moves
  7. Pawn Promotion: Handle pawn reaching end rank

Chess Notation

Algebraic Notation

Example Game

1. e4 e5
2. Nf3 Nc6
3. Bb5 a6
4. Ba4 Nf6
5. O-O Be7
6. Re1 b5
7. Bb3 d6
8. c3 O-O

Glossary

References