Skip to main content

A simple Weiqi (Go) library for Python

Project description

weiqi.py - Library for the game of Go

This is a library for the game of Go. It is written in Python and is designed to be easy to understand and use. It is also designed to be easy to extend and modify.

Usage

To use this library, you need to have Python installed on your computer.

To install the library, you can use the following command:

pip install weiqi

To use the library, you can import it in your Python code like this:

from weiqi import Board, WeiqiGame, Player, Stone

# Example user implementation
class User:
    def __init__(self, name: str):
        self.name = name

player_black = Player(User("Black"), Stone.BLACK)
player_white = Player(User("White"), Stone.WHITE)

# 19x19 board
board = Board.generate_empty_board(19)

game: WeiqiGame[User] = WeiqiGame(
    player_black=player_black,
    player_white=player_white,
    board=board
)

# Then you can implement user interaction with the game 
# through various interfaced (Example: CLI, GUI, etc.)
# You can also implement AI players

Testing

To run the tests, you can use the following command:

python -m unittest discover -s tests

Example

Example of the library in use

You can see an example with a simple Pygame GUI in the example/pygame_example.py file.

For starting the example, you can run the following command:

poetry install --only example
python example/pygame_example.py

After running the command, you should see a window pop up with a Go board. You can click on the board to place stones.

TODO

  • New example pygame for v0.2.0 (with the new features)
  • Implement the time control system
  • Implement the AI players

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

weiqi-0.2.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

weiqi-0.2.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file weiqi-0.2.0.tar.gz.

File metadata

  • Download URL: weiqi-0.2.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.11.6-arch1-1

File hashes

Hashes for weiqi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f4276c12d561d32162a936f4b64c46b7810003466699f3a8cc51ae7ea2971a92
MD5 af9e01ee44e2dabc49083a0a78ade121
BLAKE2b-256 cec83ae2c552176f4cc968ead65064f3838ffd5319ca1c9e54c1e431380950fb

See more details on using hashes here.

File details

Details for the file weiqi-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: weiqi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.11.6-arch1-1

File hashes

Hashes for weiqi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 715c53b85819e2db51db13c8e20fdabc990a15205dc5f2e7ba6b809c80d94824
MD5 6d3334895e2e6ecd1a9b30cfb7c7482d
BLAKE2b-256 6f8bbe5ffae00ec2dfbdf3d7e9f819db2d937f6e090e4e18448d0da90c2457e1

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