Fall Challenge 2020 - Bugs & Questions

small mistake in statement:

“LEARN id: your witch attemps to learn the tome spell with the given id.”

attempts

Actually it’s not even an option :confused: The gc isn’t hooked to the engine.

Could we get the ID of customer delivered to in the tooltip on the timeline?

Same here (have to keep it bellow 30ms, I have lag spikes ranging from 2ms to 20ms).

From my understanding, it’s due to the garbage collector of JS which can be very unpredictable. If it’s this, I think there’s nothing we can do about it :confused:

Maybe using object pooling, not using array and splices… But you kinda miss the point of using JS then.

That’s what I’m thinking. If we could have access to global.gc() it would be nice (it needs to be enabled when launching node). Otherwise I don’t think this is something we can solve ourselves, it would be nice if someone from CG could have a look.

1 Like

I don’t want to be rude guyz, but all of you complaining about languages with garbage collector, I would like to say : just deal with it or use a language without GC. There is not much they can do about it anyway. Maybe use a library with native types and avoid object allocation/deallocation during gameplay, don’t use strings too much, etc. :expressionless:

My question now : BREW 69 is the only outlier in the potion dataset. The price cost of a potion follows a predictable formula except for this one. Do you intend to keep it that way or is it a mistake ? or a joke (why 69 anyway ?). :grin:

EDIT: I know. This is supposed to be a love potion or an aphrodisiac. Therefore it fetches a higher price on the market ! :smiling_face_with_three_hearts:

Yes it’s not a bug, it’s explained in the rules that every remaining ingredient from tier-1 to tier-3 will give +1 rubis as a bonus at the end of the game (tier-0 ingredient = 0 bonus) :wink:

Hi !
In “Last Battle” number 29 I got this #2 avatar instead of #1 :


The replay is here : https://www.codingame.com/replay/502035122
Thanx for this nice game ! :smiley:

I am also facing this warining when using Java: “Warning: your code did not read all available input before printing an instruction, your outputs will not be synchronized with the game’s turns and unexpected behaviour may occur.”
I know that I should use some objects pooling and other optimizations for performance reasons in Java, and I will at some point, however in past contests my code wasn’t timeouting due GC. I was able to use unoptimized code in first 1-3 days of contest to find my strategy, and then focus on better code.

Is my check for used time correct? Is it expected that below code randomly timeouts?

import java.util.*;
import java.io.*;
import java.math.*;

class Player {

    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);

        // game loop
        while (true) {
            int actionCount = in.nextInt(); // the number of spells and recipes in play
            long start = System.currentTimeMillis();

            for (int i = 0; i < actionCount; i++) {
                int actionId = in.nextInt(); // the unique ID of this spell or recipe
                String actionType = in.next(); // in the first league: BREW; later: CAST, OPPONENT_CAST, LEARN, BREW
                int delta0 = in.nextInt(); // tier-0 ingredient change
                int delta1 = in.nextInt(); // tier-1 ingredient change
                int delta2 = in.nextInt(); // tier-2 ingredient change
                int delta3 = in.nextInt(); // tier-3 ingredient change
                int price = in.nextInt(); // the price in rupees if this is a potion
                int tomeIndex = in.nextInt(); // 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 = in.nextInt(); // 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
                boolean castable = in.nextInt() != 0; // in the first league: always 0; later: 1 if this is a castable player spell
                boolean repeatable = in.nextInt() != 0; // for the first two leagues: always 0; later: 1 if this is a repeatable player spell
            }
            for (int i = 0; i < 2; i++) {
                int inv0 = in.nextInt(); // tier-0 ingredients in inventory
                int inv1 = in.nextInt();
                int inv2 = in.nextInt();
                int inv3 = in.nextInt();
                int score = in.nextInt(); // amount of rupees
            }

            List<MyObject> someData = new ArrayList<>();
                
            while(System.currentTimeMillis() - start < 40) {
               
                if(someData.size() < 25000) {
                    someData.add(new MyObject());
                } else {
                    someData = new ArrayList<>();
                }
            }

            long end = System.currentTimeMillis();
            System.err.println((end-start)+"ms");
           
            System.out.println("REST");
        }
    }

    public static class MyObject {
        public final int[] data = new int[100];
    }
}

I’ve seen that several times in other games too. Not a contest specific issue. Usually I just close and reopen the replay.

1 Like

You are creating up to 25_000 objects… you’re definitely going to have garbage collection problems (just saying what you already know). Since you’re using ArrayList, why not just do something like:

MyObject[] someData = new MyObject[25000];
int someDataCount;

By the way, I am guessing those objects are tree nodes, so definitely recycle them in my opinion. You can get a decent bot with barely 5000 nodes, using 10-15 ms. Good luck :slightly_smiling_face:.

1 Like

Sure that’s how things are, we can’t do anything, deal with it.
Not to be rude but I’d have lost my job 10 years ago with that mentality.

1 Like

i have noticed one bug in the refree - https://github.com/CodinGame/FallChallenge2020/blob/1a3428df225711bf76cb7588fa2e848825d750cf/src/main/java/com/codingame/game/Game.java#L268-L269
refree updates the inventory first and then shows the warning message - https://github.com/CodinGame/FallChallenge2020/blob/main/src/main/java/com/codingame/game/GameSummaryManager.java#L54
which caused error at turn 12 - https://www.codingame.com/replay/502157528

seed=5848640168752334800


to reproduce it
1 Like

Sure that’s how things are, we can’t do anything, deal with it.
Not to be rude but I’d have lost my job 10 years ago with that mentality.

Wow, it’s getting personal and I am not sure why… Can we keep the topic clean ? If you want to discuss my mentality, let’s discuss this in private.

As for assuming that I am someone who never tries to change anything, quite the opposite is true. Go to https://logiqub.com, read about the project and what I am trying to do. I wrote a full virtual machine in assembly to help people learn how to do it themselves and innovate more.

My dream is to create something like CodinGame, but I have very exotic ideas. I am not happy to use Python, C, JavaScript and the like. Freedom (to change the compiler and language syntax) is something I value a lot. So maybe, you’re wrong about me… but as I said, if you want to continue this discussion, just PM me.

Hello,

The arena is only playing ten games and stops. I was around the 400th place and now impossible to get higher than 1500th so I don’t know if my latest changes were good or not.

Is it because very few people are online at the moment ?

2 Likes

The arena is very very slow. I have 7 battles stuck on 0% progress and none finished at all yet. It’s like 20 minutes now from sending it.

1 Like

Is it because very few people are online at the moment ?

The code of the bots is on the CodinGame servers, so people being online or not has nothing to do with it once submitted. Apparently they are updating something or having problems. We will have to wait and see.

Hey guys, i think at the moment the servers of CodingGame have some trouble, cause i see on each submission this error:

Warning: your code did not read all available input before printing an instruction, your outputs will not be synchronized with the game’s turns and unexpected behaviour may occur.

I’m using Ruby for this contest, which also has a garbage collection.

And … this error occures also on submissions which had worked before without any problems. I use a versioning System so i have access to all modifications of the last 24 hours and none works anymore correctly except the very early one which only takes 2-3ms …

In addition i have examined the GC problem and tried to get some statistics:

Garbage Collection active:
major-garbage-collections:5,
minor-garbage-collections: 1109
total-allocated-objects: 8084332
total-freed-objects: 8060954
old-objects-limit: 32854

Garbage-Collection disabled:
major-garbage-collections:3,
minor-garbage-collections: 10
total-allocated-objects: 3054585
total-freed-objects: 68298
old-objects-limit: 30860

In Both cases the Program does not work correctly and the above mentioned error is shown. So i don*t think the actual Problems are related to the GC.

2 Likes

Ok thanks !

Hi, I have a question. I have been working on this using integer programming optimization. But it seems no library is allowed for python for it (PuLP or cvxy or anyother). Does anyone know how I can do it? Linear programming wont work with complex spells.

Thanks!