Skip to main content

Python client for noprune chess bot platform - easily create custom chess systems

Project description

noprune

Build your own chess system in Python with just a few lines of code.

noprune is the official Python client for the noprune.org chess bot platform — where AI chess systems compete against each other in a fair, transparent rating system.

Vision

noprune is a platform where anyone can create, deploy, and compete with their own chess AI.

  • No pruning, pure skill — Every system plays every position. No shortcuts.
  • Fair matchmaking — Systems are matched by skill level (Turing rating)
  • Open competition — Your bot competes 24/7 against others worldwide
  • Learn by doing — Start with random moves, evolve to neural networks

Whether you're a beginner learning minimax or a researcher testing cutting-edge models, noprune provides the arena.

Installation

pip install noprune

Quick Start

Create a chess bot in 10 lines:

from noprune import Bot
import random

@Bot(system_id="your-id", secret="your-secret")
def my_bot(board):
    # board is a python-chess Board object
    moves = list(board.legal_moves)
    return random.choice(moves).uci()

my_bot.run()  # Connect and start playing!

That's it. Your bot will connect to noprune.org, join the matchmaking queue, and start playing games automatically.

Getting Your Credentials

  1. Sign up at noprune.org
  2. Create a new "System" (your bot)
  3. Copy your system_id and secret

Examples

Random Bot (Simplest)

from noprune import Bot
import random

@Bot(system_id="...", secret="...")
def random_bot(board):
    return random.choice(list(board.legal_moves)).uci()

random_bot.run()

Stockfish Bot (Strong)

from noprune import Bot
import chess.engine

@Bot(system_id="...", secret="...")
def stockfish_bot(board):
    with chess.engine.SimpleEngine.popen_uci("/usr/games/stockfish") as engine:
        result = engine.play(board, chess.engine.Limit(time=0.1))
        return result.move.uci()

stockfish_bot.run()

With Game Events (Advanced)

from noprune import Bot, GameState, Action

class MyBot(Bot):
    def on_game_start(self, game: GameState):
        print(f"Game started vs {game.opponent}!")
        print(f"I'm playing as {game.color}")

    def on_game_end(self, game: GameState, result: str, reason: str):
        print(f"Game over: {result} ({reason})")

    def think(self, board) -> str:
        # Your engine logic here
        return "e2e4"

bot = MyBot(system_id="...", secret="...")
bot.run()

Resign & Draw Offers

from noprune import Bot, Action

@Bot(system_id="...", secret="...")
def smart_bot(board):
    # Resign if losing badly
    if is_losing(board):
        return Action.RESIGN

    # Offer draw in equal endgame
    if is_drawn_endgame(board):
        return Action.OFFER_DRAW

    return calculate_best_move(board)

API Reference

Bot

The main class for creating chess bots.

# Decorator style
@Bot(system_id="...", secret="...", server_url="wss://noprune.org/ws")
def my_bot(board):
    return "e2e4"

# Class style
class MyBot(Bot):
    def think(self, board):
        return "e2e4"

Methods to override:

  • think(board) -> str | Action — Calculate your move (required)
  • on_game_start(game: GameState) — Called when game begins
  • on_game_end(game, result, reason) — Called when game ends
  • on_move(game, move, is_my_move) — Called after each move
  • on_draw_offer(game) -> bool — Return True to accept draw

GameState

@dataclass
class GameState:
    game_id: str           # Unique game identifier
    board: chess.Board     # Current position (python-chess)
    color: str             # "white" or "black"
    opponent: str          # Opponent's name
    moves: list[str]       # Move history in UCI format
    my_time_ms: int        # Your remaining time (ms)
    opponent_time_ms: int  # Opponent's remaining time (ms)

Action

Action.RESIGN       # Give up
Action.OFFER_DRAW   # Propose a draw
Action.move("e2e4") # Make a move (same as returning "e2e4")

Environment Variables

export SYSTEM_ID="your-system-id"
export SYSTEM_SECRET="your-secret"
export SERVER_URL="wss://noprune.org/ws"  # or ws://localhost:8086/ws for local

python my_bot.py

Why "noprune"?

In chess programming, "pruning" means skipping moves that seem bad. Top systems like Stockfish prune aggressively — they don't even consider most legal moves.

noprune is different. It's a place where any approach is welcome:

  • Brute-force minimax? Great.
  • Neural network evaluation? Awesome.
  • Random moves? Sure, let's see how it does.

The name reminds us: there's no "wrong" way to build a chess system. Every approach teaches us something.

Links

License

MIT

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

noprune-0.1.2.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

noprune-0.1.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file noprune-0.1.2.tar.gz.

File metadata

  • Download URL: noprune-0.1.2.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for noprune-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9e1033bdda3063d21ba257442989a02d7f660870120a60a0be68a46d8eca0130
MD5 a5b251ac8f8a9ab6e603527064b69f14
BLAKE2b-256 c366c666bd8275a8eb16ee5995de4d8a1d2ad6cbad4aeccc3c28f250940de36f

See more details on using hashes here.

File details

Details for the file noprune-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: noprune-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for noprune-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 88d0bfd9ec328bf27ba23953d2b0ffc1864eb3b250cabc632998bca803608089
MD5 299219a89d10017db483dacb93304591
BLAKE2b-256 6df07ffe3aca83eb60f05e74a6cb72863f3b0151a14cf4790fa1759e323a7084

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