#include "RobotsBattleDefs.h"
#include "Robot.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

#ifdef WIN32
#define sleep _sleep
#define SLEEPTIME 1000
#else
#include <unistd.h>
#define SLEEPTIME 1
#endif // WIN32

Robot::Robot(){
	sleep(SLEEPTIME);
	srand(time(NULL));
	x = rand() % (RING_WIDTH - 2 * WALL_DISTANCE_ALERT  ) + WALL_DISTANCE_ALERT   ;
	y = rand() % (RING_HEIGHT - 2 * WALL_DISTANCE_ALERT   ) + WALL_DISTANCE_ALERT   ;
	direction = rand() % 360;
	hitPoints = ROBOT_STARTING_LIFE_POINTS;
	status = STOPPED;
}

void Robot::setName(char* name){
	this->name = new char[strlen(name)];
	strcpy(this->name, name);
}


void Robot::Turn(double relAngle){
	direction+=relAngle;
}

