Skip to content

Class netWorth::ClientInterface

ClassList > netWorth > ClientInterface

Inherits the following classes: netWorth::NetworkingInterface, MainInterface

Public Functions

Type Name
ClientInterface (size_t id, const std::string & name)
bool Initialize () override
size_t SelectAction (const cse491::WorldGrid & grid, const cse491::type_options_t & typeOptions, const cse491::item_map_t & itemMap, const cse491::agent_map_t & agentMap) override

Public Functions inherited from netWorth::NetworkingInterface

See netWorth::NetworkingInterface

Type Name
NetworkingInterface (size_t id, const std::string & name)
the destination port of the machine this communicates with
virtual bool bindSocket (UdpSocket & socket, unsigned short port)
virtual UdpSocket * getSocket ()
virtual bool receivePacket (Packet & pkt, std::optional< IpAddress > & sender, unsigned short & port)
virtual bool sendPacket (Packet packet, IpAddress destAddr, const unsigned short port)

Protected Attributes inherited from netWorth::NetworkingInterface

See netWorth::NetworkingInterface

Type Name
std::optional< IpAddress > m_ip
The socket we are going to make our connection.
unsigned short m_port = = 0
the destination IP of the machine this communicates with
UdpSocket m_socket

Public Functions Documentation

function ClientInterface

inline netWorth::ClientInterface::ClientInterface (
    size_t id,
    const std::string & name
) 

Default constructor (AgentBase)

Parameters:

  • id agent ID
  • name agent name

function Initialize

inline bool netWorth::ClientInterface::Initialize () override

Establish connection with server, initializing interface

Returns:

True if successful, false if error

function SelectAction

inline size_t netWorth::ClientInterface::SelectAction (
    const cse491::WorldGrid & grid,
    const cse491::type_options_t & typeOptions,
    const cse491::item_map_t & itemMap,
    const cse491::agent_map_t & agentMap
) override

Choose action for player agent

Parameters:

  • grid the client-side grid
  • typeOptions different cell types of the world
  • item_map the items that may be apart of the grid
  • agent_map the agents that may be apart of the grid

Returns:

action ID of the interface


The documentation for this class was generated from the following file source/Interfaces/NetWorth/client/ClientInterface.hpp