# Class World¶

## Class Documentation¶

class World

This file defines the members and methods implemented as part of the World class.

This class represents a Minecraft world as a list of axis aligned bounding boxes and blocks.

Subclassed by GridWorld, ZombieWorld

Public Functions

std::vector<AABB*> &getAABBList()

Returns the vector that holds the AABBs.

Return

vector<AABB*>& The AABB list

std::vector<Block*> &getBlockList()

Returns the vector that holds the Blocks.

Return

vector<Block*>& The Block list

std::vector<Entity*> &getEntityList()

Returns the Entity vector for this World.

Return

std::vector<Entity*>& The Entity list

std::vector<Object*> &getObjectList()

Returns the Object vector for this World.

Return

std::vector<Object*>& The object list

std::vector<Connection*> &getConnectionList()

Returns the Connection vector for this World.

Return

std::vector<Connection*>& The connection list

void addAABB(AABB &aabb)

Add an AABB to the vector of AABB held inside the world.

Parameters
• aabb: The AABB to add

void addEntity(Entity &entity)

Add an Entity for this world to keep track of.

Parameters
• entity: The Entity object

void addBlock(Block &block)

Add a Block to the vector of Block held inside the world.

Parameters
• block: The Block to add

void addObject(Object &object)

Add an object to the vector of object held inside the world.

Parameters
• object: The object to add

void addConnection(Connection &connection)

Add an connection to the vector of connection held inside the world.

Parameters
• connection: The connection to add

std::string toLowLevelMapJSON()

Converts the world into its alternate JSON representation with each entry indented by 4 and returns the string representation of it.

Return

string The JSON as a string

std::string toSemanticMapJSON()

Converts the world into a JSON representation with each entry indented by 4 and returns the string representation of it.

Return

string The JSON as a string

void writeToFile(std::string jsonPath, std::string lowLevelMapJSONPath)

Writes the world’s JSON and alternate JSON output to the given filepaths.

Parameters
• jsonPath: Path to store json

• lowLevelMapJSONPath: Path to store the alternate json representation

World()

Construct a new World object.

std::mt19937_64 &getRandom()

Get the random object used by this generator.

Return

std::mt19937_64& The random object

void setRandom(int seed)

Set the seed the random object used by this class is initialized with.

Parameters
• seed: The seed to use.

~World()

Destroy the World object.