Burp
Data Structures | Functions
robot.c File Reference
#include "robot.h"
Include dependency graph for robot.c:

Data Structures

struct  robot_impl
 

Functions

double degree_to_radians (double x)
 
robotcreate_robot (double x_1, double y_1, double angle, int speed, int id, char *r_name)
 
void update_pos_robot (robot *rob)
 
void modify_speed (robot *rob, int speed)
 
void modify_angle (robot *rob, double angle)
 
void inflict_damage_from_missile (robot *rob, point p)
 
void inflict_damage_from_collision (robot *rob1, robot *rob2)
 
bool check_collision_robots (robot *rob1, robot *rob2)
 
int get_robot_id (robot *rob)
 
char * get_robot_name (robot *rob)
 
unsigned int get_robot_health_points (robot *rob)
 
double get_robot_angle (robot *rob)
 
bool set_robot_angle (robot *rob, double angle)
 
int get_robot_speed (robot *rob)
 
bool set_robot_speed (robot *rob, int speed)
 
void get_robot_pos (robot *rob, point *pos)
 
int get_robot_nb_missiles (robot *rob)
 
void increment_nb_missile (robot *rob)
 
int get_waiting_time_robot (robot *rob)
 
void set_waiting_time_robot (robot *rob, unsigned int waiting_time)
 
bool poke_memory_at (robot *rob, int data, int pos)
 
int peek_memory_at (robot *rob, int i)
 
void decrement_nb_missile (robot *rob)
 
void destroy_robot (robot **rob)
 

Function Documentation

◆ check_collision_robots()

bool check_collision_robots ( robot rob1,
robot rob2 
)

Take 2 robots [rob1] and [rob2] and will check if there is a collision between them. Return true if there is one, false if there is none.

◆ create_robot()

robot* create_robot ( double  x_1,
double  y_1,
double  angle,
int  speed,
int  id,
char *  r_name 
)

Allocate a robot in memory and assign [x_1] and [y_1] to its coordinate, [angle] as its angle, [speed] as the speed and [id] as the robot number.

Here is the call graph for this function:

◆ decrement_nb_missile()

void decrement_nb_missile ( robot rob)

Decrement the number of missile of the robot [rob] by 1.

◆ degree_to_radians()

double degree_to_radians ( double  x)

take a radius [x] in degree and return its value in radian

◆ destroy_robot()

void destroy_robot ( robot **  rob)

Free a robot allocate in memory.

◆ get_robot_angle()

double get_robot_angle ( robot rob)

Return the angle of the robot [rob].

◆ get_robot_health_points()

unsigned int get_robot_health_points ( robot rob)

Return number of health points of the robot [rob].

◆ get_robot_id()

int get_robot_id ( robot rob)

Return the identifier of the robot [rob].

◆ get_robot_name()

char* get_robot_name ( robot robot)

Return the robot's string name.

◆ get_robot_nb_missiles()

int get_robot_nb_missiles ( robot rob)

Return the number of missiles active of the robot [rob].

◆ get_robot_pos()

void get_robot_pos ( robot rob,
point pos 
)

Put the coordinate as a point of a robot [rob] into a point [pos].

◆ get_robot_speed()

int get_robot_speed ( robot rob)

Return the speed of the robot [rob].

◆ get_waiting_time_robot()

int get_waiting_time_robot ( robot rob)

Return the waiting time of the robot [rob].

◆ increment_nb_missile()

void increment_nb_missile ( robot rob)

Increment the number of missile of the robot [rob] by 1.

◆ inflict_damage_from_collision()

void inflict_damage_from_collision ( robot rob1,
robot rob2 
)

It'll inflict [collision damage] to [rob1] and [rob2] and reduce their speed to 0. Else it'll do nothing.

◆ inflict_damage_from_missile()

void inflict_damage_from_missile ( robot rob,
point  p 
)

Take the position of an explosion [p] and a robot [rob], and will inflict damage relative to his position to the explosion point.

◆ modify_angle()

void modify_angle ( robot rob,
double  angle 
)
Here is the call graph for this function:

◆ modify_speed()

void modify_speed ( robot rob,
int  speed 
)
Here is the call graph for this function:

◆ peek_memory_at()

int peek_memory_at ( robot rob,
int  i 
)

Return the value stocked at the indice i of the robot [rob]'s memory. If an indice is invalid, it'll return -1.

◆ poke_memory_at()

bool poke_memory_at ( robot rob,
int  data,
int  pos 
)

Set the integer [data] to the indice [pos] in the robot [rob]'s memory. If the indice given is invalid (i.e, not contained between 0 and robot_memory), the operation will fail and it'll return false. If the operation succeed, it'll return true.

◆ set_robot_angle()

bool set_robot_angle ( robot rob,
double  angle 
)

Set the robot [rob]'s angle to [angle]. If the angle is invalid (i.e, not contained between 0 and 359), the operation will fail and it'll return false. If the operation succeed, it'll return true.

Here is the call graph for this function:

◆ set_robot_speed()

bool set_robot_speed ( robot rob,
int  speed 
)

Set the robot [rob]'s speed to [speed]. If the speed is invalid (i.e, not contained between 0 and MAX_SPEED), the operation will fail and it'll return false. If the operation succeed, it'll return true.

Here is the call graph for this function:

◆ set_waiting_time_robot()

void set_waiting_time_robot ( robot rob,
unsigned int  waiting_time 
)

set the waiting_time of a robot [rob] to the value of [waiting_time].

◆ update_pos_robot()

void update_pos_robot ( robot rob)

Update the position of a robot [rob] to its next iteration, if he is percuting a wall, it will inflict him [Collision_damage] as defined in define. If there is a waiting time, it'll do nothing and only decrease the current waiting time.

Here is the call graph for this function: