-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwaardeer.cpp
More file actions
95 lines (73 loc) · 2.14 KB
/
waardeer.cpp
File metadata and controls
95 lines (73 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
*/
//---------------------------------------------------------------------------
//--Include's----------------------------------------------------------------
#include "main.h"
//--Define's-----------------------------------------------------------------
//--Struct Define's----------------------------------------------------------
//--Vars---------------------------------------------------------------------
//--Functions----------------------------------------------------------------
int Waardeer(SPELINFO *si)
{
if (si->punten1>si->punten2)
{
++Winst[si->speler1][si->speler2];
++Verlies[si->speler2][si->speler1];
}
if (si->punten1<si->punten2)
{
++Winst[si->speler2][si->speler1];
++Verlies[si->speler1][si->speler2];
}
if (si->punten1==si->punten2)
{
++Gelijk[si->speler1][si->speler2];
++Gelijk[si->speler2][si->speler1];
}
return 0;
}
char *strpad(int i)
{
static char pad[MAX_PATH];
memset(pad, ' ', i);
pad[i]=NULL;
return pad;
}
int fprint_waarde(FILE *fout)
{
int i, j, maxlen=0;
int nwinst, nverlies, ngelijk;
if (fout==NULL) return 1;
for (i=0; i<AantalProgs; ++i)
{
if ((int)strlen(ProgPath[i])>maxlen)
maxlen=strlen(ProgPath[i]);
}
fprintf(fout, "\n%s ", strpad(maxlen));
for (j=0; j<AantalProgs; ++j)
fprintf(fout, " [%2d] ", j+1);
fprintf(fout, "\n");
for (i=0; i<AantalProgs; ++i)
{
fprintf(fout, "%s%s [%2d]:", strpad(maxlen-strlen(ProgPath[i])),
ProgPath[i], i+1);
nwinst=0; nverlies=0;
for (j=0; j<AantalProgs; ++j)
{
fprintf(fout, " %2d <> %2d ", Winst[i][j], Verlies[i][j]);
nwinst+=Winst[i][j]; nverlies+=Verlies[i][j];
}
fprintf(fout, "\n%s :", strpad(maxlen));
ngelijk=0;
for (j=0; j<AantalProgs; ++j)
{
fprintf(fout, " %2d ", Gelijk[i][j]);
ngelijk+=Gelijk[i][j];
}
fprintf(fout, "\nw: %3d; v: %3d; g: %3d\n",
nwinst, nverlies, ngelijk);
}
fprintf(fout, "\n-------------------"
"------------------\n");
return 0;
}