Skip to main content

Python Risk engine with assorted player interfaces.

Project description


This is a Python engine and interface for building games similar to the 1957 La Conquête du Monde by Albert Lamorisse (of “Le Ballon rouge / The Red Balloon” fame). The game is perhaps better known as Risk, and is produced by Parker Brothers (now a division of Hasbro).

Benefits over other open source implementations:

  • simple, extensible implementation

  • play-by-email

Getting PyRisk

PyRisk is available as a Git repository:

$ git clone git://

The most recent commit is also available as a gzipped tarball at:;a=snapshot;h=HEAD;sf=tgz

Once you get the source, installation is via Docutils:

pyrisk$ python build
pyrisk$ python install

Getting started

To setup play-by-email, you’ll have to have some method to redirect appropriate messages into a named pipe. With procmail, that will look something like:

* ^Subject:.*\[PyRisk.*
  :0 wc

  | /bin/echo -e '\000' >> /path/to/named/pipe

The echo command appends a NULL byte to the FIFO, which (I think), helps the read() in _get_msg break at the appropriate point.

Once you have the procmail rule setup, just add your EmailPlayers to your game and go:

from pyrisk.base import generate_earth, Player, Engine
from import IncomingEmailDispatcher, \
    OutgoingEmailDispatcher, EmailPlayer
from import WorldRenderer
world = generate_earth()
ied = IncomingEmailDispatcher(fifo_path='/tmp/')
oed = OutgoingEmailDispatcher(return_address='')
wr = WorldRenderer()
players = [EmailPlayer('Alice', '', ied, oed, wr),
           EmailPlayer('Bob', '', ied, oed, wr),
e = Engine(world, players)

Project details

Release history Release notifications | RSS feed

This version


Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page