KML_Logger - VadimKachevski/OOP_Ex3 GitHub Wiki

This class allows us to export our game and its data as a KML file .

The KML file will keep our data for the highest score thus it maintains the best result of all the rounds so far.

This class is represented by these elements;

  • game_service game – represents the game server from the backround.
  • graph g – represents a graph.
  • Kml k – represents a kml file.
  • Document doc – represents the doucument

This class has one constructor;

public KML_Logger(graph g) – receives a graph.

The rest of this class methods are as follows;

public void setGame(game_service game) – sets the game server up.

public void BuildGraph() – this method using the correct strings allows to build the graph for the kml file.

public void saveToFile(String nameS,String resault) – by a given name and result this function saves the file

public void setFruits(String time,String end) – by a given start string and the end of the string this method sets the fruit by its time of appearance as it will be shown in the KML file.

public void setBots(String time,String end) - – by a given start string and the end of the string this method sets the Bots by its time of appearance as it will be shown in the KML file.

private Hashtable<String, Integer> reader(Feature feat) – this method allows us to have a record of the best result as it takes the result from the prior KML file and that’s how we keep track of the highest result so far. It returns a Hashtable updated with highest results for each level