Skip to content

GameLogic Package

AmitSheer edited this page Dec 19, 2020 · 12 revisions

Holds classes that communicate with the server and control the game flow.

Structure

Package GameLogic

GameLogic Package Classes

  • Game
    control games flow, communicates with the server and updates relevant classes with data from server
  • GameManager
    organizes data from server
  • Pokemon
    Holds data for location and value of pokemon to catch
  • PokemonTrainer
    Holds data for location, current value and path to nearest pokemon
  • ShortestPath
    Finds the shortest path to an object on the graph using the Algorithms implemented

General Description of Methods, Divided by Class

  • Game

    • startGame(GamePanel panel,int scenario,int id)
      tells the game to run with specific scenario and id
    • isRunning()
      checks if the process of the game is running
    • gameStop()
      stops the game run and the thread that runs it
  • GameManager Plus implemented a getter and setter for each field.

    • updateTrainerPath(List<node_data> pathToPokemon, int trainerId)
      updates the path a trainer needs to follow to catch a pokemon
    • updateEdge(Pokemon fr, directed_weighted_graph g)
      find and updates edge for a pokemon
    • json2Pokemons(String fs, directed_weighted_graph graph)
      converts JSON string of pokemons to a Pokemon Object
    • getTrainers(String aa, directed_weighted_graph gg)
      converts a JSON and updates the current trainers held in GameManager
    • w2f(directed_weighted_graph g, Range2D frame)
      converts game to size to fit new panel size
  • Pokemon_
    Holds all of the data relevant to the Pokemon, location, value and current edge.
    Plus implemented a getter and setter for each field.

  • PokemonTrainer
    Implemented a getter and setter for each field.

    • update(String json)
      updates all of the data of the trainer from JSON format string
  • ShortestPathAlgo

    • findShortestForAgents(GameManager _gm)
      this will find the shortest path on a given graph, while taking into account distance, pokemons on the same edge, taken pokemon and scc
Clone this wiki locally