Code4Life - Bugs

Hi fellow coders,

Use this topic to report bugs or remarks about the Code4Life challenge.

If you still don’t know what’s Code4Life yet, take a look here : https://www.codingame.com/contests/code4life

The referee code is publicly available on Github
Codingame Java: https://github.com/CodinGame/Code4Life

Referee changes can be tracked: https://github.com/CodinGame/Code4Life/commits/master

Bugs:

  • Fixed: Provided Rank (as Input) now goes from 1,2,3 instead of 0,1,2 for some samples
  • Fixed: Typo Medicine
  • Fixed: Missing sample 2 02303 B
  • Fixed: Update sample 2 30220 C -> 2 30230 C
  • Fixed: Statement still refers to 0,1,2 in some part.

Not Bugs:

  • Samples go back in order when completed
  • You can use Health == -1 to know when a sample in not diagnosed yet
  • Samples and projects won’t change for the final rerun.
  • Player 0 hasn’t any advantage in Cloud Sample

Advanced:
You can validate a sample without diagnosed it.

I will remove some post to keep this thread short, don’t worry.

1 Like

Hello,
You’re all very welcome for the feedback.

I’d just like to state that I’ve fixed the bug which caused a sample’s rank to be 0/1/2 instead of 1/2/3 when in the cloud or carried by the opponent player.

Hope it doesn’t cause too much confusion,
Thanks for understanding.

-Julien

1 Like

Samples and projects might change during contest (till Legend) but it won’t for the final rerun, aka it will be the same as the Legend League.

@Neumann Sorry, it won’t be fixed, but we will take that into consideration for the later contests :wink:

Legend league ruleset will be final.

The set used in final rerun will be the same as used for the Legend. It will not be generated randomly or whatsoever.

It’s intended that when samples are in the cloud, both players can pick them.

Otherwise, if both players try to take the same sample at the same turn, only the one who diagnosed it, will receive the sample. I tried to reproduce your behavior, and everything works as expected.
If you have a replay where it’s not the case, you can share it here, and we’ll take a look.

1 Like

I have a silly question. How can one see, through GitHub, the changes made to the referee file? I swear that a moment ago I could find a diff with the most recent changes, but now I can’t. I’d like to see the whole history of referee file so I can easily find all the changes since the beginning and make adjustments to my code. (While I use git on my personal computer, I have never used GitHub or another cloud repository. Thanks for humoring my naivety.)

There is a link in my first post to track commit on the Referee.java code.

When I go there, all I see is one commit. I don’t see any previous commits? Do you see the same, or am I doing something wrong?

Nvm, the repo has been rebased since this morning, so you won’t be able to see anything with my link. :disappointed_relieved:

Here is the quick view of the changes:

-public static int LEAGUE_LEVEL = 2; // 0, 1 or 2
+public static int LEAGUE_LEVEL = 3; // 0, 1 or 2. 3 is for silver+.

-public static final int[] RESOURCE_PER_TYPE_BY_LEAGUE_LEVEL = { 99, 99, 6 };
-public static final int[] SCIENCE_PROJECTS_BY_LEAGUE_LEVEL = { 0, 0, 3 };
-public static final int[] INIT_DIAGNOSED_SAMPLES_BY_LEAGUE_LEVEL = { 50, 0, 0 };
+public static final int[] RESOURCE_PER_TYPE_BY_LEAGUE_LEVEL = { 99, 99, 6, 5};
+public static final int[] SCIENCE_PROJECTS_BY_LEAGUE_LEVEL = { 0, 0, 3, 3};
+public static final int[] INIT_DIAGNOSED_SAMPLES_BY_LEAGUE_LEVEL = { 50, 0, 0, 0};

-public static final int SCIENCE_PROJECT_VALUE = 30;
+public static final int SCIENCE_PROJECT_VALUE = LEAGUE_LEVEL < 3 ? 30 : 50;

 
-	return super.gameOver() || players.stream().anyMatch(p -> p.score >= MAX_SCORE);
+	if (LEAGUE_LEVEL >= 3) {
+	    return super.gameOver();
+	} else {
+	    return super.gameOver() || players.stream().anyMatch(p -> p.score >= MAX_SCORE);    
+	}


+samplePool.get(1).add(new Sample(new int[] { 0, 2, 3, 0, 3 }, 20, MoleculeType.B));

-samplePool.get(1).add(new Sample(new int[] { 3, 0, 2, 2, 0 }, 10, MoleculeType.C));
+samplePool.get(1).add(new Sample(new int[] { 3, 0, 2, 3, 0 }, 10, MoleculeType.C));

-p.put("production", "$%d researched medecine for sample %d, scored %d health points and gained expertise in molecule %s");
-p.put("productionNoGain", "$%d researched medecine for sample %d, scored %d health points");
+p.put("production", "$%d researched medicine for sample %d, scored %d health points and gained expertise in molecule %s");
+p.put("productionNoGain", "$%d researched medicine for sample %d, scored %d health points");


-sampleLines.add(join(sample.id, -1, sample.rank, sample.getGainChar(), sample.life, resourceArrayToString(sample.cost)));
+sampleLines.add(join(sample.id, -1, sample.rank + 1, sample.getGainChar(), sample.life, resourceArrayToString(sample.cost)));

I just told the team to not rebase anymore, so the track list will be available if the referee change again, sorry for the inconvenience.

1 Like

If I’m not mistaken, the health for that sample should be 10, not 20.

Hi,

The changes look interesting, and should promote a more complex gameplay!

I think there is still at least one bug in the samples, which are not fairly distributed. In the rank 1 samples, there are two { 0, 0, 0, 0, 5 } samples (https://github.com/CodinGame/Code4Life/blob/master/Referee.java#L447 and https://github.com/CodinGame/Code4Life/blob/master/Referee.java#L453), but zero { 5, 0, 0, 0, 0 } sample. There might be other similar unfairness, but I didn’t parse it too closely yet :wink:

The tooltips in the player are still off: replay.
The color correctly implies, that not-na completed a science project. However according to the text when hovering over it, it was to to finish that project.

1 Like

I have a question about the distribution. Why do halve the health-30 samples require 14 samples, while the max for a health-50 is only 10? I could produce a 50 if I get 2 expertise on the molecule that takes 7, but I need at least 4 expertise to produce any of the health-30 samples.

Also, once I have 2 expertise, I require only 8 samples to fetch that 50 health sample, while I still need to fetch 10 samples for the 30 health sample, increasing the chances that my opponent steals the required molecules away.

Steps 4
Sample
0 -1 1 0 1 0 2 0 0 2
Step 5
Game Summary:
meowwww downloads sample 0 from the cloud.
Nazim downloads sample 0 from the cloud.
Step 6
50 0 1 0 1 0 2 0 0 2
0 1 1 0 1 0 2 0 0 2
where we can see that sample 0 is carried by another robot. And as result I have problem in the end
Step 19
Standard Output Stream:
CONNECT 0
Game information:
Invalid CONNECT: you are not carrying sample 0
Game Summary:
meowwww researched medicine for sample 0, scored 1 health points

So, is it bug? And why robot can gather molecules for sample which not carried by him?

Link to video https://www.codingame.com/replay/221353125

As I see my robot took sample with id 0 but next step id changed to 50

You timeout because your code ouputs CONNECT 50 twice. The first one works as expected, then you timeout because you don’t have any sample anymore.

Interesting. I will take a look, thanks for the reply!

1 Like

Hi,
I actually want to check if the fault is mine as the console keep connecting to the first sample id I got even though I clear the sample. I put debug message before and after the print message and here is the partial code I used:

                System.out.println("GOTO DIAGNOSIS");
                System.err.println("sample id after for loop2 "+bestSample.getSampleId());
                System.out.println("CONNECT "+bestSample.getSampleId());
                System.err.println("sample id after for loop3 "+bestSample.getSampleId());/

output of 1st round
sample id after for loop2 0
sample id after for loop3 0
CONNECT 0

output of 2nd round
sample id after for loop2 9
sample id after for loop3 9
CONNECT 0

You should not print multiple times per turn. It can create discrepancies like that.