Burp
Functions
commands.h File Reference
#include "robot.h"
#include "missile.h"
#include "arene.h"
#include "../../define.h"
Include dependency graph for commands.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int wait_robot (robot *rob, unsigned int delay)
 
bool poke (robot *rob, int addr, int value)
 
int peek (robot *rob, int addr)
 
int go_to (int num)
 
int randoms (int num)
 
int cardinal (arena *arena)
 
int self (robot *rob)
 
int state (arena *arena, int num)
 
int speed (robot *rob)
 
double gpsx (arena *arena, int num)
 
double gpsy (arena *arena, int num)
 
void engine (robot *rob, double angle, double speed)
 
bool shoot (robot *rob, arena *arena, double angle, double explo_dist)
 
double angle (double x1, double y1, double x2, double y2)
 
double targetx (double x1, double angle, double length)
 
double targety (double y1, double angle, double length)
 
double distance (double x1, double y1, double x2, double y2)
 

Function Documentation

◆ angle()

double angle ( double  x1,
double  y1,
double  x2,
double  y2 
)

Calculate the angle corresponding to the line from [x1,y2] to [x2,y2]. If [x1,y1] == [x2,y2] it'll for now return an angle of 90°c.

Here is the call graph for this function:

◆ cardinal()

int cardinal ( arena arena)

return the number of active robot in the arena [arena].

Here is the call graph for this function:

◆ distance()

double distance ( double  x1,
double  y1,
double  x2,
double  y2 
)

Return the distance between [x1,y1] and [x2,y2].

◆ engine()

void engine ( robot rob,
double  angle,
double  speed 
)

Start a robot [rob]'s engine and set his angle to [angle] and speed to [speed].

Here is the call graph for this function:

◆ go_to()

int go_to ( int  num)

return num.

◆ gpsx()

double gpsx ( arena arena,
int  num 
)

return the x coordinate of the robot contained the id [num] in the arena [arena]. Return -1 if no robot has the id [num].

Here is the call graph for this function:

◆ gpsy()

double gpsy ( arena arena,
int  num 
)

return the y coordinate of the robot contained the id [num] in the arena [arena]. Return -1 if no robot has the id [num].

Here is the call graph for this function:

◆ peek()

int peek ( robot rob,
int  addr 
)

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

Here is the call graph for this function:

◆ poke()

bool poke ( robot rob,
int  addr,
int  value 
)

Set the integer [value] to the indice [addr] 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.

Here is the call graph for this function:

◆ randoms()

int randoms ( int  num)

Return a random number between 0 and [num].

◆ self()

int self ( robot rob)

return the id of the robot [rob].

Here is the call graph for this function:

◆ shoot()

bool shoot ( robot rob,
arena arena,
double  angle,
double  explo_dist 
)

Shoot a missile from rob and add it to arena while assigning the angle [angle] and the explosion_distant [explo_dist] to the missile. If the robot has already NB_ROBOT_MISSILES active in the arena, the operation will fail and return false. If the operation succeed, it'll return true.

Here is the call graph for this function:

◆ speed()

int speed ( robot rob)

return the speed of the robot [rob].

Here is the call graph for this function:

◆ state()

int state ( arena arena,
int  num 
)

return the number of health_points of the robot contained the id [num] in the arena [arena]. Return -1 if no robot has the id [num].

Here is the call graph for this function:

◆ targetx()

double targetx ( double  x1,
double  angle,
double  length 
)

Return the next coordinate X considering a x [x1] looking at [angle] which move at the speed [length].

Here is the call graph for this function:

◆ targety()

double targety ( double  y1,
double  angle,
double  length 
)

Return the next coordinate Y considering a y [y1] looking at [angle] which move at the speed [length].

Here is the call graph for this function:

◆ wait_robot()

int wait_robot ( robot rob,
unsigned int  delay 
)

set the robot [rob] is waiting time to [delay] and return its value.

Here is the call graph for this function: