Code4Life

Does anyone know if the samples available in the “Code for Life” contest will always be 50?
Also, in general, can we get the range of the different integers (e.g. costA, health, …)?

Expert Rules
Source code
The source code of the referee is available on our Github at this address: https://github.com/CodinGame/Code4Life

1 Like

Thanks! I didn’t know it was there
That definitely answer the questions (and more :slight_smile: ).

Me thinks there is some rule I am not following. I collect a sample, collect the materials and deliver the samples and materials to the lab twice, but the third time it fails with

Invalid CONNECT: you do not have enough molecules/expertise to launch research on sample 2

Near as I can tell, I do have enough molecules. s1 is the per player data, s2 is sample data:

Standard Error Stream:
> sampleCount: 49
> i: 0  s1[i]: 1  s2->cost[i]: 1
> i: 1  s1[i]: 0  s2->cost[i]: 0
> i: 2  s1[i]: 0  s2->cost[i]: 0
> i: 3  s1[i]: 0  s2->cost[i]: 0
> i: 4  s1[i]: 2  s2->cost[i]: 2

Is the sample count supposed to change? Sometimes it’s 50, sometimes it’s 51 and sometimes it’s 49, all in the same run.

Is sample Id always equal to the index? So far that seems to be the case.

I tried starting with the last sample first (i.e. sample 49) and it blew up immediately.

Usually Dr. Jekyl and I get a different sample numbers, but sometimes we get the same one. That shouldn’t be happening, should it? I’m checking that the sample is located in the cloud (-1).

No.
In wood2 you have a set of initial samples. When they get diagnosed, they disappear. That will change the index of the later samples, while the ID stays the same.

Isn’t there a problem with the priority of players ? At the upload step (in LABORATORY) I can be eliminated if I try to “CONNECT” a sample that was uploaded by player 1 in the same turn

See https://www.codingame.com/replay/286593963 and https://www.codingame.com/replay/286593962 for the visual explanation.

Is this normal (I think it should be in the statement then) or should we just accept that this will happen ?

As the game information says: “Invalid CONNECT: you are not carrying sample 13”
You can only pass those samples to the laboratory, that you are carrying yourself. There’s an input variable just for that information.

1 Like

I’m not clear about the “expertise” in Wood 1 League.
The laboratory module description says
“The player acquires molecule expertise: …”

but the Input description says:
“expertiseA, expertiseB, expertiseC, expertiseD, expertiseE: ignore this for this league.”

Hi suspect the former is correct and the latter is just leftover of Wood 2 League.

Am I correct?

No, I was wrong. Expertise are not used in Wood 1 League.

For most contests I get an email after it is finished, which contains my ranking and my final code.
But for Code4Life there was no email.
Is there any way to find my Code4Life program that I wrote last May, or do I have to start again?

You can find your code on this page : https://www.codingame.com/contests/finished
click on “view report”.

1 Like

Thank you!

I think I may have found a bug. The Connect statement in my code doesn’t get represented as the connect instruction on the screen. This works fine for the first round but the subsequent round it causes an error.

Here is the replay link: https://www.codingame.com/replay/287906482

Relevant logs:
Sample ID 1
connectString CONNECT 1
Standard Output Stream:
CONNECT 0
Game information:
Invalid CONNECT: the sample 0 is not available

I’m not sure I understand the problem here besides the fact you try to connect a sample which was already been validated in the laboratory.
Looks like a bug in your code.

My code has the instructions to CONNECT 1 the output stream is seeing CONNECT 0 that is the bug.

Is there a way to debug the interpreter to ensure that it is properly reading the code.

Would it help if I sent you the code so you could reproduce the error? I’m new here so I’m not sure what the bug reporting procedure is.

You need to print only one output per turn. That’s the issue here. Your code happens to be working ok but when it fails at turn 23 or something, it actually corresponds to your 2nd or 3rd turn.
I know it feels like working since you can see the error stream correctly printing but it’s not.

That’s an interesting constraint, I must have overlooked it when I read over the game rules. Thank you for looking into the issue for me.

1 Like

That’s actually a constraint for every games using a big while loop on CodinGame (different from the in/out puzzles).
For each iteration, you read the input for the turn, you do your stuff and you output your command for the turn.
Hope it’s clear enough!

1 Like

Thanks for the clarification, that helps quite a bit.