Skip to main content

Manim Chessboard

A Manim plugin that allows you to generate scenes with chessboards with minimal setup.

Installation

pip install manim-chessrender

Features

  • Initialize Chessboard: Easily create and display a fully initialized chessboard.
  • Move Pieces: Animate standard piece movements using UCI notation.
  • Special Moves: Handle special chess moves like castling and en passant.
  • Load FEN Strings: Load and display a board configuration from a FEN string.
  • Play PGN Files: Load and animate moves from PGN files.
  • Customization: Customize the appearance of the chessboard and pieces with different colors and image paths.

Usage

To render the examples, you need to run the script using Manim. Below are the examples included in this project.

MovePieceExample

This example initializes the chessboard and demonstrates moving a piece.

MovePieceExample

class MovePieceExample(MovingCameraScene):
    """
    Scene to demonstrate moving a piece on the chessboard.
    """
    def construct(self):
        """
        Constructs the scene by initializing the chessboard and moving a piece.
        """
        chessboard = ChessBoard()
        chessboard.initialize_board()
        self.add(chessboard.board)
        self.wait(1)
        self.play(chessboard.execute_move('e2e4'))
        self.wait(2)

PlayPGNExample

This example demonstrates playing moves from a PGN file on the chessboard.

PlayPGNExample

class PlayPGNExample(MovingCameraScene):
    """
    Scene to demonstrate playing moves from a PGN file on the chessboard.
    """
    def construct(self):
        """
        Constructs the scene by loading a PGN file and animating the moves on the chessboard.
        """
        chessboard = ChessBoard()
        chessboard.initialize_board()
        self.add(chessboard.board)
        self.wait(1)
        
        games = chessboard.load_pgn("./example/example.pgn")
        game = games[0]
        for move in game:
            self.play(chessboard.execute_move(move.uci()))
            self.wait(0.5)

Running the Examples

To run any of the examples, execute the script using Manim. For instance, to run the InitializeChessBoard example:

manim -pql examples.py InitializeChessBoard

Replace InitializeChessBoard with the class name of the example you want to run.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Release files for manim-chessrender 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for manim-chessrender 0.1.2
File Size Uploaded
manim_chessrender-0.1.2.tar.gz 168.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for manim-chessrender 0.1.2
File Interpreter ABI Platform
manim_chessrender-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 346.5 kB

Release files / manim_chessrender-0.1.2.tar.gz

Download URL manim_chessrender-0.1.2.tar.gz
Size 168.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f62b227b09d6d7ae0591923ba9d019c16ac1fa244f72a4938eb077866422a57a
BLAKE2b-256 checksum
How to use checksums
487c9c110fc9e63a1200881fa0261db8f16c6e839279f9e924df40f2d216e441
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.12

Release files / manim_chessrender-0.1.2-py3-none-any.whl

Download URL manim_chessrender-0.1.2-py3-none-any.whl
Size 178.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
396dd2f51e7da44ac0c4660a3e74a7c6099d543b25a2906524db69dbcd7950b4
BLAKE2b-256 checksum
How to use checksums
dff3db05949757ab47e9b6254923eecde64c60e7b0eb7f6891d29bbcfab105cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page