Class Tribe

java.lang.Object
  extended byTribe

public class Tribe
extends Object

Write a description of class Tribe here.

Version:
20050607
Author:
Peter Gadfort

Field Summary
private  char symbol
          Symbol for the tribe
private  int[][] world
          Represenation of the world for the tribe to use
 
Constructor Summary
Tribe(String data, int x, int y)
          Constructor for objects of class Tribe
 
Method Summary
 int countNeighbors(int x, int y)
          Returns the number of neighbors of the indecated point
 int countPopulation()
          Returns the population count for the tribe
 char getSymbol()
          Returns the symbolf for the tribe
 char[][] getWorld()
          Returns the world of the tribe
 void nextGeneration()
          Runs the next generation
 String toFile()
          Returns the string that is written to the file
 void war(char Winner, int x, int y)
          Declares the winner of the war
 int war(int x, int y)
          Decleares war in the indecated point
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

symbol

private char symbol
Symbol for the tribe


world

private int[][] world
Represenation of the world for the tribe to use

Constructor Detail

Tribe

public Tribe(String data,
             int x,
             int y)
Constructor for objects of class Tribe

Parameters:
data - Input data string from the input file
x - Width of the world
y - Height of the world
Method Detail

nextGeneration

public void nextGeneration()
Runs the next generation


war

public int war(int x,
               int y)
Decleares war in the indecated point

Parameters:
x - X position of the war
y - Y position of the war
Returns:
Strength of the point

countPopulation

public int countPopulation()
Returns the population count for the tribe

Returns:
Number of people in the tribe

countNeighbors

public int countNeighbors(int x,
                          int y)
Returns the number of neighbors of the indecated point

Parameters:
x - X position of the war
y - Y position of the war
Returns:
Number of neighbors

getSymbol

public char getSymbol()
Returns the symbolf for the tribe

Returns:
Symbol of the tribe

war

public void war(char Winner,
                int x,
                int y)
Declares the winner of the war

Parameters:
Winner - Winner symbol of the war
x - X position of the war
y - Y position of the war

getWorld

public char[][] getWorld()
Returns the world of the tribe

Returns:
World as seen by the tribe

toFile

public String toFile()
Returns the string that is written to the file

Returns:
String representation of the tribe to be written to the input file