Class World
java.lang.Object
za.co.wethinkcode.robots.server.world.World
The World Class stores all known information about the world
World-level configuration: how many seconds a repair takes.
Defaults to 3 seconds; can be overridden via the constructor or setter.
-
Constructor Summary
ConstructorsConstructorDescriptionWorld(int size, int mazeType) Deprecated.World(int size, int mazeType, int repairTime, int reloadTime) Deprecated.World(WorldConfig config) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if a robot was successfully added to the worldvoidvoiddisconnectRobotsFromClientId(ClientID clientId) Take in aClientIDand remove all bots from the server associated with this clientIDintgetMap()intintgetMaze()intintgetRobotAt(int x, int y) intintgetWidth()booleanisObstacleAt(int x, int y) booleanbooleanisWallAt(int x, int y) voidDeprecated.voidvoidremoveRobot(String name) voidsetRepairTime(int repairTime)
-
Constructor Details
-
World
-
World
Deprecated. -
World
Deprecated.
-
-
Method Details
-
getRepairTime
public int getRepairTime() -
getReloadTime
public int getReloadTime() -
setRepairTime
public void setRepairTime(int repairTime) -
getWidth
public int getWidth() -
getHeight
public int getHeight() -
getVisibility
public int getVisibility() -
getAllRobots
-
getObstacles
-
getMaze
-
getMaxShields
public int getMaxShields() -
getMaxShots
public int getMaxShots() -
getRandomSpawn
-
addRobot
Returns true if a robot was successfully added to the worldPlease note that the current implementation utilizes a random spawn
- Parameters:
robot- the robot being added to the world- Returns:
- if the robot was added
-
getRobot
-
removeRobot
-
removeAllRobots
public void removeAllRobots() -
isValidPosition
-
isWallAt
public boolean isWallAt(int x, int y) -
isObstacleAt
public boolean isObstacleAt(int x, int y) -
getRobotAt
-
getMap
- Returns:
- the WorldMap for this world, for callers that want to work with spatial queries directly rather than through World's delegating methods above.
-
clearForTesting
public void clearForTesting() -
printWorld
Deprecated.Maintained for backward compatibility. Shallow call toServerRenderer.printWorld(World) -
disconnectRobotsFromClientId
Take in aClientIDand remove all bots from the server associated with this clientID- Parameters:
clientId- the of theConnectedClientwho launched these robots;
-