Class World

java.lang.Object
  extended byWorld

public class World
extends Object

World keeps track of the tribes

Version:
20050607
Author:
Peter Gadfort

Field Summary
private  String filePath
          Path to the input file
private  Tribe[] tribes
          List of tribes in the world
private  char[][] world
          Text representation of the world
private  int x
          Width of the world
private  int y
          Height of the world
 
Constructor Summary
World(String filePath)
          Constructor for objects of class World
 
Method Summary
 int countPopulation()
          Counts the total population of the world
 void nextGeneration()
          Runs the next generation of the world
 void save()
          Saves the world to the input text file
 String toString()
          Returns the text representation of the world
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tribes

private Tribe[] tribes
List of tribes in the world


x

private int x
Width of the world


y

private int y
Height of the world


world

private char[][] world
Text representation of the world


filePath

private String filePath
Path to the input file

Constructor Detail

World

public World(String filePath)
Constructor for objects of class World

Method Detail

nextGeneration

public void nextGeneration()
Runs the next generation of the world


countPopulation

public int countPopulation()
Counts the total population of the world

Returns:
Number of people in the world

toString

public String toString()
Returns the text representation of the world

Returns:
String representation of the world

save

public void save()
Saves the world to the input text file