diff --git a/CppClient/Game/gamecfg.json b/CppClient/Game/gamecfg.json index 8d48548..cf933e7 100644 --- a/CppClient/Game/gamecfg.json +++ b/CppClient/Game/gamecfg.json @@ -15,7 +15,7 @@ "": "creating a new decision thread each time a snapshot of game is received from server", "create_new_thread": true, "agent_name": "0", - "team_nickname": "BabyKnight", + "team_nickname": "Team1", "token": "team_id1-xx" } } diff --git a/JavaClient/gamecfg.json b/JavaClient/gamecfg.json index 7807895..cf933e7 100644 --- a/JavaClient/gamecfg.json +++ b/JavaClient/gamecfg.json @@ -1,8 +1,5 @@ { "general": { - "command_files": [ - "ks/commands" - ], "offline_mode": true }, @@ -18,7 +15,7 @@ "": "creating a new decision thread each time a snapshot of game is received from server", "create_new_thread": true, "agent_name": "0", - "team_nickname": "BabyKnight", + "team_nickname": "Team1", "token": "team_id1-xx" } } diff --git a/JavaClient/src/ai/AI.java b/JavaClient/src/ai/AI.java index 36d02b3..d178859 100644 --- a/JavaClient/src/ai/AI.java +++ b/JavaClient/src/ai/AI.java @@ -22,62 +22,62 @@ public void decide() { System.out.println("decide"); if (this.mySide.equals("Police")) { - for (Police police : this.world.getPolices()) - { - if (police.getStatus() == EAgentStatus.Dead) - continue; - - boolean doingBombOperation = police.getDefusionRemainingTime() != -1; - if (doingBombOperation) - { - System.out.println("Agent[" + police.getId() + "]: " + "Continue Bomb Operation"); - continue; - } - - ECommandDirection bombsiteDirection = findBombsiteDirection(police.getPosition()); - if (bombsiteDirection == null) - { - System.out.println("Agent[" + police.getId() + "]: " + "Random Move"); - int randIndex = (int) (Math.random() * ECommandDirection.values().length); - ECommandDirection randDir = ECommandDirection.values()[randIndex]; - move(police.getId(), randDir); - } - else - { - System.out.println("Agent[" + police.getId() + "]: " + "Start Bomb Operation"); - defuse(police.getId(), bombsiteDirection); - } - } - } - else - { - for (Terrorist terrorist : this.world.getTerrorists()) - { - if (terrorist.getStatus() == EAgentStatus.Dead) - continue; - - boolean doingBombOperation = terrorist.getPlantingRemainingTime() != -1; - if (doingBombOperation) - { - System.out.println("Agent[" + terrorist.getId() + "]: " + "Continue Bomb Operation"); - continue; - } - - ECommandDirection bombsiteDirection = findBombsiteDirection(terrorist.getPosition()); - if (bombsiteDirection == null) - { - System.out.println("Agent[" + terrorist.getId() + "]: " + "Random Move"); - int randIndex = (int) (Math.random() * ECommandDirection.values().length); - ECommandDirection randDir = ECommandDirection.values()[randIndex]; - move(terrorist.getId(), randDir); - } - else - { - System.out.println("Agent[" + terrorist.getId() + "]: " + "Start Bomb Operation"); - plant(terrorist.getId(), bombsiteDirection); - } - } - } + for (Police police : this.world.getPolices()) + { + if (police.getStatus() == EAgentStatus.Dead) + continue; + + boolean doingBombOperation = police.getDefusionRemainingTime() != -1; + if (doingBombOperation) + { + System.out.println("Agent[" + police.getId() + "]: " + "Continue Bomb Operation"); + continue; + } + + ECommandDirection bombsiteDirection = findBombsiteDirection(police.getPosition()); + if (bombsiteDirection == null) + { + System.out.println("Agent[" + police.getId() + "]: " + "Random Move"); + int randIndex = (int) (Math.random() * ECommandDirection.values().length); + ECommandDirection randDir = ECommandDirection.values()[randIndex]; + move(police.getId(), randDir); + } + else + { + System.out.println("Agent[" + police.getId() + "]: " + "Start Bomb Operation"); + defuse(police.getId(), bombsiteDirection); + } + } + } + else + { + for (Terrorist terrorist : this.world.getTerrorists()) + { + if (terrorist.getStatus() == EAgentStatus.Dead) + continue; + + boolean doingBombOperation = terrorist.getPlantingRemainingTime() != -1; + if (doingBombOperation) + { + System.out.println("Agent[" + terrorist.getId() + "]: " + "Continue Bomb Operation"); + continue; + } + + ECommandDirection bombsiteDirection = findBombsiteDirection(terrorist.getPosition()); + if (bombsiteDirection == null) + { + System.out.println("Agent[" + terrorist.getId() + "]: " + "Random Move"); + int randIndex = (int) (Math.random() * ECommandDirection.values().length); + ECommandDirection randDir = ECommandDirection.values()[randIndex]; + move(terrorist.getId(), randDir); + } + else + { + System.out.println("Agent[" + terrorist.getId() + "]: " + "Start Bomb Operation"); + plant(terrorist.getId(), bombsiteDirection); + } + } + } } @@ -99,22 +99,22 @@ public void defuse(int agentId, ECommandDirection bombsiteDirection) private ECommandDirection findBombsiteDirection(Position position) { - if ((this.world.getBoard().get(position.getY() - 1).get(position.getX()).getValue() >= ECell.SmallBombSite.getValue()) && - (this.world.getBoard().get(position.getY() - 1).get(position.getX()).getValue() <= ECell.VastBombSite.getValue())) - return ECommandDirection.Up; + if ((this.world.getBoard().get(position.getY() - 1).get(position.getX()).getValue() >= ECell.SmallBombSite.getValue()) && + (this.world.getBoard().get(position.getY() - 1).get(position.getX()).getValue() <= ECell.VastBombSite.getValue())) + return ECommandDirection.Up; - if ((this.world.getBoard().get(position.getY()).get(position.getX() + 1).getValue() >= ECell.SmallBombSite.getValue()) && - (this.world.getBoard().get(position.getY()).get(position.getX() + 1).getValue() <= ECell.VastBombSite.getValue())) - return ECommandDirection.Right; + if ((this.world.getBoard().get(position.getY()).get(position.getX() + 1).getValue() >= ECell.SmallBombSite.getValue()) && + (this.world.getBoard().get(position.getY()).get(position.getX() + 1).getValue() <= ECell.VastBombSite.getValue())) + return ECommandDirection.Right; - if ((this.world.getBoard().get(position.getY() + 1).get(position.getX()).getValue() >= ECell.SmallBombSite.getValue()) && - (this.world.getBoard().get(position.getY() + 1).get(position.getX()).getValue() <= ECell.VastBombSite.getValue())) - return ECommandDirection.Down; + if ((this.world.getBoard().get(position.getY() + 1).get(position.getX()).getValue() >= ECell.SmallBombSite.getValue()) && + (this.world.getBoard().get(position.getY() + 1).get(position.getX()).getValue() <= ECell.VastBombSite.getValue())) + return ECommandDirection.Down; - if ((this.world.getBoard().get(position.getY()).get(position.getX() - 1).getValue() >= ECell.SmallBombSite.getValue()) && - (this.world.getBoard().get(position.getY()).get(position.getX() - 1).getValue() <= ECell.VastBombSite.getValue())) - return ECommandDirection.Left; + if ((this.world.getBoard().get(position.getY()).get(position.getX() - 1).getValue() >= ECell.SmallBombSite.getValue()) && + (this.world.getBoard().get(position.getY()).get(position.getX() - 1).getValue() <= ECell.VastBombSite.getValue())) + return ECommandDirection.Left; - return null; + return null; } } diff --git a/PythonClient/gamecfg.json b/PythonClient/gamecfg.json index 73da7f0..66adba3 100644 --- a/PythonClient/gamecfg.json +++ b/PythonClient/gamecfg.json @@ -1,9 +1,9 @@ { "general": { - "command_files": [ - "ks/commands" - ], - "offline_mode": true + "command_files": [ + "ks/commands" + ], + "offline_mode": true }, "net": { @@ -18,7 +18,7 @@ "": "creating a new decision thread each time a snapshot of game is received from server", "create_new_thread": true, "agent_name": "0", - "team_nickname": "BabyKnight", + "team_nickname": "Team1", "token": "team_id1-xx" } } diff --git a/PythonClient/gamecfg2.json b/PythonClient/gamecfg2.json index 6d4e52e..c021ef2 100644 --- a/PythonClient/gamecfg2.json +++ b/PythonClient/gamecfg2.json @@ -1,9 +1,9 @@ { "general": { - "command_files": [ - "ks/commands" - ], - "offline_mode": true + "command_files": [ + "ks/commands" + ], + "offline_mode": true }, "net": { @@ -18,7 +18,7 @@ "": "creating a new decision thread each time a snapshot of game is received from server", "create_new_thread": true, "agent_name": "0", - "team_nickname": "BabyKnight2", - "token": "team_id1-xx" + "team_nickname": "Team2", + "token": "team_id2-xx" } } diff --git a/PythonRandomClient/gamecfg.json b/PythonRandomClient/gamecfg.json index af9f785..2474361 100644 --- a/PythonRandomClient/gamecfg.json +++ b/PythonRandomClient/gamecfg.json @@ -1,9 +1,9 @@ { "general": { - "command_files": [ - "ks/commands" - ], - "offline_mode": true + "command_files": [ + "ks/commands" + ], + "offline_mode": true }, "net": { @@ -19,6 +19,6 @@ "create_new_thread": true, "agent_name": "0", "team_nickname": "RandomTeam", - "token": "team_id1-xx" + "token": "random_team-xx" } } diff --git a/PythonServer/generate_ks.py b/PythonServer/generate_ks.py index a54156e..b479d88 100644 --- a/PythonServer/generate_ks.py +++ b/PythonServer/generate_ks.py @@ -9,30 +9,34 @@ from koala_serializer import generate -commands_reletive_path = 'ks/commands.ks' -models_reletive_path = 'ks/models.ks' +ks_rel_dir = "app/ks" +commands_ksfile = "commands.ks" +models_ksfile = "models.ks" + destinations = [ - '../PythonClient', - '../PythonRandomClient', - '../CppClient/Game', - '../JavaClient/src' + "../PythonClient/ks", + "../PythonRandomClient/ks", + "../CppClient/Game/ks", + "../JavaClient/src/ks", + "../CSharpClient/Game/KS" ] for dest in destinations: - for rel_path in [commands_reletive_path, models_reletive_path]: - path = os.path.join(dest, rel_path) + for ksfile in [commands_ksfile, models_ksfile]: + path = os.path.join(dest, ksfile) if not os.path.exists(os.path.dirname(path)): os.mkdir(os.path.dirname(path)) - copyfile(os.path.join('app', rel_path), path) + copyfile(os.path.join(ks_rel_dir, ksfile), path) all_args = [ - ('python', 'app/ks', 'snake_case'), - ('python', '../PythonClient/ks', 'snake_case'), - ('python', '../PythonRandomClient/ks', 'snake_case'), - ('cpp', '../CppClient/Game/ks', 'camelCase'), - ('java', '../JavaClient/src', 'camelCase') + ('python', ks_rel_dir, 'snake_case'), + ('python', "../PythonClient/ks", 'snake_case'), + ('python', "../PythonRandomClient/ks", 'snake_case'), + ('cpp', "../CppClient/Game/ks", 'camelCase'), + ('java', "../JavaClient/src", 'camelCase'), + ('cs', '../CSharpClient/Game/KS', 'PascalCase') ] for args in all_args: - generate(os.path.join('app', commands_reletive_path), *args) - generate(os.path.join('app', models_reletive_path), *args) + generate(os.path.join(ks_rel_dir, commands_ksfile), *args) + generate(os.path.join(ks_rel_dir, models_ksfile), *args)