Esempio n. 1
0
int	what_is_this_glue(char *buff)
{
  int	i;
  int	total;
  int	ref;

  i = 1;
  while (i <= 5)
    {
      total = total + match(recup_colle(i), str_to_tab(buff, tab_height(buff), tab_length(buff)),
			    tab_height(buff), tab_length(buff)), i, tab_height(buff), tab_length(buff);
      i = i + 1;
    }
  if (total == 0)
    no_result();
  i = 1;
  while (i <= 5)
    {
      ref = total;
      aff_result(match(recup_colle(i), str_to_tab(buff, tab_height(buff), tab_length(buff)),
		       tab_height(buff), tab_length(buff)), i, tab_height(buff), tab_length(buff));
      total = total - match(recup_colle(i), str_to_tab(buff, tab_height(buff), tab_length(buff)),
                            tab_height(buff), tab_length(buff)), i, tab_height(buff), tab_length(buff);
      if (total != ref && total != 0)
	double_result();
      i = i + 1;
    }
}
Esempio n. 2
0
static void	no_win(t_vm *vm, char **players, int w_exist)
{
#ifdef BONUS
  if (vm->flags & BONBON)
    aff_result(vm, players, w_exist, 0);
  else
#endif
  {
    w_exist = 0;
    vm = vm;
    players = players;
    write(STDOUT_FILENO, "Aucun gagnant.\n", 15);
  }
}
Esempio n. 3
0
static void     multi_win(t_vm *vm, char **players, int w_exist)
{
#ifdef BONUS
  if (vm->flags & BONBON)
    aff_result(vm, players, w_exist, 1);
  else
#endif
    {
      w_exist = 0;
      write(STDOUT_FILENO, "Le joueur", 9);
      write_player(vm, players);
      write(STDOUT_FILENO, " a gagne.\n", 10);
    }
}
Esempio n. 4
0
static void	one_win(t_vm*vm, char **players, int w_exist)
{
  int	i;

#ifdef BONUS
  if (vm->flags & BONBON)
    aff_result(vm, players, w_exist, 2);
  else
#endif
    {
      write(STDOUT_FILENO, "Egalite entre les joueurs", 25);
      for (i = 0; i < w_exist; i++)
	write_player(vm, players);
      write(STDOUT_FILENO, "\n", 1);
    }
}