From: JBM Date: Wed, 3 Jun 2020 16:29:37 +0000 (+0200) Subject: Send game seed in inputs. Update HTML. X-Git-Url: https://troll.desast.re/troll.git/commitdiff_plain/a78210b2e4295eaf8dee8215d4ffe5e062b4efb3?ds=sidebyside Send game seed in inputs. Update HTML. --- diff --git a/config/Boss.java b/config/Boss.java index e1bcec3..4c2a766 100644 --- a/config/Boss.java +++ b/config/Boss.java @@ -15,6 +15,7 @@ class Player { int roadLength = in.nextInt(); int initialStones = in.nextInt(); + in.nextLong(); while (true) { int trollDistance = in.nextInt(); diff --git a/config/statement_en.html b/config/statement_en.html index 58f3d1c..edffecf 100644 --- a/config/statement_en.html +++ b/config/statement_en.html @@ -29,9 +29,7 @@
The following ideas are still in flux, waiting for some opinions. Please drop a word on the - - contribution's page - + contribution's page or on the forum @@ -42,25 +40,38 @@
  • More maps? (a map is a {road length} × {initial stone count} pair) + → Yes, there will be more maps.
  • - Leagues? I could conceive the referee being permissive - (allow 0 stones thrown) in the first one, and then strict. - Off the top of my head: + Leagues
      -
    1. single small map, cheating is tolerated, boss plays 1
    2. -
    3. the four maps, no cheating, boss plays tit for tat
    4. -
    5. full map continuum
    6. +
    7. + single small map, cheating is tolerated, boss plays tit + for tat (9/10) or cheats (1/10) +
    8. +
    9. + rock troll and ice troll unlocked; multiple rounds; + four maps available; no cheating; boss plays well but + not perfect +
    10. +
    11. + all races unlocked; map continuum, no boss but default + AI doesn't lose. + +
    + For the WIP phase of this draft, I'll likely merge the last + two leagues into one because we need data on what makes the + games interesting.
  • - Fog of war? (see only troll position, not enemy - throw/stones left) Probably not in this game, be it simple, - variable (seeing enemy stones is a boolean decided randomly - as part of the map) or by distance. + Fog of war? Cancelled. Not in this game.
  • - Praise for my artistic skillz + Praise for my artistic skillz. There can never be enough + of that.
  • Other remarks? @@ -91,11 +102,94 @@ I/O Protocol
    - Just read the sample code. You can figure this out. -
    - You're currently allowed the default SDK timings. I think it's - one second for the first turn and 50 ms then, but don't - quote me on this. +

    + This place used to read: “Just read the sample code. You can + figure this out.” Here are the formalities for that + other part of the audience. +

    +
    +
    Map Input
    +
    +

    + Your first line of input contains three space-separated + parameters: + roadLength initialStones seed +

    +
    +
    roadLength
    +
    + distance between both castles, between 6 + and 14. +
    +
    initialStones
    +
    + number of stones a castle starts the day with, + between 0 and 50. +
    +
    gameSeed
    +
    + the game's seed. The game AIs use it to provide you + with reproducible matches even when they use stochastic + algorithms, and you're encouraged to do the same! See + examples section below for simple ways to achieve that. +
    +
    +
    +
    +
    +
    Turn Input
    +
    +

    + At each turn, you are provided with the following three + space-separated values: + trollDistance + stones + opponentStones +

    +
    +
    trollDistance
    +
    + distance between the troll and your castle +
    +
    stones
    +
    + number of stones you have left +
    +
    opponentStones
    +
    + number of stones your opponent has left +
    +
    +
    +
    +
    +
    Turn Output
    +
    +

    + After having received your turn input, you are to output + a single integer stones: the number of stones + you wish to throw at the troll. +

    +

    + You may optionally provide a message you wish + your castle to yell at the troll or at your opponent. + Just append it to your output, being sure to separate it + with at least one space. + +

    +
    +
    +
    +
    Timing Considerations
    +
    +

    + You're currently allowed the default SDK timings. I + think it's one second for the first turn and 50 ms + then, but don't quote me on this. +

    +
    +
  • @@ -105,23 +199,38 @@

    - The following maps are currently available and randomly yet - extremely fairly (you wouldn't believe the effort that went - into this) chosen uniformly at random among the following: + In the lower leagues, the following maps are currently + available and randomly yet extremely fairly (you wouldn't + believe the effort that went into this) chosen uniformly at + random among the following:

    - - - - - - - +
    Road length│Stones
    ──────────┼──────
    6│15
    6│30
    14│30
    14│50
    + + + + + + + + + + + + + + + + + + + +
    Road lengthStones
    615
    630
    1430
    1450

    You can also override them via game - settings roadLength and initialStones, so - long as you remember you won't be choosing them for ranking - play. + settings roadLength and initialStones, + so long as you remember you won't be choosing them for + ranking play.

    @@ -140,7 +249,7 @@

    This draft's last change is: - troll pants' color can be chosen. + game seed is sent in inputs.

    diff --git a/config/stub.txt b/config/stub.txt index 886ec28..76ff251 100644 --- a/config/stub.txt +++ b/config/stub.txt @@ -1,4 +1,4 @@ -read roadLength:int initialStones:int +read roadLength:int initialStones:int gameSeed:long gameloop read trollDistance:int stones:int opponentStones:int write 1 @@ -9,9 +9,10 @@ Keep the troll out of your castle! INPUT roadLength: the distance (even) between both castles. The troll starts at half that distance. initialStones: the number of stones each castle starts with. +gameSeed: a random number to salt and help make your games more reproducible. trollDistance: distance between the troll and your castle. Keep it above zero! -stones: number of stones left. -opponentStones: number of stones left to your opponent. +stones: number of stones you have left. +opponentStones: number of stones your opponent has left. OUTPUT number of stones to shoot at the troll. diff --git a/src/main/java/com/codingame/game/Player.java b/src/main/java/com/codingame/game/Player.java index e73482a..63f9e50 100644 --- a/src/main/java/com/codingame/game/Player.java +++ b/src/main/java/com/codingame/game/Player.java @@ -22,8 +22,9 @@ public class Player extends AbstractMultiplayerPlayer { } // same-typed positional parameters… a disaster waiting to happen - void gameInit(int roadLength, int initialStones) { - sendInputLine(String.format("%d %d", roadLength, initialStones)); + void gameInit(int roadLength, int initialStones, long seed) { + sendInputLine(String.format("%d %d %d", + roadLength, initialStones, seed)); } void sendGameTurn() { diff --git a/src/main/java/com/codingame/game/Referee.java b/src/main/java/com/codingame/game/Referee.java index b15b4b0..f9c442b 100644 --- a/src/main/java/com/codingame/game/Referee.java +++ b/src/main/java/com/codingame/game/Referee.java @@ -31,7 +31,8 @@ public class Referee extends AbstractReferee { gameManager.getPlayer(1).model = model.p1; for (Player p: gameManager.getPlayers()) { - p.gameInit(model.roadLength, model.initialStones); + p.gameInit(model.roadLength, model.initialStones, + gameManager.getSeed()); } view.init(model);