An easy-to-use, lightweight Python library for Quoridor
Project description
Quoridor logic in Python
Install
pip install pyquoridor
Usage
from pyquoridor.board import Board
from pyquoridor.utils import print_board
board = Board()
# Place fences
board.place_fence(row=0, col=0, orientation='h')
board.place_fence(row=7, col=0, orientation='h')
board.place_fence(row=3, col=2, orientation='v')
board.place_fence(row=1, col=0, orientation='v')
# Move pawn
board.move_pawn(player='white', target_row=1, target_col=4)
# Show board
print_board(board)
"""
··· ··· ··· ··· ··· ··· ··· ··· ···
8 : b :
— * —
7 : :
6 : :
5 : :
4 : | :
*
3 : | :
2 : | :
*
1 : | w :
— * —
0 : :
··· ··· ··· ··· ··· ··· ··· ··· ···
0 1 2 3 4 5 6 7 8
"""
Exceptions for invalid moves
The logic raises exceptions for:
- Invalid pawn moves, including out-of-board and illegal jumping events (
exceptions.InvalidMove) - Invalid fence placements, including out-of-board fences, overlapping fences, and fences that block unique pawn paths (
exceptions.InvalidFence) - Moves after game is over (
exceptions.GameOver)
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
pyquoridor-0.0.5.tar.gz
(11.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyquoridor-0.0.5.tar.gz.
File metadata
- Download URL: pyquoridor-0.0.5.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d61aa6067a871453bca0400cd132d0c1091165637f8067a0bb936be04515f7a
|
|
| MD5 |
480e16203a900484da1c31c3d5d16db0
|
|
| BLAKE2b-256 |
1769fd0f647fa9b634fda59f06a91392b90158faa65962f41f925059277eb7dd
|
File details
Details for the file pyquoridor-0.0.5-py3-none-any.whl.
File metadata
- Download URL: pyquoridor-0.0.5-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2006f532358374a4cc19c25bb18b4f50a9a6a8b883ad73c5da9d7679a03a926
|
|
| MD5 |
5f9c33784c93ab5a2c1af41787016cba
|
|
| BLAKE2b-256 |
baa68d0567670a316f5a70c68ca997bbf3e60a839e90b419e4218721b249cfe4
|