Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Agent Class Reference

#include <agent.h>

Inheritance diagram for Agent:

AgentDemonstrator AgentPolice AgentRobber List of all members.

Public Types

enum  agent_state_t { AGENT_BORN, AGENT_LIVE, AGENT_DIE }

Public Member Functions

 Agent (Kernel &kernel, Environment &env, int x, int y, Role_t role)
 < OpenCity's specifics
void receiveMessage (const Message &msg)
void sendMessage (Role_t role, const Message &msg)
void sendMessageToAgent (AgentID_t agent, const Message &msg)
virtual void processMessage ()
virtual void born ()
virtual void live ()
virtual void die ()
unsigned int getX () const
unsigned int getY () const
AgentlookForAgent (direction_t dir, unsigned long max_distance)
AgentID_t getId () const
Role_t getRole () const
bool moveDirection ()
bool move (int x, int y)
bool canMove (int x, int y) const
bool canMove (direction_t dir, int &x, int &y) const
bool canMove (direction_t dir) const
bool randomMove (int turn_percent=60)
virtual void output (std::ostream &os) const
const OPENCITY_GRAPHIC_CODE GetGraphicCode () const
void SetGraphicCode (const OPENCITY_GRAPHIC_CODE gc)

Protected Member Functions

bool doRandomMove (int turn_percent)

Protected Attributes

Kernelm_kernel
Environmentm_environment
int m_x
int m_y
direction_t m_direction
unsigned int m_move_speed
Role_t m_role
agent_state_t m_agent_state
std::list< Messagem_messages
OPENCITY_GRAPHIC_CODE m_enumGC
 OpenCity's graphic code.

Private Attributes

AgentID_t m_id

Friends

std::ostream & operator<< (std::ostream &os, const Agent &agent)

Detailed Description

This interface shows common methods of all agents in a Multi-Agent System
Author:
Victor STINNER

Definition at line 51 of file agent.h.


Member Function Documentation

const OPENCITY_GRAPHIC_CODE Agent::GetGraphicCode  )  const
 

Returns the OpenCity's GRAPHIC_CODE of the agent

Definition at line 264 of file agent.cpp.

References m_enumGC.

bool Agent::moveDirection  ) 
 

Move the agent accordingly to the current direction

Returns:
true if the agent has move, false otherwise

Definition at line 287 of file agent.cpp.

Referenced by randomMove().

bool Agent::randomMove int  turn_percent = 60  ) 
 

Move the agent randomly

Returns:
true if the agent has move, false otherwise

Definition at line 123 of file agent.cpp.

References moveDirection().


The documentation for this class was generated from the following files:
Generated on Sat Nov 11 10:21:10 2006 for OpenCity by  doxygen 1.4.2