#include "Node.h"
#include <string>

bool Point::operator ==(Point *p){
	return (x == p->x && y == p->y);
}

Node::Node(void)
{
	rightPiece=false;
	this->left = "";
	this->right = "";
	this->up = "";
	this->down = "";
}

Node::Node(int x, int y, int dup, int ddown, int dleft, int dright){
	this->x = x;
	this->y = y;
	this->dir[Node::DIR_UP] = dup;
	this->dir[Node::DIR_DOWN] = ddown;
	this->dir[Node::DIR_LEFT] = dleft;
	this->dir[Node::DIR_RIGHT] = dright;
	this->left = "";
	this->right = "";
	this->up = "";
	this->down = "";
	rightPiece=false;
}

Node::~Node(void)
{
}

bool Node::comp(Node *n){
	return (n->x == x && n->y == y);
}

bool Node::freeDir(){
	return(dir[0] == 0 || dir[1] == 0 || dir[2] == 0 || dir[3] == 0);
}

int Node::cnnts(string name){
	int i=0;
	if(!left.empty() && left.compare(name) != 0){
		i++;
	}
	if(!right.empty() && right.compare(name) != 0){
		i++;
	}
	if(!up.empty() && up.compare(name) != 0){
		i++;
	}
	if(!down.empty() && down.compare(name) != 0){
		i++;
	}
	return i;
}
