Chess

Play Chess against an AI opponent powered by a rule-based engine. Pick a level from Easy to Best, or Match for an opponent that keeps the game close.

How to Play Chess

  1. Select a side to play as (White, Black, PvP, or CPU). In CPU mode the AI controls both sides.
  2. Choose a CPU strategy for each AI side: Easy and Medium make beginner mistakes, Smart plays principled chess with variety, Best always picks the strongest move, Match eases off when it is ahead, and Random picks any legal move.
  3. Click a piece to select it; valid moves highlight on the board. Click a highlighted square to move.
  4. The game detects check, checkmate, and stalemate automatically — a banner announces the result.
  5. Click Reset at any time to start a new game with the same settings.

Frequently Asked Questions

What CPU strategies are available?
Six. Smart follows the rule-based AI priority order and picks randomly among moves with similar positional scores — strong but varied. Best always picks the single highest-scored move for the top-priority rule — the strongest and most consistent play. Medium and Easy play like Smart but make mistakes: they overlook good moves and sometimes miss that a piece can be taken, Easy far more often. Match adapts to the score: the further ahead in material it gets, the more mistakes it makes, and when it falls behind it plays as Best. Random picks any legal move with no rules or scoring — completely unpredictable.
Which level should I pick?
Start on Easy: it still takes a piece you leave hanging, but often leaves its own where you can take them. Move up to Medium, then Smart and Best. Pick Match if you would rather the CPU ease off when it is winning, so the game stays close.
Can two humans play on the same device?
Yes — select PvP mode and pass the device between turns.
Does the game support castling and en passant?
Yes. All standard chess rules are implemented including castling, en passant, and automatic pawn promotion to Queen.
How does the rule-based AI work?
The AI scores every legal move using piece-square tables, then evaluates a priority-ordered rule list — checkmate, escaping a mate threat, promoting to Queen, safe captures ordered by piece value, winning the exchange, castling, giving check, threatening a piece, centre control, and development. Against a lone king it hems the king in until it can deliver mate. The highest-priority rule that matches any move decides the choice, and the position score picks the strongest move within that rule.
Why does the AI refuse a free-looking capture?
Captures are ranked by what they win and what they risk. Taking a pawn with a piece that can then be captured is a losing trade, so those moves sit near the bottom of the rule list — below simply making a safe move. The AI would rather decline material than hand back more than it wins.
Does the AI repeat moves or shuffle pieces?
It actively avoids it. Every candidate move is checked for repetition and for oscillation — a piece bouncing between the same two squares — and those moves are filtered out of the ordinary rules, so the CPU keeps making progress instead of stalling.

Related Games

Chinese ChessCheckersBackgammon