Skip to content

Feature Request: Add a new chess variant Duck Chess#1200

Open
shubham-dce wants to merge 2 commits into
niklasf:masterfrom
shubham-dce:new-variant-feature
Open

Feature Request: Add a new chess variant Duck Chess#1200
shubham-dce wants to merge 2 commits into
niklasf:masterfrom
shubham-dce:new-variant-feature

Conversation

@shubham-dce

Copy link
Copy Markdown

Type: New chess variant

Motivation

python-chess currently supports several standard variants (Suicide, Atomic, King of the Hill, Crazyhouse, etc.) but does not support Duck Chess.

Duck Chess is a variant where a "duck" piece occupies one square and blocks movement for both sides. After every normal move, the player who moved must also relocate the duck before the turn passes to the opponent.

This PR adds DuckChessBoard under chess.variant, following the same structure as the existing variant subclasses.

What's included

chess/variant.py

  • Added a new DuckChessBoard(chess.Board) class.
  • Tracks the duck's square and whether duck placement is pending using:
    • duck_square
    • duck_phase
  • Updated move generation, legality checks, and push()/pop() handling so that a full turn consists of:
    1. Moving a piece.
    2. Placing the duck.

FEN, UCI, and SAN support

  • Extended FEN read/write support with a duck field.
  • Added UCI/SAN parsing and output support for duck placements using @<square> notation.

Game rules

  • Disabled check, checkmate, and draw-by-repetition/50-move rules, since Duck Chess is won by capturing the king.

Variant registration

  • Registered Duck Chess in the variant lookup:
    • chess.variant.find_variant("duck")
    • Duck
    • Duck Chess
    • Duckchess

Tests

Added tests covering:

  • FEN round-tripping
  • Duck placement legality
  • Duck blocking behavior
  • King-capture win detection

Documentation

  • Added a DuckChessBoard entry to docs/variant.rst.

Testing

  • Added new unit tests in test.py — all passing.
  • Ran the existing test suite — no regressions found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants