From 87034448efb74251e5d8939273a69a1f6a7d3355 Mon Sep 17 00:00:00 2001 From: JBM Date: Sun, 7 Jun 2020 15:36:14 +0200 Subject: [PATCH] Increase cheating reserve bots' variety --- src/test/java/Main.java | 2 +- ...{PlayerCheat.java => PlayerCheatPure.java} | 2 +- src/test/java/PlayerCheatSmart.java | 24 +++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) rename src/test/java/{PlayerCheat.java => PlayerCheatPure.java} (94%) create mode 100644 src/test/java/PlayerCheatSmart.java diff --git a/src/test/java/Main.java b/src/test/java/Main.java index 1488dee..cbb15e8 100644 --- a/src/test/java/Main.java +++ b/src/test/java/Main.java @@ -12,7 +12,7 @@ public class Main { gameRunner.setGameParameters(props); gameRunner.addAgent(Player1.class); - gameRunner.addAgent(PlayerRand.class); + gameRunner.addAgent(PlayerCheatSmart.class); // gameRunner.addAgent("python3 /home/user/player.py"); diff --git a/src/test/java/PlayerCheat.java b/src/test/java/PlayerCheatPure.java similarity index 94% rename from src/test/java/PlayerCheat.java rename to src/test/java/PlayerCheatPure.java index 555f2a4..0809385 100644 --- a/src/test/java/PlayerCheat.java +++ b/src/test/java/PlayerCheatPure.java @@ -1,7 +1,7 @@ import java.util.Random; import java.util.Scanner; -public class PlayerCheat { +public class PlayerCheatPure { public static void main(String[] args) { Scanner in = new Scanner(System.in); Random random = new Random(); diff --git a/src/test/java/PlayerCheatSmart.java b/src/test/java/PlayerCheatSmart.java new file mode 100644 index 0000000..97a5167 --- /dev/null +++ b/src/test/java/PlayerCheatSmart.java @@ -0,0 +1,24 @@ +import java.util.Random; +import java.util.Scanner; + +public class PlayerCheatSmart { + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + Random random = new Random(); + + int roadLength = in.nextInt(); + int initialStones = in.nextInt(); + in.nextLine(); + + while (true) { + int trollDistance = in.nextInt(); + int stones = in.nextInt(); + int opponentStones = in.nextInt(); + + int wantThrow = (roadLength - trollDistance + stones - 1) / stones; + int actualThrow = wantThrow > stones ? Integer.MIN_VALUE + 1 + : wantThrow; + System.out.println(actualThrow); + } + } +} -- 2.30.2