pyrisk.git
14 years agoAdd titles to regions (Firefox, and possibly others) use them for tooltips.
W. Trevor King [Sun, 28 Mar 2010 01:08:44 +0000 (21:08 -0400)]
Add titles to regions (Firefox, and possibly others) use them for tooltips.

Use world.name as template.name and SVG <title>.

14 years agoRemove the upper-left and lower right bounding box marks
W. Trevor King [Sun, 28 Mar 2010 00:59:41 +0000 (20:59 -0400)]
Remove the upper-left and lower right bounding box marks

14 years agoAdded template control over line colors (and presence).
W. Trevor King [Sun, 28 Mar 2010 00:58:19 +0000 (20:58 -0400)]
Added template control over line colors (and presence).

14 years agoDistinguish between line (boder) and route color
W. Trevor King [Sun, 28 Mar 2010 00:45:23 +0000 (20:45 -0400)]
Distinguish between line (boder) and route color

14 years agoAdded continent colors to template system
W. Trevor King [Sun, 28 Mar 2010 00:43:58 +0000 (20:43 -0400)]
Added continent colors to template system

14 years agoConfigurable line color
W. Trevor King [Sun, 28 Mar 2010 00:18:02 +0000 (20:18 -0400)]
Configurable line color

14 years agoAdded traditional template for Earth
W. Trevor King [Sun, 28 Mar 2010 00:14:14 +0000 (20:14 -0400)]
Added traditional template for Earth

14 years agoAdded virtual routes to template system to allow related islands
W. Trevor King [Sun, 28 Mar 2010 00:13:28 +0000 (20:13 -0400)]
Added virtual routes to template system to allow related islands

14 years agoAdd preliminary graphics library with world generation
W. Trevor King [Sat, 27 Mar 2010 20:51:19 +0000 (16:51 -0400)]
Add preliminary graphics library with world generation

14 years agoAdded fortification to the basic Player AI.
W. Trevor King [Sat, 27 Mar 2010 01:56:41 +0000 (21:56 -0400)]
Added fortification to the basic Player AI.

This will excercise the fortification code during random_game()s.

Also moved Player.border_territories functionality into a combo of
Player.territories and a new Territory.border.  This makes it easy to
iterate through non-border territories looking for out-of-the-way
armies for fortification.

Finally, limit the players to one fortification per turn ;).

14 years agoAdded Engine.fortify (previously fortification would break Engine)
W. Trevor King [Sat, 27 Mar 2010 01:40:33 +0000 (21:40 -0400)]
Added Engine.fortify (previously fortification would break Engine)

Also moved adjacency check from Engine.attack_and_fortify to
Engine.attack and Engine.fortify.  This will make it easier for
subclasses to change the rules (e.g. non-adjacent fortifications).

Also reordered attack / conquer log messages:
  'attacked X from Y' -> 'X attacks Y'
which is shorter and makes the A:B ratios more clear.

14 years agoAdded Event classes to pyrisk.log
W. Trevor King [Sat, 27 Mar 2010 01:30:50 +0000 (21:30 -0400)]
Added Event classes to pyrisk.log

This should make logging easier to configure.  For example, a
Player.report function now has access to the raw data used to compose
the string.  Well, if the mutables haven't changed ;).  If that's an
issue for you, stick some copy.deepcopy calls into the Event subclass
__init__ definitions.

14 years agoRemove EmailPlayers from pyrisk.random_game
W. Trevor King [Sat, 27 Mar 2010 00:01:30 +0000 (20:01 -0400)]
Remove EmailPlayers from pyrisk.random_game

Now that I'm pretty happy with the email interface, we don't need an
easy way to test it anymore.  It was probably never a good idea to
hard-code dummy emails anyway ;).  The code is still in README so
people setting up EmailPlayers will know what to do.

14 years agoAdd reference to "The Red Balloon" ;)
W. Trevor King [Fri, 26 Mar 2010 22:59:07 +0000 (18:59 -0400)]
Add reference to "The Red Balloon" ;)

14 years agoAdded error handling for (?most?) invalid Player responses
W. Trevor King [Fri, 26 Mar 2010 21:23:21 +0000 (17:23 -0400)]
Added error handling for (?most?) invalid Player responses

14 years agoFixed up IncomingEmailDispatcher to work in real life ;).
W. Trevor King [Fri, 26 Mar 2010 11:00:44 +0000 (07:00 -0400)]
Fixed up IncomingEmailDispatcher to work in real life ;).

14 years agoReplaced README procmail rule with one I've actually tested :p
W. Trevor King [Fri, 26 Mar 2010 09:23:03 +0000 (05:23 -0400)]
Replaced README procmail rule with one I've actually tested :p

Also updated the README example code for new email setup.

14 years agoUpdate OutgoingEmailDispatcher execute calls -> self._execute
W. Trevor King [Fri, 26 Mar 2010 08:53:04 +0000 (04:53 -0400)]
Update OutgoingEmailDispatcher execute calls -> self._execute

14 years agoFix missing dispatchers in base.random_game EmailPlayer init.
W. Trevor King [Fri, 26 Mar 2010 08:50:49 +0000 (04:50 -0400)]
Fix missing dispatchers in base.random_game EmailPlayer init.

14 years agoFix excute -> execute typo in OutgoingEmailDispatcher
W. Trevor King [Fri, 26 Mar 2010 08:47:55 +0000 (04:47 -0400)]
Fix excute -> execute typo in OutgoingEmailDispatcher

14 years agoCorrect "Re:" portion of procmail regexp in README
W. Trevor King [Fri, 26 Mar 2010 08:45:05 +0000 (04:45 -0400)]
Correct "Re:" portion of procmail regexp in README

14 years agoAdded .gitignore to mask *.pyc files
W. Trevor King [Fri, 26 Mar 2010 09:36:41 +0000 (05:36 -0400)]
Added .gitignore to mask *.pyc files

14 years agoPreliminary handling of actual emails.
W. Trevor King [Fri, 26 Mar 2010 09:27:08 +0000 (05:27 -0400)]
Preliminary handling of actual emails.

14 years agoAdded setup.py and moved VERSION to pyrisk/__init__.py
W. Trevor King [Fri, 26 Mar 2010 06:13:45 +0000 (02:13 -0400)]
Added setup.py and moved VERSION to pyrisk/__init__.py

14 years agoAdded README and renamed risk/ -> pyrisk/
W. Trevor King [Fri, 26 Mar 2010 06:10:07 +0000 (02:10 -0400)]
Added README and renamed risk/ -> pyrisk/

14 years agoAdded GPLv2 boilerplate.
W. Trevor King [Fri, 26 Mar 2010 05:52:15 +0000 (01:52 -0400)]
Added GPLv2 boilerplate.

14 years agoAdded risk.player.email with EmailPlayer.
W. Trevor King [Fri, 26 Mar 2010 05:46:54 +0000 (01:46 -0400)]
Added risk.player.email with EmailPlayer.

Currently only a text-mode interface (no actual email), but it
supports all the necessary methods.

14 years agoPlayer.select_territory returns territory name rather than instance.
W. Trevor King [Fri, 26 Mar 2010 04:34:59 +0000 (00:34 -0400)]
Player.select_territory returns territory name rather than instance.

To keep the Player interface as simple (and tamper-resistant :) as
possible, Player methods should return names instead of instances
of risk-specific classes.

Also fixed a deck -> self.deck typo in Engine.

14 years agoBroke Engine.end_of_turn_cards out of Engine.play_turn
W. Trevor King [Fri, 26 Mar 2010 04:23:18 +0000 (00:23 -0400)]
Broke Engine.end_of_turn_cards out of Engine.play_turn

For easier modification if you decide to change the rules in a
subclass.

14 years agoAdded adjacency checking to Engine.attack_and_fortify.
W. Trevor King [Fri, 26 Mar 2010 04:19:41 +0000 (00:19 -0400)]
Added adjacency checking to Engine.attack_and_fortify.

14 years agoFixed bug in active_player calculation + other cleanups.
W. Trevor King [Fri, 26 Mar 2010 02:54:47 +0000 (22:54 -0400)]
Fixed bug in active_player calculation + other cleanups.

Also
* Added docstrings to many classes and methods.
* Added NameMixin, breaking off .name portion of ID_CmpMixin.
* Removed unused contains_territory methods.
* _check_short_names comparison now case insensitive to match
  territory_by_name.
* Deck gains options num_wilds and type_names.
* Deck gains method shuffle.
* Deck and Hand scoring and production generalized.
* Many Player methods renamed (losing "phase_").
* Many Player methods gain log option, since the player might want to
  know what's been going on.
* Player methods phase_attack and phase fortify combined to form
  attack_and_fortify.  The idea is to let the player make as many
  decisions as they would like to in one fell swoop, and attacking
  and fortifying are very similar.
* Engine gains game_over method for easier subclassing.
* Engine deal method more flexible, now single player.  Also takes
  over player hand manipulation from Player.draw (formerly
  phase_draw).  The idea is to have Engine do all possible Player
  manipulation; Player methods are just for making decisions and
  notification.
* test function adjusted to work with
  python -c 'import risk.base as b; b.test()'

14 years agoOnly call Player.report (prev. Player.phase_report) as final contact
W. Trevor King [Fri, 26 Mar 2010 00:40:26 +0000 (20:40 -0400)]
Only call Player.report (prev. Player.phase_report) as final contact

14 years agoAdded player-specific log reporting
W. Trevor King [Thu, 25 Mar 2010 23:30:21 +0000 (19:30 -0400)]
Added player-specific log reporting

14 years agoBegan versioning (v0.1), engine and basic AI.
W. Trevor King [Thu, 25 Mar 2010 21:28:52 +0000 (17:28 -0400)]
Began versioning (v0.1), engine and basic AI.