double carve::triangulate::detail::vertex_info::calcScore() const { #if 0 // examine only this triangle. double this_tri = triScore(prev, this, next); return this_tri; #endif #if 1 // attempt to look ahead in the neighbourhood to attempt to clip ears that have good neighbours. double this_tri = triScore(prev, this, next); double next_tri = triScore(prev, next, next->next); double prev_tri = triScore(prev->prev, prev, next); return this_tri + std::max(next_tri, prev_tri) * .2; #endif #if 0 // attempt to penalise ears that will require producing a sliver triangle. double score = triScore(prev, this, next); double a1, a2; a1 = carve::geom2d::atan2(prev->p - next->p); a2 = carve::geom2d::atan2(next->next->p - next->p); if (fabs(a1 - a2) < 1e-5) score -= .5; a1 = carve::geom2d::atan2(next->p - prev->p); a2 = carve::geom2d::atan2(prev->prev->p - prev->p); if (fabs(a1 - a2) < 1e-5) score -= .5; return score; #endif }
void fscore(int scorePlayer) { int score[100]={0}, maxi, i; char name[12]; char pseudo[100][4]; printf("Votre Pseudo (3 caracteres): "); //Saisie du pseudo do { gets(name); }while (strlen(name)!=3); //Passage en majuscule for (i=0 ; i<4 ; i++) { name[i]=toupper(name[i]); } printf("\n\nVotre score est: %d\n\n", scorePlayer); inscriptionScore(name, scorePlayer); //Inscription du score dans le fichier .txt maxi = lectureScore(pseudo, score); // triScore(pseudo, score, maxi); }
int main() { //Initialisation des variables int mode, maxi; char terrain [20][38]; char pseudo[100][4]; //Les deux tableaux suivants servent à l'affichage des meilleurs scores int score[100]; coordonees PacMan; coordonees fantomeA; coordonees fantomeB; coordonees fantomeC; coordonees fantomeD; SetWindow(70,26); //On redimentionne la fenêtre (c'est le seul réglage faisable automatiquement) srand(time(NULL)); //On initialise les nombres aléatoires do { menu(&mode); switch(mode) { case 1 : initialisation(terrain, &PacMan, &fantomeA, &fantomeB, &fantomeC, &fantomeD); //On génère l'arène renduarene(terrain); //On effectue un rendu sur l'arène précédement générée afin d'avoir un résultat plus joli affichage(terrain, 0, 0, 0, 3); //On affiche une première fois le terrain deplacements(terrain, &PacMan, &fantomeA, &fantomeB, &fantomeC, &fantomeD); //On lance la gestion des déplacements break; case 2: system("CLS"); maxi = lectureScore(pseudo, score); triScore(pseudo, score, maxi); break; default: break; } }while(mode>0 && mode<3); return 0; }