#include #include enum{seek,hotseek,avoid,hotavoid,follow}; //used for mode of PNetwork //seek and hotseek will send people to the communicated targets //avoid and hotavoid will send people away from the communicated targets //follow is like seek but it doesn't send people RIGHT at the target class point { protected: float x,y; public: point(float ex, float why) { x=ex; y=why; } point(){} point(const point &that) { x=that.x; y=that.y; } float get_x(){ return x;} float get_y(){ return y;} void set_x(float ex){ x=ex;} void set_y(float ey){ y=ey;} point operator+(const point &that) { point *joe = new point(this->x+that.x, this->y+that.y); return *joe; } point operator*(float joe) { point *bob = new point(this->x*joe, this->y*joe); return *bob; } point operator/(float joe) { point *bob = new point(this->x/joe, this->y/joe); return *bob; } bool operator==(const point &joe) { if(joe.x==x) if(joe.y==y) return true; return false; } void operator=(const point &joe) { this->x=joe.x; this->y=joe.y; } void operator=(point *joe) { this->x=joe->x; this->y=joe->y; } void print() { cout<<"("< class weight_list { private: T* data; float* weight; int current; int num_elem; int cap_size; public: weight_list(int size) { cap_size=size; current=0; num_elem=0; data = new T[cap_size]; weight = new float[cap_size]; } void add(T d, float w) { data[current]=d; weight[current]=w; current++; if(current==cap_size) current=0; num_elem++; if(num_elem==cap_size) num_elem=cap_size; } T sum() { if(num_elem==0) return *(new T()); T temp=data[0]*weight[0]; float d = weight[0]; for(int i = 1; i < num_elem; i++) { temp = temp+data[i]*weight[i]; d+=weight[i]; } return temp/d; } };