Skip to content
neta-r edited this page Dec 19, 2020 · 3 revisions

CL_Agents

This class represents a single occurence of an agent inside the game.

Data Structors & Fields

  • id - represents the unique id of a specific agent.
  • pos - represents the current geo location of the agent.
  • speed - represents the speed of the agent , it increaces as the agent "eat" more pokemons.
  • current edge represents the edge on which agent is currently on.
  • current node represents the node on which the agent is currently on , if its on the middle of the edge then current node represents the source node of said edge.
  • directed weighted graph - the graph on which the agent operats on.
  • current fruit - represents the current pokemon the agent is headed to.
  • value - the value of the agent , the value is increased by "eating" more pokemons.
  • path - the path of the agent from it's current node to the destination node of the current pokemon.
  • lastEaten - a String which saves the geolocation of the last eaten pokemon , it is used later to check if the agent is "stuck " on a pokemon and cant eat it.

Functions:

  • normal Constructor - for a new agent, initialize the graph, the value , current node, position , id , path , and speed.
  • update - update the current agent in refrence to the status of the game and server , it receive the current agent status via the server in JSON format and translate it to an agent object.
  • toJSON - turns the current agent's status and values to JSON.
  • SDT - a function which have a getter and setter , it receive a long and pokemon and if the said pokemon is a pokemon in which the agent is having a hard time to eat , SDT caculates the new number to send to the server so the agent will succeed to eat the pokemon.
  • getters and setters for curr edge, curr fruit, path , value , speed, last eaten,id and geolocation.

Menu

Clone this wiki locally