Fall Challenge 2020 - Bugs & Questions

Thanks a lot ! :wink:
I should have been more attentive !
Good game !

That message is often shown when the real cause is a timeout. Check the last lines of output to be sure.
image

At the end of the game the number of ingredients in your inventory that are of tiers 1-3 is added to your score.

[BUG][DART]
I also had some issue concerning the following subject :

  • [Investigating] Desynchronisation warning after a timeout*

I think I resolved it by limiting the execution time of some part of my code, but I don’t really understand what is the maximum execution time per turn because my code spends generally more than 50ms.

In the notice, it is written :
Response time per revolution ≤ 50ms
First turn response time ≤ 1000ms

@TwoSteps Could you give more information on the execution time of our code ?

Are you sure you have that spell? Because there shouldn’t be a problem casting the same spell at the same time, as long as it’s in your book. But there’s a difference in the data between CAST (yours) and OPPONENT_CAST (theirs), so maybe you’re not filtering out the opponent’s spells?

I’ve updated the original post with news for the timeouts and the release vs debug info.

Current bugs

  • [To be released] can’t load replays in SD quality

  • [Working on a fix] Clojure 1st-turn timeouts in arena

  • [Working on a fix] Desynchronisation warning after a timeout

  • [Hard to fix] no C++ stacktrace when segfault

About timeouts & spikes

Really hard to investigate. Won’t fix before the end of the challenge. We’ll try to make improvements for next contest.
I can only advise to take a bit more margin against the 50ms limit and to limit the nb of objects created for GC. It impacts all players.

Release vs Debug mode

We’ll put release in IDE for Rust, C#, F# and VB.net this morning (Wednesday) and see if doesn’t create too many issues for people used to Debug

3 Likes

An idea could be to allow three turns up to 100 ms (including the first one).

:star_struck: :smiling_face_with_three_hearts:

Here is another example where the 2nd player gets 1 additional point out of nowhere at the end:

Oh ok so i found it ! In fact you should write all lines so we can know we put too much lines in the out :confused: In fact i was printing 2 lines and the 2nd gone on the next turn without i knew it. (i’m using PHP)

Could you also put Swift in Release mode ? Please, that would be great !

2 Likes

Players gain 1 rupee for each tier-1 ingredient or higher in their inventory.

Indeed, I missed this one rule.
Sorry

FYI I never knew there could be an item with id == 0 until I started crashing every other time.

1 Like

Hi !
When i try running the source code of the challenge on my computer, i got an error "java: cannot find symbol
symbol: method getId()
location: variable spell of type java.lang.Object ".
I guess it’s dependencies error but i don’t know why. How i’m suppose to make the code work ?
Thanks !

It appears that in release mode for Rust, line numbers are not included in the stack trace for user code. If there is a run time error that occurs in a library function (e.g. panic due to unwrap on an error), I have no idea what line it refers to in my code, since the only reference is “Answer::main”.

@TwoSteps

I would like to measure how long my code takes to run on each iteration. However I don’t know where exactly to place the time pointers.

Could you give us the exact location where we need to place time pointer to measure code duration on each iteration ?

You can realize that sometimes, it takes much more than 50ms between the end of the While-Loop (or the last output print) and the beginning of the read of the first input (in my example below 184ms!).
I also see that the debug output is sometimes not read between the the end of the While-Loop and the read of the first entry.

I made a simple example in Dart to demonstrate this. I placed time watch pointers at different place of the codes below:

REPLAY : https://www.codingame.com/replay/506995742

Turn 1:

Turn 2:


CODE:

import 'dart:io';

/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
void main() {
Stopwatch stopwatch = Stopwatch()..start();
bool isFirstIteration = true;
stderr.writeln('START - ${stopwatch.elapsedMilliseconds} ms');

List inputs;

// game loop
while (true) {
    if (!isFirstIteration) {
    stopwatch.reset();
    } else {
       isFirstIteration = false;
    }
    stderr.writeln('START LOOP - ${stopwatch.elapsedMilliseconds} ms');
    
    stderr.writeln('BEFORE READ - ${stopwatch.elapsedMilliseconds} ms');
    int actionCount = int.parse(
        stdin.readLineSync()); // the number of spells and recipes in play
    stderr.writeln('AFTER READ - ${stopwatch.elapsedMilliseconds} ms');

    for (int i = 0; i < actionCount; i++) {
    inputs = stdin.readLineSync().split(' ');
    int actionId =
        int.parse(inputs[0]); // the unique ID of this spell or recipe
    String actionType = inputs[
        1]; // in the first league: BREW; later: CAST, OPPONENT_CAST, LEARN, BREW
    int delta0 = int.parse(inputs[2]); // tier-0 ingredient change
    int delta1 = int.parse(inputs[3]); // tier-1 ingredient change
    int delta2 = int.parse(inputs[4]); // tier-2 ingredient change
    int delta3 = int.parse(inputs[5]); // tier-3 ingredient change
    int price =
        int.parse(inputs[6]); // the price in rupees if this is a potion
    int tomeIndex = int.parse(inputs[
        7]); // in the first two leagues: always 0; later: the index in the tome if this is a tome spell, equal to the read-ahead tax; For brews, this is the value of the current urgency bonus
    int taxCount = int.parse(inputs[
        8]); // in the first two leagues: always 0; later: the amount of taxed tier-0 ingredients you gain from learning this spell; For brews, this is how many times you can still gain an urgency bonus
    int castable = int.parse(inputs[
        9]); // in the first league: always 0; later: 1 if this is a castable player spell
    int repeatable = int.parse(inputs[
        10]); // for the first two leagues: always 0; later: 1 if this is a repeatable player spell
    }
    for (int i = 0; i < 2; i++) {
    inputs = stdin.readLineSync().split(' ');
    int inv0 = int.parse(inputs[0]); // tier-0 ingredients in inventory
    int inv1 = int.parse(inputs[1]);
    int inv2 = int.parse(inputs[2]);
    int inv3 = int.parse(inputs[3]);
    int score = int.parse(inputs[4]); // amount of rupees
    }

    // Write an action using print()
    // To debug: stderr.writeln('Debug messages...');

    // in the first league: BREW <id> | WAIT; later: BREW <id> | CAST <id> [<times>] | LEARN <id> | REST | WAIT
    stderr.writeln('BEFORE PRINT - ${stopwatch.elapsedMilliseconds} ms');
    print('WAIT');
    stderr.writeln('AFTER PRINT - ${stopwatch.elapsedMilliseconds} ms');

}
}
1 Like

I timeout at 20 ms. You can blame my code but i didn’t have this issue on other contests i was using the timer.

Wondering if it’s the memory usage (doubtful).

1 Like

replied above already

2 Likes

I got the following message:

Summary of new rules

You can now cast spells to acquire new ingredients!

See the updated statement for details.

but I can’t find said updated statement anywhere and since I start the game with only 3 ingredients I am stuck.