Increase cheating reserve bots' variety
authorJBM <jbm@codingame.com>
Sun, 7 Jun 2020 13:36:14 +0000 (15:36 +0200)
committerJBM <jbm@codingame.com>
Sun, 7 Jun 2020 13:36:14 +0000 (15:36 +0200)
src/test/java/Main.java
src/test/java/PlayerCheatPure.java [moved from src/test/java/PlayerCheat.java with 94% similarity]
src/test/java/PlayerCheatSmart.java [new file with mode: 0644]

index 1488dee..cbb15e8 100644 (file)
@@ -12,7 +12,7 @@ public class Main {
         gameRunner.setGameParameters(props);
 
         gameRunner.addAgent(Player1.class);
         gameRunner.setGameParameters(props);
 
         gameRunner.addAgent(Player1.class);
-        gameRunner.addAgent(PlayerRand.class);
+        gameRunner.addAgent(PlayerCheatSmart.class);
         
         // gameRunner.addAgent("python3 /home/user/player.py");
         
         
         // gameRunner.addAgent("python3 /home/user/player.py");
         
similarity index 94%
rename from src/test/java/PlayerCheat.java
rename to src/test/java/PlayerCheatPure.java
index 555f2a4..0809385 100644 (file)
@@ -1,7 +1,7 @@
 import java.util.Random;
 import java.util.Scanner;
 
 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();
     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 (file)
index 0000000..97a5167
--- /dev/null
@@ -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);
+        }
+    }
+}