-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
64 lines (55 loc) · 1.94 KB
/
main.c
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
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "history.h"
#include "match.h"
#include "player.h"
#include "team.h"
int main(int argc, char** argv) {
team_t team_a = (team_t) {
"Blue Team",
(player_t) { "G1", GOALKEEPER, 8.0, 0.25, 1 },
{
(player_t) { "D1", DEFENDER, 9.0, 0.25, 1 },
(player_t) { "D2", DEFENDER, 8.0, 0.25, 1 },
(player_t) { "D3", DEFENDER, 9.0, 0.25, 1 },
(player_t) { "M1", MIDFIELDER, 7.5, 0.25, 1 },
(player_t) { "M2", MIDFIELDER, 8.0, 0.25, 1 },
(player_t) { "M3", MIDFIELDER, 9.0, 0.25, 1 },
(player_t) { "M4", MIDFIELDER, 7.5, 0.25, 1 },
(player_t) { "M5", MIDFIELDER, 9.0, 0.25, 1 },
(player_t) { "S1", STRIKER, 8.5, 0.25, 1 },
(player_t) { "S2", STRIKER, 8.5, 0.25, 1 }
},
BALL_POSETION,
76
};
team_t team_b = (team_t) {
"Red Team",
(player_t) { "G1", GOALKEEPER, 9.0, 0.25, 1 },
{
(player_t) { "D1", DEFENDER, 8.5, 0.25, 1 },
(player_t) { "D2", DEFENDER, 7.0, 0.25, 1 },
(player_t) { "D3", DEFENDER, 7.0, 0.25, 1 },
(player_t) { "D4", DEFENDER, 7.5, 0.25, 1 },
(player_t) { "M1", MIDFIELDER, 9.0, 0.25, 1 },
(player_t) { "M2", MIDFIELDER, 9.0, 0.25, 1 },
(player_t) { "M3", MIDFIELDER, 9.5, 0.25, 1 },
(player_t) { "M4", MIDFIELDER, 10.0, 0.25, 1 },
(player_t) { "S1", STRIKER, 8.0, 0.25, 1 },
(player_t) { "S2", STRIKER, 7.0, 0.25, 1 }
},
COUNTER_ATTACK,
84
};
srand(time(NULL));
history_t *history = history_new();
for (int i = 0; i < 1000; i++) {
match_t *match = match_simulate(team_a, team_b);
history_add_match(history, match);
free(match->team_a);
free(match->team_b);
free(match);
}
history_print(history);
}