Code4Life - Bugs

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.

Hello!

Silly question, but in the Bronze League how or when can I read the samples? Every time I try to read the number of samples I got the error message:

Game information:
Timeout: the program did not provide 1 input lines in due time… stomo will no longer be active in this game.

Thanks for help!

Hello!

I can’t understand this rule:
“The player acquires molecule expertise: the robot will need 1 less molecule of the type specified by the sample for producing all subsequent medicines.”

Could somebody tell me an example for that? :slight_smile:

Thanks for help! :slight_smile:

P.S.: Sorry , if I wrote to the wrong place, then please tell me, where I can find help :slight_smile:

If you have a sample that requires 3A and you have 1A in expertise, then you only need 2 molecules of A to complete the medicine.

2 Likes

It looks like my robot stops while reading the samples. I put a print in the reading loop, and it tries to read 14 samples but there is 13, and so I have a timeout after reading the thirteen one and waiting for another input.

At least that’s what I think is happening, or there is a really weird bug in my code.

Your code timeout:
Timeout: the program did not provide 1 input lines in due time… sohakes will no longer be active in this game

So either you’ve got a runtime error, or you didn’t print an output. Either case, there is a bug in your code.

Sry Nazim, indeed the game summary could say “downloads sample 50 from the cloud”

As you probably understand, we cannot have 2 samples with the same id in the game, so when both players ask for the same sample (before bronze), it gets cloned and the “second” one gets another id.

However, I’m pretty sure that you can see that you’re carrying sample 50 in the inputs and not sample 0.

You can gather any available molecule you want. You don’t need a sample to do so.

Hope it helps,

Thibaud