Exemplo n.º 1
0
/* traitement d'une enchere */
void traitement_enchere(char *name, int coups){
  pthread_mutex_lock(&mutex_clients);
  client_list *cl = get_client(clients, name);
  
  if(cl->proposition != -1 && coups >= cl->proposition){
    /* Echec si un joueur essaye d'encherir une valeur plus grande que celle qu'il a déjà encheri */
    echec(cl->socket, name);
  }else{
    client_list *aux = clients;
    int bool = 0;
    char *user_incoherent;
    
    /* Vérification qu'il n'existe pas une enchere de même valeur */
    while(aux != NULL){
      if(aux->proposition == coups){
	user_incoherent = aux->name;
	bool = 1;
	break;
      }
      aux = aux->next;
    }

    if(bool == 1){
      /* Echec */      
      echec(cl->socket, user_incoherent);
    }else{
Exemplo n.º 2
0
 void erreur( int bits, double exact, double approx )
  {
   if (exact==0) { echec(1,"division par 0") ; }
   int erreur = arrondi(resolution_*(exact-approx)/exact) ;
   if (erreur<0) { erreur = -erreur ; }
   std::cout
     <<std::right<<std::setw(2)<<bits<<" bits : "
     <<std::left<<exact<<" ~ "<<approx
     <<" ("<<erreur<<"/"<<resolution_<<")" ;
  } 
Exemplo n.º 3
0
 void enregistre( Testeur * t )
  {
   if (indice_==taille_)
    { echec(2,"trop de testeurs") ; }
   testeurs_[indice_++] = t ;
  }
Exemplo n.º 4
0
 void acquiere( Testeur * pt )
  {
   if (indice_==taille_)
    { echec(2,"trop de testeurs") ; }
   testeurs_[indice_++] = pt ;
  }