♟️ Chess

Play against the computer!

Turn white
Moves 0

Click piece to select • Click square to move

How to Play Chess

Chess is a classic strategy board game played between two opponents on an 8x8 checkered board. The goal is to checkmate your opponent's king.

Basic Rules

  • Objective: Capture the opponent's king (checkmate)
  • Turns: White moves first, then players alternate
  • Moving: Click a piece to select it, then click where you want to move
  • Capturing: Move your piece to a square occupied by an opponent's piece

How Each Piece Moves

  • Pawn (♙/♟): Moves forward one square (two on first move). Captures diagonally.
  • Rook (♖/♜): Moves any number of squares horizontally or vertically
  • Knight (♘/♞): Moves in L-shape (2 squares in one direction, 1 in perpendicular)
  • Bishop (♗/♝): Moves any number of squares diagonally
  • Queen (♕/♛): Moves like rook or bishop (most powerful piece)
  • King (♔/♚): Moves one square in any direction

Special Moves

  • Pawn Promotion: When a pawn reaches the opposite end, it becomes a Queen
  • Castling: Special move involving king and rook (not yet implemented in this version)
  • En Passant: Special pawn capture (not yet implemented in this version)

Basic Strategy

  • Control the Center: Try to control the four central squares
  • Develop Pieces: Get your knights and bishops into play early
  • Protect Your King: Keep your king safe, usually by castling
  • Think Ahead: Consider your opponent's possible responses
  • Value of Pieces: Pawn=1, Knight/Bishop=3, Rook=5, Queen=9

Opening Principles for Beginners

The opening phase (first 10-15 moves) sets the foundation for the rest of your game. Follow these fundamental principles to gain a strong position:

Key Opening Goals

  • Control the Center: Pawns on e4, d4, e5, or d5 control key central squares. Central control gives your pieces more mobility and restricts your opponent's options.
  • Develop Knights Before Bishops: Knights typically develop to f3/c3 (white) or f6/c6 (black). They're most effective when placed toward the center, unlike bishops which can be effective from afar.
  • Don't Move the Same Piece Twice: Unless absolutely necessary, develop all your pieces before moving the same piece again. Each move should bring a new piece into play.
  • Castle Early: Castling moves your king to safety and activates your rook. Aim to castle within the first 10 moves, typically kingside for faster development.
  • Connect Your Rooks: Once your knights and bishops are developed and you've castled, your rooks should "see" each other across the back rank.
  • Don't Bring Your Queen Out Too Early: Your queen is powerful but vulnerable. Developing it early often leads to your opponent developing pieces while attacking your queen.

Common beginner mistake: Moving too many pawns in the opening. While controlling the center with pawns is important, moving too many pawns weakens your position and delays piece development.

Essential Chess Tactics

Tactics are short-term moves that win material or create immediate advantages. Recognizing these patterns will dramatically improve your play:

Fundamental Tactical Patterns

  • Fork: When one piece attacks two or more enemy pieces simultaneously. Knights are excellent forking pieces because of their unique movement.
  • Pin: When a piece cannot move without exposing a more valuable piece behind it. Bishops and rooks excel at creating pins along ranks, files, and diagonals.
  • Skewer: Similar to a pin, but the more valuable piece is in front. When it moves, you capture the piece behind it.
  • Discovered Attack: Moving one piece reveals an attack from another piece behind it, creating double threats.
  • Removing the Defender: Capturing or driving away a piece that's defending an important square or piece, then exploiting the weakness.

Practice looking for these tactics in every position. Before making a move, ask yourself: "Can I fork anything?" or "Is my opponent's piece pinned?" This tactical awareness separates improving players from stagnant ones.

About This Chess Game

This is a simplified chess implementation with a basic AI opponent. The AI makes random valid moves, making it suitable for beginners learning the game.

Note: Advanced features like castling, en passant, and check detection are not yet implemented. The game ends when a king is captured.

Frequently Asked Questions

How do you play Chess for beginners?

Chess is played on an 8x8 board with 16 pieces per player. The objective is to checkmate your opponent's King. Each piece moves differently: pawns move forward, rooks move in straight lines, bishops diagonally, knights in L-shapes, queens in any direction, and kings one square at a time.

What are the basic Chess opening principles?

Control the center with pawns (e4, d4, e5, d5), develop your knights and bishops before moving the same piece twice, castle early to protect your King, don't bring your Queen out too early, and connect your rooks by completing development.

How do you win at Chess?

You win by checkmating the opponent's King (attacking it with no escape) or when your opponent resigns. The game can also end in a draw through stalemate, threefold repetition, 50-move rule, or insufficient material.