This repository was archived by the owner on Oct 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
70 lines (60 loc) · 2.18 KB
/
main.c
File metadata and controls
70 lines (60 loc) · 2.18 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
#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) {
(void)argc; (void)argv;
team_t team_a = (team_t) {
.name = "Blue Team",
.goalkeeper = (player_t) { "G1", GOALKEEPER, 8.0, 0.25, 1 },
.players = {
(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 }
},
.trainer_skill = 0,
.style = BALL_POSETION,
.field_factor = 76
};
team_t team_b = (team_t) {
.name = "Red Team",
.goalkeeper = (player_t) { "G1", GOALKEEPER, 9.0, 0.25, 1 },
.players = {
(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 }
},
.trainer_skill = 0,
.style = COUNTER_ATTACK,
.field_factor = 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);
history_free(history);
return 0;
}