DEMANDE EXPERT EN FOOT

BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019 - 19 mai 2004 à 20:46
der_kaiser Messages postés 2 Date d'inscription mercredi 14 avril 2004 Statut Membre Dernière intervention 17 août 2004 - 17 août 2004 à 11:36
http://brunews.free.fr/Foot.zip

14 Ko de download pour tester et me dire si resultats coherents.
C'est un truc qu'on m'avait demande et que j'avais deja poste en source.
Le prob, je n'avais pas assez teste et comme je suis trop bon en sport...
Quand sera tout bon je remettrai.

Un txt explicatif est dans le zip.

Merci d'avance aux eventuels testeurs.

ciao...
BruNews, Admin CS, MVP Visual C++

14 réponses

DeAtHCrAsH Messages postés 2670 Date d'inscription vendredi 25 janvier 2002 Statut Membre Dernière intervention 6 février 2013
19 mai 2004 à 21:09
J'ai fait une dizaine de jeu d'essai aléatoire et je n'ai trouvé aucune erreur dans les résultat ....
Faut du temps pour tous tester.... vraiment beaucoup de temps!!

Samir
0
Hylvenir Messages postés 364 Date d'inscription mercredi 11 février 2004 Statut Membre Dernière intervention 5 octobre 2006 2
20 mai 2004 à 00:06
Pourquoi tu n'écris pas les résultats pour toutes tes valeurs dans un fichier texte que tu vérifies ensuite ?

Sinon, pk les match retour ne sont pas simplement des matchs aller à l'envers ?

// Ma participation à la saturation du net:
// http://hylvenir.free.fr
0
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
20 mai 2004 à 00:18
y a l'histoire du classement des journees qui m'empeche la simple inversion.
Oui je vais mettre la sortie en txt.

ciao...
BruNews, Admin CS, MVP Visual C++
0
vecchio56 Messages postés 6535 Date d'inscription lundi 16 décembre 2002 Statut Membre Dernière intervention 22 août 2010 14
20 mai 2004 à 00:55
Résultats non cohérents puisque 42 journées pour 20 équipes, dont la 42ème qui ne contient qu'un match
On voudrait plutut 38 journée de 10 matches
En fait de problème de sport, c'est plutot un problème de math...
Profitons de ce sujet pour saluer la magnifique défaite des Marseillais en finale de l'UEFA avec un Barthez héroïque
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
20 mai 2004 à 01:11
vecchio56 > je n'y comprends vraiment rien a ces matchs. Si tu m'en trouvais une liste, tu m'arrangerais.
Faut-y que je regarde tele foot ?

ciao...
BruNews, Admin CS, MVP Visual C++
0
vecchio56 Messages postés 6535 Date d'inscription lundi 16 décembre 2002 Statut Membre Dernière intervention 22 août 2010 14
20 mai 2004 à 11:00
pas la peine de regarder je te rassure.
Je vais essayer de te préparer quelque chose
0
vecchio56 Messages postés 6535 Date d'inscription lundi 16 décembre 2002 Statut Membre Dernière intervention 22 août 2010 14
20 mai 2004 à 12:39
j'ai essayé, et j'obtiens des résultats comparables aux tiens, mais j'ai peut-être une piste:

On veut organiser un championnat entre n équipes, en un nombre minimal de journées. Chaque journée, chaque équipe rencontre au plus une équipe, le championnat est terminé lorsque toutes les équipes se sont rencontrées une fois.

Combien de journées au moins sont nécessaires pour un championnat entre n équipes.
On suppose que n est une puissance de 2. n = 2k et on suppose que les équipes sont numérotées de 1 à n. Ecrire en pseudo-langage de programmation un algorithme qui donne la liste des rencontres pour chaque journée en utilisant le principe suivant :
On répartit les équipes en deux groupes de même taille ; les équipes de chaque groupe s'affrontent dans un championnat complet de n/2 équipes ; ces deux championnats étant organisés en parallèle. Puis on organise les rencontres entre les deux groupes en divisant chaque groupe en deux.

Evaluer le nombre d'opérations effectuées par le programme de la question précédente. Peut-on faire mieux ?
Donner un algorithme d'organisation de tournoi basé sur un principe complètement différent. Indication : on pensera à faire " tourner " des équipes suivant une permutation circulaire bien choisie.
Peut-on généraliser la méthode de la question 2 et celle de la question 4 à un nombre quelconque d'équipes, tout en gardant un principe similaire.
0
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
20 mai 2004 à 13:02
Regarde ce que j'ai mis sur ton mail.

ciao...
BruNews, Admin CS, MVP Visual C++
0
vecchio56 Messages postés 6535 Date d'inscription lundi 16 décembre 2002 Statut Membre Dernière intervention 22 août 2010 14
20 mai 2004 à 15:20
J'ai trouvé un truc qui indique comment faire, mais je n'arrive pas a le faire, alors que l'auteur le considère comme simple:

http://www.xasa.com/grupos/fr/article/51012/fr.education.entraide.maths

en fait pour 14 équipes par exemple, il s'agit de construire ce tableau

14 13 12 11 10 9 8 7 6 5 4 3 2
13 12 11 10 9 8 7 6 5 4 3 14 1
12 11 10 9 8 7 6 5 4 14 2 1 13
11 10 9 8 7 6 5 14 3 2 1 13 12
10 9 8 7 6 14 4 3 2 1 13 12 11
9 8 7 14 5 4 3 2 1 13 12 11 10
8 14 6 5 4 3 2 1 13 12 11 10 9
7 6 5 4 3 2 1 13 12 11 10 9 14
6 5 4 3 2 1 13 12 11 10 14 8 7
5 4 3 2 1 13 12 11 14 9 8 7 6
4 3 2 1 13 12 14 10 9 8 7 6 5
3 2 1 13 14 11 10 9 8 7 6 5 4
2 1 14 12 11 10 9 8 7 6 5 4 3
1 7 13 6 12 5 11 4 10 3 9 2 8
0
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
20 mai 2004 à 15:59
je vais y jeter un oeil.

ciao...
BruNews, Admin CS, MVP Visual C++
0
vecchio56 Messages postés 6535 Date d'inscription lundi 16 décembre 2002 Statut Membre Dernière intervention 22 août 2010 14
20 mai 2004 à 16:35
j'ai trouvé comment faire: je te l'envoie
0
Hylvenir Messages postés 364 Date d'inscription mercredi 11 février 2004 Statut Membre Dernière intervention 5 octobre 2006 2
20 mai 2004 à 20:48
Pour ma culture perso, si tu as mieux je suis preneur.

  for( int li = 0; li < NB-1; ++li )
  {
    for( int co = 0; co < NB-1; ++co )
   {
      int val = (NB-co-li-1)%(NB-1)+1;
      if ( val <= 0 ) val += NB-1;
      if ( val==li+1 ){
        val = 14;
        tab[co][NB-1] = li+1;
      }
      tab[co][li] = val;
    }
}



// Ma participation à la saturation du net:
// http://hylvenir.free.fr
0
Hylvenir Messages postés 364 Date d'inscription mercredi 11 février 2004 Statut Membre Dernière intervention 5 octobre 2006 2
20 mai 2004 à 20:49
Désolé, j'ai oublié ça...

const int NB = 14;
int tab[NB-1][NB] = { 0 };


// Ma participation à la saturation du net:
// http://hylvenir.free.fr
0
der_kaiser Messages postés 2 Date d'inscription mercredi 14 avril 2004 Statut Membre Dernière intervention 17 août 2004
17 août 2004 à 11:36
Salut à tous, j'ai un truc pour le championnat de foot

C assez long mais bon , je l'ai réalisé à mes débuts en prog° C

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
#include <dos.h>
#include
#include <string.h>

int main (void)
{
typedef struct ustat // Structure contenant les statistiques des participants
{
char* Nom;
int vict,nul,def,pour,contre;
} stats;
int score1,score2; // Variables pour les scores des matches
int hg,wh; // Contenant la hauteur et la largeur de l'‚cran
const int nb_max=20;
const int nb_min=4;
int i,j,m,l; // Compteurs
int Nombre; // Nombre des participants
char participants[nb_max][16]; // Tableau comprenant les noms
char ordre[nb_max][16];
int passage[nb_max];
int a,pts1,pts2; // Variables interm‚diaires
char* calendrier [nb_max][nb_max]; // Contenant les matches
int scores[nb_max][nb_max];
char* inter;
int aa,bb;
stats struc1,struc2;

// Tableau contenant les classements
stats standings[nb_max];

//////////////////// PRESENTATIONS /////////////////////////////////////

clrscr();
unsigned attrib;
clrscr(); clock_t start, end;
struct text_info ti;
gettextinfo(&ti);

hg=ti.screenheight;
wh=ti.screenwidth;
/*
*/
//////////////////// SAISIE DES PARTICIPANTS /////////////////////////////

clrscr();

printf("Vous allez maintenant donner le nombre de participants (par la suite les noms) \n");
printf("qui doit ˆtre un nombre pair sup‚rieur ou ‚gal … %d et inf‚rieur \n",nb_min);
printf("ou ‚gal … %d \n",nb_max);
printf("********************************************************* \n");
printf("Remarques : \n");
printf("1/ Lorsque vous saisissez les noms des participants n'utilisez pas \n");
printf("l'espace ou alors si vous pr‚f‚rez, utilisez le blanc soulign‚ "_" \n");
printf("2/ Les noms ne doivent pas d‚passer 15 caractŠres, sinon problŠmes \n");
printf("*********************************************************\n");
printf("Nombre = ");
do
{
gotoxy(10,10);
clreol();
scanf("%d",&Nombre);
}
while (Nombre<nb_min || Nombre>nb_max || Nombre % 2 != 0);

clrscr();

for (i=0;i<Nombre;i++)
{
printf("Donner le nom du participant Nø %2d : ",i+1);
scanf("%s",participants[i]);
standings[i].Nom=participants[i];
}

for (i=0;i<Nombre;i++)
{
printf("Nom du participant Nø %d : %10s \n",i+1,participants[i]);
}

printf("\n \n Appuyez sur une touche pour continuer : ");
getch();

//////////////// PREPARATION AU TIRAGE AU SORT ALEATOIRE ////////////////////
clrscr();
for (i=0;i<Nombre;i++)
{
passage[i]=0;
/* printf("%d ",passage[i]); */
}
printf("\n");

randomize();
for (i=0;i<Nombre;i++)
{
do
{
a=random(Nombre+1);
/* printf("%d \n",a); */
}
while (passage[a-1]==1 || a==0);
passage[a-1]=1;
for (j=0;j<8;j++)
{
ordre[i][j]=participants[a-1][j];
}
}
/*
for (i=0;i<Nombre;i++)
{
printf("Ordre %i : %-10s \n",i+1,ordre[i]);
}
*/
getch();

////////////////////////// REPLISSAGE DU CALENDRIER //////////////////
clrscr();
printf("Temps de chargement, patientez s'il vous plaŒt ... \n");
delay (4000);
clrscr();

//////////////////// 1ERE JOURNEE /////////////////////////////////////
for (i=0;i<Nombre;i++)
{
calendrier[0][i] = ordre [i];
}
/*
printf(" ********** 1Šre journ‚e *********** \n");
for (i=0;i<Nombre;i=i+2)
{
printf("%s - %s \n",calendrier[0][i],calendrier[0][i+1]);
}
*/
getch();
/////////////// LA SUITE DE LA COMPRETITION ////////////////////////
a=4;
i=0;

for (a=4,i=0;i<Nombre-4;i=i+2,a=a+2)
{
passage[i]=Nombre-a;
passage[i+1]=Nombre-(a-1);
}
/*
for (i=0;i<Nombre-4;i++)
{
printf("%u \n",passage[i]);
}
*/
printf("Appuyez sur une touche pour voir les matches ... \n");
getch();

for (j=1;j<Nombre-1;j++)
{
for (i=0;i<Nombre-4;i++)
{
calendrier[j][i]=calendrier[j-1][passage[i]-1];
}
calendrier[j][i]=calendrier[j-1][Nombre-2];
calendrier[j][i+1]=calendrier[j-1][0];
calendrier[j][i+2]=calendrier[j-1][Nombre-3];
calendrier[j][i+3]=calendrier[j-1][Nombre-1];
}

for (j=0;j<Nombre-1;j=j+2)
{
inter=calendrier[j][Nombre-1];
calendrier[j][Nombre-1]=calendrier[j][Nombre-2];
calendrier[j][Nombre-2]=inter;
}

/* for (j=0;j<Nombre-1;j++)
{
printf("************ Journ‚e nø%2i ************** \n",j+1);
for (i=0;i<Nombre;i=i+2)
{
printf("%s - %s \n",calendrier[j][i],calendrier[j][i+1]);
}
getch();
getch();
} */

for (j=0;j<Nombre-1;j++)
{
printf("%2i³",j+1);
for (i=0;i<Nombre;i=i+2)
{
printf("%5.5s-%-5.5s³",calendrier[j][i],calendrier[j][i+1]);
}
printf("\n");
getch();
getch();
}

/////////////////// ENREGISTREMENT DES RESULTATS ///////////////////////////

////////////////// INITIALISATION DES CLASSEMENTS A ZERO //////////////////
clrscr();
for (i=0;i<Nombre;i++)
{
standings[i].vict=0;
standings[i].nul=0;
standings[i].def=0;
standings[i].pour=0;
standings[i].contre=0;
}

getch();

clrscr();
gotoxy((3*wh)/8,hg/2);
printf("SAISIE DES RESULTATS ");
delay (2000);

clrscr();
gotoxy((3*wh)/8,hg/2);
printf("P H A S E A L L E R");
delay(2000);

for (i=0;i<Nombre-1;i++)
{
clrscr();
gotoxy((3*wh)/8,hg/2);
printf(" %d%s Journ‚e \n",i+1,i<1?"Šre":"Šme");
delay(2000);
for (j=0;j<Nombre;j=j+2)
{
clrscr();
printf("%-13s : \n",calendrier[i][j]);
printf("%-13s : \n",calendrier[i][j+1]);
printf("\n");
gotoxy(16,1); scanf("%i",&score1);
gotoxy(16,2); scanf("%i",&score2);
aa=-1;
bb=-1;
do {aa++;} while (strcmp(standings[aa].Nom,calendrier[i][j]) != 0);
struc1 = standings[aa];
do {bb++;} while (strcmp(standings[bb].Nom,calendrier[i][j+1]) != 0);
struc2 = standings[bb];
{
standings[aa].pour=standings[aa].pour+score1;
standings[bb].pour=standings[bb].pour+score2;
standings[aa].contre=standings[aa].contre+score2;
standings[bb].contre=standings[bb].contre+score1;
if (score1>score2)
{
standings[aa].vict++;
standings[bb].def++;
}
else
if (score1 == score2)
{
standings[aa].nul++;
standings[bb].nul++;
}
else
if (score1<score2)
{
standings[aa].def++;
standings[bb].vict++;
}
}

}

///////////////////// TRI DU CLASSEMENT /////////////////////////
for (l=0;l<Nombre*5;l++)
for (m=0;m<Nombre-1;m++)
{
pts1=standings[m].vict*3+standings[m].nul;
pts2=standings[m+1].vict*3+standings[m+1].nul;
if (pts2>pts1)
{
struc1=standings[m];
standings[m]=standings[m+1];
standings[m+1]=struc1;
}
}
//////////////////////CLASSEMENT FINAL ///////////////////////

clrscr();
printf("******************** CLASSEMENT *************************\n");
printf(" J G N P p. c. +/- pts\n");
for (m=0;m<Nombre;m++)
{
printf("%-16s ",standings[m].Nom);
printf("%3i ",standings[m].vict+standings[m].nul+standings[m].def);
printf("%3i ",standings[m].vict);
printf("%3i ",standings[m].nul);
printf("%3i ",standings[m].def);
printf("%4i ",standings[m].pour);
printf("%4i ",standings[m].contre);
printf("%4d ",standings[m].pour - standings[m].contre);
printf("%4i ",standings[m].vict*3+standings[m].nul);
printf("\n");
}
printf("**********************************************************");
getch();
getch();
}
clrscr();
gotoxy((3*wh)/8,hg/2);
printf("P H A S E R E T O U R");
delay(2000);

for (i=0;i<Nombre-1;i++)
{
clrscr();
gotoxy((3*wh)/8,hg/2);
printf(" %d%s Journ‚e \n",i+1,i<1?"Šre":"Šme");
delay(2000);
for (j=0;j<Nombre;j=j+2)
{
clrscr();
printf("%-13s : \n",calendrier[i][j+1]);
printf("%-13s : \n",calendrier[i][j]);
printf("\n");
gotoxy(16,1); scanf("%i",&score1);
gotoxy(16,2); scanf("%i",&score2);
aa=-1;
bb=-1;
do {aa++;} while (strcmp(standings[aa].Nom,calendrier[i][j+1]) != 0);
struc1 = standings[aa];
do {bb++;} while (strcmp(standings[bb].Nom,calendrier[i][j]) != 0);
struc2 = standings[bb];
{
standings[aa].pour=standings[aa].pour+score1;
standings[bb].pour=standings[bb].pour+score2;
standings[aa].contre=standings[aa].contre+score2;
standings[bb].contre=standings[bb].contre+score1;
if (score1>score2)
{
standings[aa].vict++;
standings[bb].def++;
}
else
if (score1 == score2)
{
standings[aa].nul++;
standings[bb].nul++;
}
else
if (score1<score2)
{
standings[aa].def++;
standings[bb].vict++;
}
}

}

///////////////////// TRI DU CLASSEMENT /////////////////////////
for (l=0;l<Nombre*5;l++)
for (m=0;m<Nombre-1;m++)
{
pts1=standings[m].vict*3+standings[m].nul;
pts2=standings[m+1].vict*3+standings[m+1].nul;
if (pts2>pts1)
{
struc1=standings[m];
standings[m]=standings[m+1];
standings[m+1]=struc1;
}
}
//////////////////////CLASSEMENT FINAL ///////////////////////

clrscr();
printf("******************** CLASSEMENT *************************\n");
printf(" J G N P p. c. +/- pts\n");
for (m=0;m<Nombre;m++)
{
printf("%-16s ",standings[m].Nom);
printf("%3i ",standings[m].vict+standings[m].nul+standings[m].def);
printf("%3i ",standings[m].vict);
printf("%3i ",standings[m].nul);
printf("%3i ",standings[m].def);
printf("%4i ",standings[m].pour);
printf("%4i ",standings[m].contre);
printf("%4d ",standings[m].pour - standings[m].contre);
printf("%4i ",standings[m].vict*3+standings[m].nul);
printf("\n");
}
printf("**********************************************************");
getch();
getch();
}

///////////////////// TRI DU CLASSEMENT /////////////////////////
for (j=0;j<Nombre*5;j++)
for (i=0;i<Nombre-1;i++)
{
pts1=standings[i].vict*3+standings[i].nul;
pts2=standings[i+1].vict*3+standings[i+1].nul;
l = standings[i].pour - standings[i].contre;
m = standings[i+1].pour - standings[i+1].contre;
if (pts2 == pts1 && m>l)
{
struc1=standings[i];
standings[i]=standings[i+1];
standings[i+1]=struc1;
}
}
//////////////////////CLASSEMENT FINAL ///////////////////////

clrscr();
printf("******************** CLASSEMENT *************************\n");
printf(" J G N P p. c. +/- pts\n");
for (i=0;i<Nombre;i++)
{
printf("%-16s ",standings[i].Nom);
printf("%3i ",standings[i].vict+standings[i].nul+standings[i].def);
printf("%3i ",standings[i].vict);
printf("%3i ",standings[i].nul);
printf("%3i ",standings[i].def);
printf("%4i ",standings[i].pour);
printf("%4i ",standings[i].contre);
printf("%4d ",standings[i].pour - standings[i].contre);
printf("%4i ",standings[i].vict*3+standings[i].nul);
printf("\n");
}
printf("**********************************************************");

getch();
getch();
getch();

return 0;
}
0
Rejoignez-nous