Skip to content

Commit 23509fc

Browse files
committed
Clean up
1 parent b842c6e commit 23509fc

File tree

6 files changed

+48
-47
lines changed

6 files changed

+48
-47
lines changed

JavaClient/gamecfg.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
22
"general": {
3-
"command_files": [
4-
"ks/commands"
5-
],
63
"offline_mode": true
74
},
85

@@ -18,7 +15,7 @@
1815
"": "creating a new decision thread each time a snapshot of game is received from server",
1916
"create_new_thread": true,
2017
"agent_name": "0",
21-
"team_nickname": "BabyKnight",
18+
"team_nickname": "Team1",
2219
"token": "team_id1-xx"
2320
}
2421
}

JavaClient/src/ai/AI.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ public void initialize() {
2121
public void decide() {
2222
System.out.println("decide");
2323

24-
if (this.mySide.equals("Pacman")) {
25-
int randIndex = (int) (Math.random() * EDirection.values().length);
26-
EDirection randDir = EDirection.values()[randIndex];
27-
changePacmanDirection(randDir);
28-
}
29-
30-
else if (this.mySide.equals("Ghost")) {
31-
for (Ghost ghost : this.world.getGhosts()) {
32-
int randIndex = (int) (Math.random() * EDirection.values().length);
33-
EDirection randDir = EDirection.values()[randIndex];
34-
changeGhostDirection(ghost.getId(), randDir);
35-
}
36-
}
24+
if (this.mySide.equals("Pacman")) {
25+
int randIndex = (int) (Math.random() * EDirection.values().length);
26+
EDirection randDir = EDirection.values()[randIndex];
27+
changePacmanDirection(randDir);
28+
}
29+
30+
else if (this.mySide.equals("Ghost")) {
31+
for (Ghost ghost : this.world.getGhosts()) {
32+
int randIndex = (int) (Math.random() * EDirection.values().length);
33+
EDirection randDir = EDirection.values()[randIndex];
34+
changeGhostDirection(ghost.getId(), randDir);
35+
}
36+
}
3737
}
3838

3939

PythonClient/gamecfg.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"general": {
3-
"command_files": [
4-
"ks/commands"
5-
],
6-
"offline_mode": true
3+
"command_files": [
4+
"ks/commands"
5+
],
6+
"offline_mode": true
77
},
88

99
"net": {

PythonClient/gamecfg2.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"general": {
3-
"command_files": [
4-
"ks/commands"
5-
],
6-
"offline_mode": true
3+
"command_files": [
4+
"ks/commands"
5+
],
6+
"offline_mode": true
77
},
88

99
"net": {
@@ -19,6 +19,6 @@
1919
"create_new_thread": true,
2020
"agent_name": "0",
2121
"team_nickname": "Team2",
22-
"token": "team_id1-xx"
22+
"token": "team_id2-xx"
2323
}
2424
}

PythonRandomClient/gamecfg.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"general": {
3-
"command_files": [
4-
"ks/commands"
5-
],
6-
"offline_mode": true
3+
"command_files": [
4+
"ks/commands"
5+
],
6+
"offline_mode": true
77
},
88

99
"net": {
@@ -19,6 +19,6 @@
1919
"create_new_thread": true,
2020
"agent_name": "0",
2121
"team_nickname": "RandomTeam",
22-
"token": "team_id1-xx"
22+
"token": "random_team-xx"
2323
}
2424
}

PythonServer/generate_ks.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,34 @@
99
from koala_serializer import generate
1010

1111

12-
commands_reletive_path = 'ks/commands.ks'
13-
models_reletive_path = 'ks/models.ks'
12+
ks_rel_dir = "app/ks"
13+
commands_ksfile = "commands.ks"
14+
models_ksfile = "models.ks"
15+
1416
destinations = [
15-
'../PythonClient',
16-
'../PythonRandomClient',
17-
'../CppClient/Game',
18-
'../JavaClient/src'
17+
"../PythonClient/ks",
18+
"../PythonRandomClient/ks",
19+
"../CppClient/Game/ks",
20+
"../JavaClient/src/ks",
21+
"../CSharpClient/Game/KS"
1922
]
2023

2124
for dest in destinations:
22-
for rel_path in [commands_reletive_path, models_reletive_path]:
23-
path = os.path.join(dest, rel_path)
25+
for ksfile in [commands_ksfile, models_ksfile]:
26+
path = os.path.join(dest, ksfile)
2427
if not os.path.exists(os.path.dirname(path)):
2528
os.mkdir(os.path.dirname(path))
26-
copyfile(os.path.join('app', rel_path), path)
29+
copyfile(os.path.join(ks_rel_dir, ksfile), path)
2730

2831
all_args = [
29-
('python', 'app/ks', 'snake_case'),
30-
('python', '../PythonClient/ks', 'snake_case'),
31-
('python', '../PythonRandomClient/ks', 'snake_case'),
32-
('cpp', '../CppClient/Game/ks', 'camelCase'),
33-
('java', '../JavaClient/src', 'camelCase')
32+
('python', ks_rel_dir, 'snake_case'),
33+
('python', "../PythonClient/ks", 'snake_case'),
34+
('python', "../PythonRandomClient/ks", 'snake_case'),
35+
('cpp', "../CppClient/Game/ks", 'camelCase'),
36+
('java', "../JavaClient/src", 'camelCase'),
37+
('cs', '../CSharpClient/Game/KS', 'PascalCase')
3438
]
3539

3640
for args in all_args:
37-
generate(os.path.join('app', commands_reletive_path), *args)
38-
generate(os.path.join('app', models_reletive_path), *args)
41+
generate(os.path.join(ks_rel_dir, commands_ksfile), *args)
42+
generate(os.path.join(ks_rel_dir, models_ksfile), *args)

0 commit comments

Comments
 (0)