Skip to content

Classes and UML Diagram

idobar1403 edited this page Jan 8, 2022 · 4 revisions

Classes

Arena class

The Arena class holds:

  • pokemons_lst - The list that contains the pokemons.
  • agents_lst - The list of agents.
  • graph_algo - The graph algo class.
  • info_dict - The dict that has the info of the game.
  • dijkstra_list - Dictionary that every key is the node id and the value is list with the shortest weight of the path between this node to every other node.
  • client - the client of the game.

The Arena class functions:

  1. init - Initialize the arena class from the info we got from the client.
  2. update_pokemons_lst - Update the arena.pokemon_lst with the given json from the client.
  3. update_agent_lst - Update the agents values from the client.get_agents
  4. place_agents_at_beginning - Create the agents and place them at the nodes that has the most pokemons near them.
  5. update_game_info - Update the game info from the client.

Play_game class

The Play_game holds:

  • moves - counts the moves the client made.
  • grade - sums the grade of the game.

The Play_game class functions:

  1. AllocateAgent - allocate agent to given pokemon.
  2. get_all_permutations - give list and return all the permutations of the list.
  3. calculate_time_of_path - using the dijkstra dictionary to calculate the weight of the path.
  4. dist_between_points - given two points it return the dist between the two points.
  5. thread_function - the thread that sleeps and activate the move method from the client. It is responsible for the movement of the nodes, and eating the pokemons.
  6. run_game - runs the game.

UML

Screenshot

| Our Unified Modeling Language representation |

Note: We have subtracted all the DiGraph and GraphAlgo classes for which the implementation is identical to Ex3. You may find that full UML Here

Clone this wiki locally