/zoo_sim

A Zoo Simulator written in Java

Primary LanguageJava

Zoo.java

  A "Zoo" simulation.
  My first design goal was to demonstrate polymorphism through inheritance. Inheritance can be a valuable tool which must be used judiciously, so I chose to implement it in as minimal context as necessary.

  My second design goal was to demonstrate features of Java 8 that borrow from the functional paradigm, including the 'stream' wrapper, the 'select' function, and the use of pipes.

  The only interaction the user has with the program is at the command line. The main method (nested in the Zoo class) is a test driver; it's possible to add an interactive GUI to create a turn-by-turn game.

How to Compile and Run

Compilation

  • Download or clone.
  • Open terminal window and invoke makefile with:
    make

Run

  • In terminal, navigate to program directory.
  • Invoke java program with four integer-arguments.
    The arguments represent the starting state of the Zoo.
    java Zoo <money> <penguins> <tigers> <turtles>

Example

Here's the last turn and end state and the code that invoked it.
java Zoo 100000 6 5 50