Skip to main content

play brandub

Project description

Brandub

A python package to play brandub.

Installation

pip install brandub

Play a game

To play via the command line, simply run the brandub command.

To play a game in a python terminal or ipython terminal, instantiate a BrandubGame object and use the run() method.

> from brandub import BrandubGame
> game = BrandubGame()
> game.run()

To exit either version, simply ctrl+c and enter 'y'.

Rules

We use the rules on this website. But here's a rundown:

Brandub is played on a 7x7 board. The monarch sits in the center surrounded to the left, right, above, and below by defensive pawns. There are eight attacking pawns, two each placed side by side next to the defensive pawsn such that all pieces form a plus sign. The goal for the defending team is to escort the monarch to any of the corners. The goal for the attacking team is to capture the monarch.

All pieces can move horizontally or vertically any number of spaces, except that no piece can land on another piece nor can a piece move past a piece in its way. Only the monarch can land in the corners of the board -- the "forests" -- and no piece may land in the central square -- the "castle" -- once it has been abandoned by the monarch, although any piece may continue moving past it.

The pawns are captured if they are trapped by two opposing pieces either to the left and right or above and below. Additionaly, pawns can be trapped by the empty castle or by the forests. (Attacking pawns can be trapped by the occupied castle since the only possible occupant is the monarch.)

If inside the castle, the Monarch is only captured if surrounded by four attacking pawns, one above, one below, one right, one left. If the monarch is immediately next to the castle (not diagonally) then the monarch is trapped by three attacking pawns and the empty castle. Elsewhere, the monarch is trapped just like pawns, including being trapped by a forest and attacking pawn.

The attackers move first. The game ends in a draw if a board position is repeated.

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

brandub-1.0.1.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

brandub-1.0.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file brandub-1.0.1.tar.gz.

File metadata

  • Download URL: brandub-1.0.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.11

File hashes

Hashes for brandub-1.0.1.tar.gz
Algorithm Hash digest
SHA256 af2703b71a7d0c022e6d4de0e9b84f077c20b7336c7c1201603f5b6c4cd74f5d
MD5 6ff2a206fc6dab288c30378af8340002
BLAKE2b-256 16e13692827772b73f5fecb0e8316755ac047a7e1ac7457ccf28d59e6e972153

See more details on using hashes here.

File details

Details for the file brandub-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: brandub-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.11

File hashes

Hashes for brandub-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 256d49f31af34eeab64a00640324796c3ccd9baa0efbab7e611539dbee9fc29e
MD5 1babeedcb7456f325fea994f1b15e941
BLAKE2b-256 4ac84405ddd29545bce51e172eae19e90d2c5cf174b657a09957a1fedae67d8b

See more details on using hashes here.

Supported by

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