simulations.core
Class Game

java.lang.Object
  extended by simulations.core.Game

public class Game
extends java.lang.Object

This class describes the game structure


Constructor Summary
Game(java.util.ArrayList playerList, long randomSeed, int loosingPoints, float winnerPoints, float coalitionPoints, boolean proportional, int traceLevel, java.io.File historyFile, java.io.File graphFile, int coalitionDefinition, boolean noSave, boolean coalSave)
          Creates a new instance of Game
 
Method Summary
 java.util.ArrayList getClonePlayerList()
          Return the list of all player The list is a clone
 java.util.ArrayList getCloneRemainingPlayer()
          Return the list of all player with more than 1 HP The list is a clone
 int getCoalitionDefinition()
          Getter for property coalitionDefinition.
 float getCoalitionPoints()
          Getter for property coalitionPoints.
 java.io.File getGraphFile()
          Getter for property graphFile.
 java.io.File getHistoryFile()
          Getter for property historyFile.
 int getLoosingPoints()
          Getter for property loosingPoints.
 Player getPlayer(Player p)
          Returns the Player corresponding to p
 java.util.ArrayList getPlayerList()
          Getter for property playerList.
 long getRandomSeed()
          Getter for property randomSeed.
 java.util.ArrayList getRemainingPlayer()
          Return the list of all player with more than 1 HP
 java.lang.String getStringCoalitionDefinition()
          Return the string description of the coalition definition
 int getTraceLevel()
          Getter for property trace_level.
 float getWinnerPoints()
          Getter for property winnerPoints.
 boolean isCoalitionSave()
          Getter for property coalitionSave.
 boolean isFinish()
          Return true if the game is finish
 boolean isNoSave()
          Getter for property noSave.
 boolean isProportional()
          Getter for property proportional.
 void setCoalitionDefinition(int coalitionDefinition)
          Setter for property coalitionDefinition.
 void setCoalitionPoints(float coalitionPoints)
          Setter for property coalitionPoints.
 void setCoalitionSave(boolean coalitionSave)
          Setter for property coalitionSave.
 void setGraphFile(java.io.File graphFile)
          Setter for property graphFile.
 void setHistoryFile(java.io.File historyFile)
          Setter for property historyFile.
 void setLoosingPoints(int loosingPoints)
          Setter for property loosingPoints.
 void setNoSave(boolean noSave)
          Setter for property noSave.
 void setPlayerList(java.util.ArrayList playerList)
          Setter for property playerList.
 void setProportional(boolean proportional)
          Setter for property proportional.
 void setRandomSeed(long randomSeed)
          Setter for property randomSeed.
 void setTraceLevel(int traceLevel)
          Setter for property trace_level.
 void setWinnerPoints(float winnerPoints)
          Setter for property winnerPoints.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Game

public Game(java.util.ArrayList playerList,
            long randomSeed,
            int loosingPoints,
            float winnerPoints,
            float coalitionPoints,
            boolean proportional,
            int traceLevel,
            java.io.File historyFile,
            java.io.File graphFile,
            int coalitionDefinition,
            boolean noSave,
            boolean coalSave)
Creates a new instance of Game

Parameters:
graphFile - The file to save graph
loosingPoints - The points loosing by the attacked player
winnerPoints - The proportion (%) of the loosingPoints earn by the attacking player
coalitionPoints - The proportion (%) of the loosingPoints earn by the players helping the attacking player
proportional - true if the reditributed points are reditributed proportionnaly between the players helping the attack
traceLevel - The trace level of the history
playerList - The list of all players
randomSeed - The random seed for the random generator
historyFile - The history file
coalitionDefinition - The definition of a coalition
noSave - true if the game will not save the history
coalitionSave - true if the game will save coalition data
Method Detail

isFinish

public boolean isFinish()
Return true if the game is finish

Returns:
true if it leave only one player with more than 1 HP

getCloneRemainingPlayer

public java.util.ArrayList getCloneRemainingPlayer()
Return the list of all player with more than 1 HP The list is a clone

Returns:
The list of remaining players

getClonePlayerList

public java.util.ArrayList getClonePlayerList()
Return the list of all player The list is a clone

Returns:
The list of players

getPlayer

public Player getPlayer(Player p)
Returns the Player corresponding to p

Parameters:
p - The player
Returns:
The player p

getRemainingPlayer

public java.util.ArrayList getRemainingPlayer()
Return the list of all player with more than 1 HP

Returns:
The list of remaining players

getPlayerList

public java.util.ArrayList getPlayerList()
Getter for property playerList.

Returns:
Value of property playerList.

setPlayerList

public void setPlayerList(java.util.ArrayList playerList)
Setter for property playerList.

Parameters:
playerList - New value of property playerList.

getRandomSeed

public long getRandomSeed()
Getter for property randomSeed.

Returns:
Value of property randomSeed.

setRandomSeed

public void setRandomSeed(long randomSeed)
Setter for property randomSeed.

Parameters:
randomSeed - New value of property randomSeed.

getWinnerPoints

public float getWinnerPoints()
Getter for property winnerPoints.

Returns:
Value of property winnerPoints.

setWinnerPoints

public void setWinnerPoints(float winnerPoints)
Setter for property winnerPoints.

Parameters:
winnerPoints - New value of property winnerPoints.

isProportional

public boolean isProportional()
Getter for property proportional.

Returns:
Value of property proportional.

setProportional

public void setProportional(boolean proportional)
Setter for property proportional.

Parameters:
proportional - New value of property proportional.

getLoosingPoints

public int getLoosingPoints()
Getter for property loosingPoints.

Returns:
Value of property loosingPoints.

setLoosingPoints

public void setLoosingPoints(int loosingPoints)
Setter for property loosingPoints.

Parameters:
loosingPoints - New value of property loosingPoints.

getCoalitionPoints

public float getCoalitionPoints()
Getter for property coalitionPoints.

Returns:
Value of property coalitionPoints.

setCoalitionPoints

public void setCoalitionPoints(float coalitionPoints)
Setter for property coalitionPoints.

Parameters:
coalitionPoints - New value of property coalitionPoints.

getTraceLevel

public int getTraceLevel()
Getter for property trace_level.

Returns:
Value of property trace_level.

setTraceLevel

public void setTraceLevel(int traceLevel)
Setter for property trace_level.

Parameters:
traceLevel - The trace level

getHistoryFile

public java.io.File getHistoryFile()
Getter for property historyFile.

Returns:
Value of property historyFile.

setHistoryFile

public void setHistoryFile(java.io.File historyFile)
Setter for property historyFile.

Parameters:
historyFile - New value of property historyFile.

getCoalitionDefinition

public int getCoalitionDefinition()
Getter for property coalitionDefinition.

Returns:
Value of property coalitionDefinition.

getStringCoalitionDefinition

public java.lang.String getStringCoalitionDefinition()
Return the string description of the coalition definition

Returns:
the string description of the coalition definition

setCoalitionDefinition

public void setCoalitionDefinition(int coalitionDefinition)
Setter for property coalitionDefinition.

Parameters:
coalitionDefinition - New value of property coalitionDefinition.

getGraphFile

public java.io.File getGraphFile()
Getter for property graphFile.

Returns:
Value of property graphFile.

setGraphFile

public void setGraphFile(java.io.File graphFile)
Setter for property graphFile.

Parameters:
graphFile - New value of property graphFile.

isNoSave

public boolean isNoSave()
Getter for property noSave.

Returns:
Value of property noSave.

setNoSave

public void setNoSave(boolean noSave)
Setter for property noSave.

Parameters:
noSave - New value of property noSave.

isCoalitionSave

public boolean isCoalitionSave()
Getter for property coalitionSave.

Returns:
Value of property coalitionSave.

setCoalitionSave

public void setCoalitionSave(boolean coalitionSave)
Setter for property coalitionSave.

Parameters:
coalitionSave - New value of property coalitionSave.