Java
PROJECT – GAME OF LIFE
PROJECT
DESCRIPTION · Grass · Forest · Sheep · Rabbit · Wolf · Fire · Water (Lake) · Water (Rain) Your
simulation must include at least 10 different simple rules that explain the
interactivity between creatures. The
rules cover simple ideas such as surviving/dying, moving and expanding/having
children. Below are some examples but
you are encouraged to create your own rules with whichever elements you want
to use. · Grass (and
Forest) expands to neighbouring tiles 5% of the time. · Sheep can live
10 days without being on grass. · Sheep that
are not on grass move to a random neighbouring tile hoping to find grass. · If a sheep
is on grass, it stays there for the turn and feeds. When feeding, there is a 20% chance that
all the grass will get consumed. · If a sheep
lives 20 turns, it has a baby. The
baby sheep appears in a neighbouring tile. · Grass tiles
that exist for 50 turns without being visited by a sheep become a forest. · A forest has
a 1% chance of catching Fire. · Fires last
for 3 turns. The tile then becomes
dirt. · A Fire
spreads to neighbouring Forest tiles 20% of the time. It spreads to neighbouring grass tiles 10%
of the time. · And so on… ALTERNATIVE
THEME Pandemic · SIMILAR
COLOURS: Instead of making a tile type a specific colour, make it randomly
choose between a few similar colours.
Instead of all grass tiles being one colour, make grass be a random
green. · SEASONS: Add seasons to your simulation. The first 100 ticks could be summer, the
next 100 could be fall. The next 100,
winter and then 100 for spring. And so
on… Rules can impact elements
differently in different seasons. · RIVER
GENERATION: Start the simulation off
with a randomly generated river that flows across the screen. You can have a lot of fun with this alone. · WEATHER
LAYER: You can have weather elements such as rain and snow that could be
stored as a second grid above the main grid and draw overtop. Another option is to include a weather
status inside each tile. · CAPS: You
can cap the number of a certain element.
This gives you more control over what is happening in the simulation. · MIGRATION:
You can have animals be more likely to move to the south during some seasons
and then to the north during other seasons. · ICE AGE: You
can add an ice age effect that occurs every so often. It could start at the top and work its way
south (or vice versa). · TEMPERATURE: You can give each tile a random
temperature. This temperature could
change over time and could be impacted by its neighbours. You can make the average random temperature
be higher in the center and lower in the poles. Then, you can make the temperature impact
things like plant growth and water evaporation. PRESENTATION
EXPECTATIONS AREAS OF
EVALUATION · Tile class –
Keeps track of what is on a single cell in the grid. It can be a fairly simple class holding a
String value for the type of tile it is (such as “grass”). Or you can add some other data storing
options to keep track of things like animals, weather, age, … · Grid class –
Contains the 2D array of Tile objects.
It contains a draw and update method for the simulation. It also contains a constructor to that will
set the starting stage for the simulation. · Sim class –
This class contains the main function.
You create the Grid class and then loop over the updating and drawing
of the grid. There
are many different ways to create the Tile class. On option is to have a colour for the
ground and another colour for a possible animal that is over it. You can even create draw method in the tile
if you want to. ************************************ Below is an older start up option.
It doesn’t make use of the Tile class though and I now think that the
Tile class approach offers many important benefits. So I discourage the use of the solution
below though it does give good hints at how to start. ************************************ PRELIMINARY
PROBLEMS (OPTIONAL) PROBLEM
#1B Click here for the file. |