When Mood Music
2012-04-15 19:24:00 pleased Agog in the Ether – Ozric Tentacles

The basic game does what it should:

Swampy bloodbath!

  1. It creates a swamp creating an ogre in a random position.
  2. An enemy may enter.
  3. All creatures in the swamp move to a proximate location.
  4. Steps 2 and 3 repeat …

    until one or more enemies enter the ogre’s current location.

    • If there is only enemy in the ogre’s current location, it is killed and this happy event is reported.
      Then steps 2 and 3 begin to be repeated.
    • If there are two or more enemies in the creature’s location, the ogre is killed and this sad event is reported.


The remaining tasks are

  • ensuring the ogre doesn’t start at (0,0)
  • reducing the number of times the map is drawn
  • creating an interface which is completely independent of the game
  • enabling saving of the current game and later restarting it
  • writing comprehensive JUnit tests for each method (excluding the constructors) defined on the class Swamp
  • writing a report on
    • how I created the swamp
    • where and why I used polymorphic programming
    • my programming style (i.e. showing where and why you have used things like interfaces, enumerator, exceptions etc) There are none of these in the current code, although I suspect I should use an enumerator for the types of enemy.
    • how my swamp is extensible
    • any problems encountered during the coding of my game. Hence these blog entries!

I need to demonstrate my program and submit my report next Tuesday, so I better crack on.

One refinement I could make is to not use both type (‘ogre’ or ‘enemy’) and subtype of enemy (‘donkey’, ‘snake’ and ‘parrot’). I think these could be collapsed into just one type. Then I’d only need one non-abstract class of creature. But this would remove all vestiges of polymorphic programming from my code…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.