From 83de865a87657f62bc949433539351945bd04314 Mon Sep 17 00:00:00 2001 From: JBM Date: Thu, 21 May 2020 17:38:27 +0200 Subject: [PATCH 1/1] Messaging --- .gitignore | 1 + PLAN.org | 7 +-- config/Boss.java | 21 ++++++-- config/Boss.sh | 1 - config/statement_en.html | 3 ++ src/main/java/com/codingame/game/Player.java | 45 ++++++++++------- src/main/java/com/codingame/game/Referee.java | 50 ++++++++++++------- src/test/java/Player2.java | 19 +++++-- 8 files changed, 99 insertions(+), 48 deletions(-) delete mode 100644 config/Boss.sh diff --git a/.gitignore b/.gitignore index a786704..5a6e008 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ target/ .vscode .factorypath bin +*~ diff --git a/PLAN.org b/PLAN.org index 8957eba..ed0f737 100644 --- a/PLAN.org +++ b/PLAN.org @@ -2,10 +2,7 @@ * DONE document maps * DONE document length/distance thingy * TODO debug rotating avatar -* TODO easter egg for YannT -meta^5 @YannT :: (a -> b) -> f1 (f2 (f3 a)) -> f1 (f2 (f3 b)) -* TODO messages -tortue -by the power of grayskull +* DONE easter egg for YannT +* DONE messages * TODO referee cleanup * DONE upgrade deps diff --git a/config/Boss.java b/config/Boss.java index d3c297d..548c083 100644 --- a/config/Boss.java +++ b/config/Boss.java @@ -1,10 +1,17 @@ import java.util.Random; import java.util.Scanner; -public class Player2 { +public class Boss { + private final static String[] messages = { + "meta⁵ @YannT ∷ (a → b) → f1 (f2 (f3 a)) → f1 (f2 (f3 b))", + "By the power of Grayskull!", + "tortue", + "how is ur csb", + "YHBT" + }; public static void main(String[] args) { Scanner in = new Scanner(System.in); - Random random = new Random(0); + Random random = new Random(); int roadLength = in.nextInt(); int initialStones = in.nextInt(); @@ -13,8 +20,14 @@ public class Player2 { int trollDistance = in.nextInt(); int stones = in.nextInt(); int opponentStones = in.nextInt(); - - System.out.println(random.nextInt(stones+1)); + + if (random.nextInt(30) == 0) { + System.out.println(random.nextInt(stones+1) + " " + + messages[random.nextInt(messages.length)]); + } + else { + System.out.println(random.nextInt(stones+1)); + } } } } diff --git a/config/Boss.sh b/config/Boss.sh deleted file mode 100644 index 0b3832f..0000000 --- a/config/Boss.sh +++ /dev/null @@ -1 +0,0 @@ -exec yes 1 diff --git a/config/statement_en.html b/config/statement_en.html index 0102747..89a0e27 100644 --- a/config/statement_en.html +++ b/config/statement_en.html @@ -169,6 +169,9 @@ Change Log