Skip to content

Class group6::GenerativeWorld

ClassList > group6 > GenerativeWorld

Inherits the following classes: WorldBase

Public Functions

Type Name
void AStarAgentHelper (AgentBase & agent)
void AddArmory ()
void AddTeleporters ()
void AgentCollisionHelper (AgentBase & agent)
void ArmoryTileHelper (AgentBase & agent)
int DoAction (AgentBase & agent, size_t action_id) override
void DoorTileHelper (AgentBase & agent)
void EndGame (bool win)
GenerativeWorld (BiomeType biome, unsigned int width, unsigned int height, unsigned int seed)
void HoleTileHelper (AgentBase & agent, GridPosition & new_position)
bool IsTraversable (const AgentBase &, cse491::GridPosition pos) override const
void ItemHelper (AgentBase & agent, GridPosition & new_position)
void KeyTileHelper (AgentBase & agent, GridPosition & new_position)
void SpikeTileHelper (AgentBase & agent)
void TarTileHelper (AgentBase & agent)
void TeleporterHelper (GridPosition & new_position)
~GenerativeWorld () override

Public Static Functions

Type Name
vector< GridPosition > FindTiles (WorldGrid grid, size_t tile_id)

Protected Types

Type Name
enum ActionType

Protected Attributes

Type Name
size_t armory_id
Easy access to armory CellTypeID.
size_t dirt_id
Easy access to dirt CellTypeID.
size_t door_id
Easy access to door CellTypeID.
size_t floor_id
Easy access to floor CellType ID.
size_t grass_id
Easy access to grass CellTypeID.
size_t hole_id
Easy access to hole CellTypeID.
size_t key_id
Easy access to key CellTypeID.
size_t sand_id
Easy access to sand CellTypeID.
size_t spike_id
Easy access to spike CellType ID.
size_t tar_id
Easy access to tar CellTypeID.
size_t teleporter_id
Easy access to teleporter CellTypeId.
size_t tree_id
Easy access to tree CellTypeID.
size_t wall_id
Easy access to wall CellType ID.
size_t water_id
Easy access to water CellTypeID.
unsigned int world_height
unsigned int world_width

Protected Functions

Type Name
void ConfigAgent (AgentBase & agent) override
void CreateGrid (BiomeType biome, unsigned int width, unsigned int height, unsigned int seed, const string & file)
void DamageAgent (AgentBase & agent)

Public Functions Documentation

function AStarAgentHelper

inline void group6::GenerativeWorld::AStarAgentHelper (
    AgentBase & agent
) 

function AddArmory

inline void group6::GenerativeWorld::AddArmory () 

Adds armory tiles to grid

function AddTeleporters

inline void group6::GenerativeWorld::AddTeleporters () 

Adds teleporters to map

function AgentCollisionHelper

inline void group6::GenerativeWorld::AgentCollisionHelper (
    AgentBase & agent
) 

Collision testing functionality

Parameters:

  • agent agent performing action

function ArmoryTileHelper

inline void group6::GenerativeWorld::ArmoryTileHelper (
    AgentBase & agent
) 

Helper function for armory functionality

Parameters:

  • agent agent performing action

function DoAction

inline int group6::GenerativeWorld::DoAction (
    AgentBase & agent,
    size_t action_id
) override

Handles logic for agent movement

Parameters:

  • agent The agent attempting to do an action
  • action_id The action being performed

Returns:

1 if the action was successful. 0 if it was not

function DoorTileHelper

inline void group6::GenerativeWorld::DoorTileHelper (
    AgentBase & agent
) 

Helper function for door tile functionality

Parameters:

  • agent agent performing action

function EndGame

inline void group6::GenerativeWorld::EndGame (
    bool win
) 

Ends the game

Parameters:

  • win True if the game is ending in a win. False if it is a loss

function GenerativeWorld

inline explicit group6::GenerativeWorld::GenerativeWorld (
    BiomeType biome,
    unsigned int width,
    unsigned int height,
    unsigned int seed
) 

function HoleTileHelper

inline void group6::GenerativeWorld::HoleTileHelper (
    AgentBase & agent,
    GridPosition & new_position
) 

Helper function for hole tile functionality

Parameters:

  • agent agent performing action
  • new_position new position agent is moving to

function IsTraversable

inline bool group6::GenerativeWorld::IsTraversable (
    const AgentBase &,
    cse491::GridPosition pos
) override const

Boolean function for traversable tiles in maze

Parameters:

  • agent agent performing action
  • pos position of tile

function ItemHelper

inline void group6::GenerativeWorld::ItemHelper (
    AgentBase & agent,
    GridPosition & new_position
) 

Helper function for item pickup functionality

Parameters:

  • agent agent performing action
  • new_position new position agent is moving to

function KeyTileHelper

inline void group6::GenerativeWorld::KeyTileHelper (
    AgentBase & agent,
    GridPosition & new_position
) 

Helper function for key tile functionality

Parameters:

  • agent agent performing action
  • new_position new position agent is moving to

function SpikeTileHelper

inline void group6::GenerativeWorld::SpikeTileHelper (
    AgentBase & agent
) 

Helper function for spike tile functionality

Parameters:

  • agent agent performing action

function TarTileHelper

inline void group6::GenerativeWorld::TarTileHelper (
    AgentBase & agent
) 

Helper function for tar tile functionality

Parameters:

  • agent agent performing action

function TeleporterHelper

inline void group6::GenerativeWorld::TeleporterHelper (
    GridPosition & new_position
) 

Helper function for armory functionality

Parameters:

  • agent agent performing action
  • new_position new position agent is moving to

function ~GenerativeWorld

group6::GenerativeWorld::~GenerativeWorld () override

Public Static Functions Documentation

function FindTiles

static inline vector< GridPosition > group6::GenerativeWorld::FindTiles (
    WorldGrid grid,
    size_t tile_id
) 

Protected Types Documentation

enum ActionType

enum group6::GenerativeWorld::ActionType {
    REMAIN_STILL = 0,
    MOVE_UP,
    MOVE_DOWN,
    MOVE_LEFT,
    MOVE_RIGHT
};

Protected Attributes Documentation

variable armory_id

size_t armory_id;

variable dirt_id

size_t dirt_id;

variable door_id

size_t door_id;

variable floor_id

size_t floor_id;

variable grass_id

size_t grass_id;

variable hole_id

size_t hole_id;

variable key_id

size_t key_id;

variable sand_id

size_t sand_id;

variable spike_id

size_t spike_id;

variable tar_id

size_t tar_id;

variable teleporter_id

size_t teleporter_id;

variable tree_id

size_t tree_id;

variable wall_id

size_t wall_id;

variable water_id

size_t water_id;

variable world_height

unsigned int world_height;

variable world_width

unsigned int world_width;

Protected Functions Documentation

function ConfigAgent

inline void group6::GenerativeWorld::ConfigAgent (
    AgentBase & agent
) override

Provide the agent with movement actions.

Parameters:

  • agent The agent being configured

function CreateGrid

inline void group6::GenerativeWorld::CreateGrid (
    BiomeType biome,
    unsigned int width,
    unsigned int height,
    unsigned int seed,
    const string & file
) 

Creates a new grid with the given parameters

Parameters:

  • biome The BiomeType being used
  • width The width of the grid
  • height The height of the grid
  • seed The seed used for random generation
  • file The file to save the grid to. Full path is "../assets/grids/generated_[file].grid"

function DamageAgent

inline void group6::GenerativeWorld::DamageAgent (
    AgentBase & agent
) 

Ends game if agent is the player

Parameters:

  • agent The agent being damaged

The documentation for this class was generated from the following file source/Worlds/GenerativeWorld.hpp