Class WorldState
java.lang.Object
za.co.wethinkcode.robots.server.worldinfo.WorldState
A super class that stores a lot of information about the WorldState
-
Constructor Summary
ConstructorsConstructorDescriptionWorldState(String worldID, String IPAddress, int reloadTimeInSeconds, int shieldRepairTimeInSeconds, int maximumShieldInHits, int visibilityInKliks, ArrayList<Obstacle> obstacles, ArrayList<Client> clients, KlikGrid klikGrid, org.apache.commons.collections4.bidimap.DualHashBidiMap<Position, WorldObject> whereEverythingIs) Iteration1 WorldState Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckIfRobotWithThatNameExists(String robotName) Checks the worldState to see if the currentWorldState has that RobotbooleanOveride of worldEqualityClientMain List getterUtility method for getting empty spawn pointsIP address getterKlikGrid getterintGets Maximum Shield for this world as measured in hitsintReload time getter (measured in seconds)@Nullable ServerRobotgetRobotByName(String robotName) Getter for a Robot in the WorldintShield repair time getter (measured in seconds)intGets visbility for this world state as measured in kliksGets when this worldState was madeGetter for when a WorldState is capturedObstacles getterWorldID getterinthashCode()How the worlds are hashed.
-
Constructor Details
-
WorldState
public WorldState(String worldID, String IPAddress, int reloadTimeInSeconds, int shieldRepairTimeInSeconds, int maximumShieldInHits, int visibilityInKliks, ArrayList<Obstacle> obstacles, ArrayList<Client> clients, KlikGrid klikGrid, org.apache.commons.collections4.bidimap.DualHashBidiMap<Position, WorldObject> whereEverythingIs) Iteration1 WorldState Constructor. This will be depreciated and refactored in favor of a WorldConfig Object- Parameters:
worldID- ID of the to worldIPAddress- IP address as a stringreloadTimeInSeconds- how Long It Takes To ReloadshieldRepairTimeInSeconds- how Long it Takes to repair a shieldmaximumShieldInHits- how many hits it takes to destroy a shieldvisibilityInKliks- how many Kliks all robots can seeobstacles- arrayList of obstaclesclients- clientsklikGrid- klikGrid of the World
-
-
Method Details
-
getWorldID
WorldID getter- Returns:
- worldID
-
getObstacles
-
getEmptySpawn
Utility method for getting empty spawn points- Returns:
- a spawn position
- Throws:
WorldFullException
-
getIPAddress
IP address getter- Returns:
- IP address
-
getReloadTimeInSeconds
public int getReloadTimeInSeconds()Reload time getter (measured in seconds)- Returns:
- reload time in seconds
-
getShieldRepairTimeInSeconds
public int getShieldRepairTimeInSeconds()Shield repair time getter (measured in seconds)- Returns:
- shield repair time
-
getWhereEverythingIs
Obstacles getter- Returns:
- a list of all obstacles in the world
-
getklikGrid
KlikGrid getter- Returns:
- a klik grid with its width and height
-
getClients
ClientMain List getter- Returns:
- a list of all Clients and their associated robots
-
getWhenCaptured
Gets when this worldState was made- Returns:
- the instant the worldState was captured
-
getMaximumShieldInHits
public int getMaximumShieldInHits()Gets Maximum Shield for this world as measured in hits- Returns:
- the maximum number of a shield as measured in hits
-
getVisibilityInKliks
public int getVisibilityInKliks()Gets visbility for this world state as measured in kliks- Returns:
- maximum distance all objects can see as measured in kliks
-
checkIfRobotWithThatNameExists
Checks the worldState to see if the currentWorldState has that Robot- Parameters:
robotName- name of the robot being checked- Returns:
- if a robot with that name exists.
-
getRobotByName
Getter for a Robot in the World- Parameters:
robotName- name of the robot being looked for- Returns:
- that robot
- Throws:
NoSuchRobotException- robot cannot be found in the world
-
hashCode
public int hashCode()How the worlds are hashed. Helps provides logical equality between two worldStates -
equals
Overide of worldEquality -
getWhenCapturedAt
Getter for when a WorldState is captured- Returns:
-