Skip to main content

A Python API wrapper for Fairyground Variant Challenge.

Project description

Chess Variant Python SDK

The absolute easiest way to create, view, and list chess variants via Python.

Powered by Fairyground Variant Challenge.

Installation

pip install chess-variant

Basic Usage

import chess_variant

# 1. Start a game instantly
game = chess_variant.play("3check")

# Get any link or ID easily!
print(f"Room ID:   {game.id}")
print(f"White URL: {game.white}")
print(f"Black URL: {game.black}")
print(f"Game URL:  {game.url}")

# 2. View board state/FEN
state = chess_variant.view(game.id)
print(f"Current FEN: {state['fen']}")

# 2b. Get full room snapshot (same payload as /api/game/:roomId)
snapshot = chess_variant.room(game.id)
print(snapshot)

# 2c. Or fetch via Room instance
print(game.state())

# 3. List all active game rooms
all_rooms = chess_variant.rooms()
print(f"Currently {len(all_rooms)} active games!")

# 4. Get the move list for a game
move_list = chess_variant.moves(game.id)
print(f"Moves played: {move_list}")

# 5. Get the PGN for a game
print(chess_variant.pgn(game.id))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chess_variant-1.0.7.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chess_variant-1.0.7-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file chess_variant-1.0.7.tar.gz.

File metadata

  • Download URL: chess_variant-1.0.7.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for chess_variant-1.0.7.tar.gz
Algorithm Hash digest
SHA256 97fa9bb711e2b676b2585f91c5fff9582fe79680fc58f1e07685bed1bfc91c58
MD5 a186007d236ecd2f0dfcb302214b2a26
BLAKE2b-256 8c2cab2be48652958271e160692c55b20583bf055eb74364d0de60e66f7bdda5

See more details on using hashes here.

File details

Details for the file chess_variant-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: chess_variant-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for chess_variant-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3972743dc7a27ed00c8a3ac8127c9ee226aa4e07eeebe1ab85a22eff6f6d127e
MD5 b07cc219f0fda5b153d8b2910995cc1f
BLAKE2b-256 5d951e17d0b2bdd640bd7443e43b0124db61537b2f40fade588a431e4f4e68b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page