Skip to main content
catan
-----

Package catan provides models for representing and manipulating a game of catan

Board coordinates must be specified as described in module [`hexgrid`](https://github.com/rosshamish/hexgrid).

`.catan` files will be written to the working directory by class Game (see [`catanlog`](https://github.com/rosshamish/catanlog)).

class Game also supports undo and redo, which is useful for building GUIs.

Supports Python 3. Might work in Python 2.

> Author: Ross Anderson ([rosshamish](https://github.com/rosshamish))

### Installation

```
pip install catan
```

### Usage

```
import catan.board
import catan.game
import catan.trading

players = [Player(1, 'ross', 'red'),
Player(2, 'josh', 'blue'),
Player(3, 'yuri', 'green'),
Player(4, 'zach', 'orange')]
board = catan.board.Board()
game = catan.game.Game(board=board)

game.start(players=players)
print(game.get_cur_player()) # -> ross (red)
game.buy_settlement(0x37)
game.buy_road(0x37)
game.end_turn()
...
game.roll(6)
game.trade(trade=catan.trading.CatanTrade(...))
game.undo()
game.redo()
game.play_knight(...)
game.end_turn()
...
game.end()
```

See [`catan-spectator`](https://github.com/rosshamish/catan-spectator) for extensive usage.

### File Format

<!-- remember to update this section in sync with "File Format" in github.com/rosshamish/catan-spectator/README.md -->

catan-spectator writes game logs in the `.catan` format described by package [`catanlog`](https://github.com/rosshamish/catanlog).

They look like this:

```
green rolls 6
blue buys settlement, builds at (1 NW)
orange buys city, builds at (1 SE)
red plays dev card: monopoly on ore
```

### Documentation

Most classes and modules are documented. Read the docstrings! If something is confusing or missing, open an issue.

### License

GPLv3

Release files for catan 0.4.3

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

Source distribution (sdist)

Source distribution for catan 0.4.3
File Size Uploaded
catan-0.4.3.tar.gz 27.1 kB Details

Release files / catan-0.4.3.tar.gz

Download URL catan-0.4.3.tar.gz
Size 27.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ca8892e54ee4bc3b1fc8bbf87f600e863839b10995bb4040eede3b9127e2d90c
BLAKE2b-256 checksum
How to use checksums
b1f07511047b16a3b8eb8a1a5dd5e686b09c3c31f8e4d80e2d61a036f121b72f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.4.3 This release

1 release file

0.4.2

1 release file

0.3.11

1 release file

0.3.10

1 release file

0.3.9

1 release file

0.3.8

1 release file

0.3.7

1 release file

0.3.6

1 release file

0.3.5

1 release file

0.2.5

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

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