Starship Code Contest  0.1
A real student nightmare...
rand_shot.c
Go to the documentation of this file.
1 
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include "../includes/acquisition.h"
13 
15 void initialize_my_AI(void);
16 void clean_my_AI(void);
17 
18 static int turn_gun=0;
19 static int turn_radar=0;
20 
21 static double gun_modif=0;
22 static double radar_modif=0;
23 
24 static char me[12]="alea_shot.so";
25 
34  d->move = 0;
35  if (get_gun_status(me) == 0)
36  d->shot = 1;
37  else
38  d->shot = 0;
39  if (turn_gun == 21){
40  turn_gun=0;
41  gun_modif = 0.15*(double)((rand() % 3) - 1);
42  }
43  else
44  turn_gun++;
45  if (turn_radar == 15){
46  turn_radar = 0;
47  radar_modif = 0.15*(double)((rand() % 3) - 1);
48  }
49  else
50  turn_radar++;
51 
52  d->angle_gun = gun_modif;
53  d->angle_radar = radar_modif;
54 }
55 
64 void initialize_my_AI(void){
65  return ;
66 }
67 
76 void clean_my_AI(void){
77  return ;
78 }
double angle_gun
Definition: acquisition.h:24
int get_gun_status(char *me)
Get the number of frames needed to reload the gun of the starship piloted by the plugin me...
void decision_frame(Decision_frame *d)
turning gun and radar randomly and shoting everytime it is possible.
Definition: rand_shot.c:33
double angle_radar
Definition: acquisition.h:25
void clean_my_AI(void)
Clean this test plugin.
Definition: rand_shot.c:76
This structure gathers the information needed to pilot a starship each frame.
Definition: acquisition.h:21
void initialize_my_AI(void)
Initialization of this test plugin.
Definition: rand_shot.c:64