FRICKERT Jonathan
PROBST Yann
1/11
2/11
3/11
4/11
5/11
if (ac == 2)
give_me_my_pid();
wait_();
my_putstr("my navy:\n");
aff_all_map(av[1]);
else if (ac == 3)
kill_(my_getnbr(av[1]));
give_me_my_pid2();
navy.pid_enemy = my_getnbr(av[1]);
my_putstr("my navy:\n");
aff_all_map2(av[2]);Le nombre d'arguments
6/11
Une série d'instruction pour chaque terminal:
ennemy_map = create_ennemy_map(ennemy_map);
while (1)
{
my_map = create_my_map(my_map);
parse(boat, my_map);
my_begin_map();
aff_my_map(my_map);
my_putchar('\n');
my_putstr("enemy navy:\n");
my_begin_map();
aff_ennemy_map(ennemy_map);
get_coord(coord);
attack(coord);
hit_or_not(ennemy_map, coord);
usleep(1000);
my_putstr("\nwaiting for enemy's attack...\n");
wait_attack(coord);
if (my_map[coord[1]][coord[0] + 2] != '.')
kill(navy.pid_enemy, SIGUSR1);
else
kill(navy.pid_enemy, SIGUSR2);
my_putstr("\nmy navy:\n");
7/11
if ((fp = open(boat, O_RDONLY)) == -1)
{
my_putstr("map doesn't exit\n");
exit(1);
}
while ((len = read(fp, buf, 8)) > 0)
{
verification(buf);
buf[len - 1] = '\0';
put_coord_map(my_map, buf);
}
8/11
char ** =
9/11
Structure
SIGUSR2 --> STOP, position final
SIGUSR1 = position
pid_enemy
counter
finish
get_coord;
hit_or_not?
10/11
before the demonstration :)
11/11