X-Git-Url: http://git.tremily.us/?p=pyrisk.git;a=blobdiff_plain;f=README;h=52696073143e945be9c61f623bf0d9c3ae37798e;hp=324f9ff3f8b373aea5ea70b588abef489a492514;hb=df78377855af19eac05acb6e4cbfe7b6d28c9c76;hpb=bfcf09ed6af545621b483d4969c575c53bc2eb81 diff --git a/README b/README index 324f9ff..5269607 100644 --- a/README +++ b/README @@ -2,9 +2,9 @@ PyRisk ====== This is a Python engine and interface for building games similar to -Albert Lamorisse's 1957 La Conquête du Monde. The game is perhaps -better known as Risk, and is produced by Parker Brothers (now a -division of Hasbro). +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: @@ -37,17 +37,30 @@ appropriate messages into a named pipe. With procmail, that will look something like:: :0 - * ^Subject: *(Re:)* [PyRisk* - | >> /path/to/named/pipe - -Then just add your EmailPlayers to your game and go:: - - import pyrisk.base as b; - import pyrisk.player.email as e; + * ^Subject:.*\[PyRisk.* + { + :0 wc + /path/to/named/pipe + + :0 + | /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 pyrisk.player.email import IncomingEmailDispatcher, \ + OutgoingEmailDispatcher, EmailPlayer world = generate_earth() - players = [EmailPlayer('Alice', 'alice@example.com', 'server@example.com'), - EmailPlayer('Bob', 'bob@big.edu', 'server@example.com'), + ied = IncomingEmailDispatcher(fifo_path='/tmp/pyrisk.in') + oed = OutgoingEmailDispatcher(return_address='server@example.com') + players = [EmailPlayer('Alice', 'alice@big.edu', ied, oed), + EmailPlayer('Bob', 'bob@fish.net', ied, oed), Player('Charlie')] e = Engine(world, players) e.run() - + ied.close()