Starship Code Contest  0.1
A real student nightmare...
Data Structures | Typedefs | Functions
acquisition.h File Reference

Haeder file for the acquisition functionalities. More...

Go to the source code of this file.

Data Structures

struct  Decision_frame
 This structure gathers the information needed to pilot a starship each frame. More...
 
struct  View_starship
 This structure gathers information scaned by the radar about other starships. More...
 
struct  View_missile
 This structure gathers information scaned by the radar about missiles. More...
 

Typedefs

typedef void(* AI) (Decision_frame *f)
 

Functions

double get_x (char *me)
 Get the position in absicca of the starship piloted by the plugin me. More...
 
double get_y (char *me)
 Get the position in ordinate of the starship piloted by the plugin me. More...
 
int get_life (char *me)
 Get the life of the starship piloted by the plugin me. More...
 
int get_speed (char *me)
 Get the gear of the starship piloted by the plugin me. More...
 
int get_nb_team (char *me)
 Get the number of the team of the starship piloted by the plugin me. More...
 
int get_gun_status (char *me)
 Get the number of frames needed to reload the gun of the starship piloted by the plugin me. More...
 
double get_move_angle (char *me)
 Get the moving angle of the starship piloted by the plugin me. More...
 
double get_gun_angle (char *me)
 Get the angle of the gun of the starship piloted by the plugin me. More...
 
double get_radar_angle (char *me)
 Get the angle of the radar of the starship piloted by the plugin me. More...
 
void get_scan_from_radar (char *me, View_starship **S, int *nb_starship, View_missile **M, int *nb_missile)
 Set information that the radar can get in its current position. More...
 

Detailed Description

Haeder file for the acquisition functionalities.

Version
0.1
Author
Nicolas Borie ( nicolas dot borie at u-pem dot fr )
Date
10 march 2014

Definition in file acquisition.h.

Function Documentation

◆ get_gun_angle()

double get_gun_angle ( char *  me)

Get the angle of the gun of the starship piloted by the plugin me.

Parameters
me: a plugin name
Returns
A double which is the angle of the gun of the starship in radian.

The function returns a double which is the angle of the gun of the starship in radian. When you are facing to your screen as the pixel up left is of coordinates (0,0), an angle 0 radian indicates the left, PI/2 indicate the down direction. The trigonometric circle thus turn clockwise (Be aware!!!!).

◆ get_gun_status()

int get_gun_status ( char *  me)

Get the number of frames needed to reload the gun of the starship piloted by the plugin me.

Parameters
me: a plugin name
Returns
An integer which indicates the number of frames needed to reload the gun of the starship.

The function returns a integer which is the number of frames needed to reload the gun of the starship.

Referenced by decision_frame().

◆ get_life()

int get_life ( char *  me)

Get the life of the starship piloted by the plugin me.

Parameters
me: a plugin name
Returns
An integer which is the number of hits that the starship can handle before exploding.

The function returns a integer which is the number of hits that the starship can handle before exploding. By default, starships have ten life points at the beginning of the fight.

◆ get_move_angle()

double get_move_angle ( char *  me)

Get the moving angle of the starship piloted by the plugin me.

Parameters
me: a plugin name
Returns
A double which is the moving angle of the starship in radian.

The function returns a double which is the moving angle of the starship in radian. When you are facing to your screen as the pixel up left is of coordinates (0,0), an angle 0 radian indicates the left, PI/2 indicate the down direction. The trigonometric circle thus turn clockwise (Be aware!!!!).

◆ get_nb_team()

int get_nb_team ( char *  me)

Get the number of the team of the starship piloted by the plugin me.

Parameters
me: a plugin name
Returns
An integer which indicates the number of the team of the starship.

The function returns a integer which is the internal number of the team of the starship. The graphical interface displays team number between 1 and n when internally, team number goes from 0 to n-1.

◆ get_radar_angle()

double get_radar_angle ( char *  me)

Get the angle of the radar of the starship piloted by the plugin me.

Parameters
me: a plugin name
Returns
A double which is the angle of the radar of the starship in radian.

The function returns a double which is the angle of the radar of the starship in radian. When you are facing to your screen as the pixel up left is of coordinates (0,0), an angle 0 radian indicates the left, PI/2 indicate the down direction. The trigonometric circle thus turn clockwise (Be aware!!!!).

◆ get_scan_from_radar()

void get_scan_from_radar ( char *  me,
View_starship **  S,
int *  nb_starship,
View_missile **  M,
int *  nb_missile 
)

Set information that the radar can get in its current position.

Parameters
mea plugin name.
Sa pointer to an address of array of View_starship, thus of type View_starship**
nb_starshipa pointer to an integer.
Ma pointer to an address of array of View_missile, thus of type View_missile**
nb_missile: a pointer to an integer.
Returns
A double which is the angle of the radar of the starship in radian.

This function collect all elements that your radar can see... Visible starship will be placed in an array at address *S and will contains *nb_starship elements. It does the same for missiles. The function does the allocation and liberation of memory for you.

◆ get_speed()

int get_speed ( char *  me)

Get the gear of the starship piloted by the plugin me.

Parameters
me: a plugin name
Returns
An integer which indicates the gear of the starship.

The function returns a integer which is the gear of the starship. If the starship doesn't move, it returns 0 for the neutral gear, 1 for the front gear and -1 for the reverse gear.

◆ get_x()

double get_x ( char *  me)

Get the position in absicca of the starship piloted by the plugin me.

Parameters
me: a plugin name
Returns
A double floating number

The function returns a double between 0.0 and 10.0 corresponding the position in absicca of the starship piloted by the plugin me. Some side effect can happen : sometimes and only during one or two frames, the absicca can crosses the bounds during collision resolution.

◆ get_y()

double get_y ( char *  me)

Get the position in ordinate of the starship piloted by the plugin me.

Parameters
me: a plugin name
Returns
A double floating number

The function returns a double between 0.0 and 10.0 corresponding the position in ordinate of the starship piloted by the plugin me. Some side effect can happen : sometimes and only during one or two frames, the ordinate can crosses the bounds during collision resolution.