#ifndef _graph_h_
#define _graph_h_

// A Graph object holds a vector of pointers to City objects, the
// cities in the graph.  Objects of type Person may be added to the
// graph in the role of evader or pursuer.  There is at most one
// evader at a time.  Person objects move along the links in the
// graph, one step per time tick.  If the evader and a pursuer are in
// the same city at the end of a tick, the game is over.

#include <iostream>
#include <vector>
#include <string>
using namespace std;

#include "person.h"
#include "city.h"  

class Graph {

public:
  Graph();
  ~Graph();

  // ACCESSORS
  City* get_city(const string& name) const;
  Person* get_evader() const { return m_evader; }
  vector<Person*> get_pursuers() const { return m_pursuers; }

  // MODIFIERS
  // each return true if command was successful
  bool add_city(const string& city_name);
  bool remove_city(const string& city_name);
  bool add_link(const string& city_name1, const string& city_name2);
  bool remove_link(const string& city_name1, const string& city_name2);
  bool place_pursuer(const string& person_name, const string& city_name);
  bool place_evader(const string& person_name, const string& city_name);

  // Move the evader & pursuers.  Return false if the evader has been caught.
  bool tick(); 

  // OUTPUT
  friend ostream& operator<<(ostream &ostr, const Graph &city_graph);

 private:  

  // ==============
  // REPRESENTATION
  vector<City*> m_cities;
  Person* m_evader;
  vector<Person*> m_pursuers;
};

// These functions are defined in the files evader.cpp and pursuer.cpp
City* evader_choice(Person *p, Graph *city_graph);
City* pursuer_choice(Person *p, Graph *city_graph);

#endif

