Skip to content

Usage.md

Trent M. Wyatt edited this page Apr 21, 2025 · 1 revision

Usage

This guide explains how to use MicroChess after setting it up on your Arduino board. MicroChess allows you to watch the engine play against itself, observe the game on an 8x8 LED strip, or interact with the game via the Arduino Serial Monitor by entering moves in algebraic notation.

Prerequisites

  • MicroChess is installed and uploaded to your Arduino (see Installation).
  • The Serial Monitor is open in the Arduino IDE (baud rate: 9600).
  • (Optional) An 8x8 LED strip is connected for visual display.

Running MicroChess

  1. Power On the Arduino: Connect your Arduino to your computer via USB or a power source. The MicroChess sketch starts automatically.
  2. Open the Serial Monitor:
    • In the Arduino IDE, go to Tools > Serial Monitor or press Ctrl+Shift+M.
    • Set the baud rate to 9600.
    • You’ll see the initial chess board printed as text (e.g., ranks 1-8, files a-h) and a prompt for input.
  3. Observe the LED Strip (Optional):
    • If connected, the 8x8 LED strip displays the current board state, with pieces represented by different colors (configured in led_strip.cpp).
    • The board updates in real-time as moves are made.

Playing Modes

MicroChess supports two primary modes:

1. Watch the Engine Play Itself

  • By default, MicroChess runs in a mode where the engine plays both sides (white and black).
  • The engine uses minimax with alpha-beta pruning to select moves, configured by settings in options.h (e.g., search depth).
  • Serial Monitor Output:
    • Each move is printed in algebraic notation (e.g., "e2e4", "g8f6").
    • The updated board state is displayed after each move.
  • LED Strip Output:
    • The board on the LED strip updates to reflect each move, showing piece positions.
  • To observe, simply watch the Serial Monitor or LED strip without inputting commands.

2. Interactive Play

  • You can interact with MicroChess by entering moves via the Serial Monitor.
  • Steps:
    1. Wait for the prompt (e.g., "Enter move for White:").
    2. Type a move in standard algebraic notation (e.g., "e2e4" to move a pawn from e2 to e4) and press Enter.
    3. The engine validates the move, updates the board, and responds with its move for the opposing side.
    4. Continue entering moves to play against the engine.
  • Special Moves:
    • Castling: Enter "O-O" (kingside) or "O-O-O" (queenside).
    • Pawn Promotion: Append the piece type (e.g., "e7e8q" for promotion to a queen).
    • En Passant: Enter the move as it occurs (e.g., "e5d6" to capture en passant).
  • Error Handling: If an invalid move is entered, the Serial Monitor displays an error (e.g., "Illegal move") and prompts again.

Example Interaction

  1. Serial Monitor shows:
Clone this wiki locally