[Community Puzzle] Hunger Games

Hello,

I pass all test on easy puzzle Hunger Games (https://www.codingame.com/training/easy/hunger-games) but I don’t pass the last validator ( the 6th ) and I really don’t know why, I wrote again my solution twice, made some backwards and I’ve got the same result … anybody had the same problem and pass it ?

Thanks !

1 Like

it seems you didn’t respect this rule when one adventurer killed several:

All information is expected to be in alphabetical order

I’m surprised though that it isn’t tested by any IDE test. Perhaps we need to update the puzzle.
I can give you the validator if needed.

1 Like

Ok found the problem, sorry !

You was kinda right, I didn’t respect entirely the rule, I did the sorting when inserting killed person but forgot to do a sort each time I add new killed person. This way it passed the test 6 ( Alphabetize Victims ) where it’s indeed mandatory. So the tests are good, i’m just a dumbass :smiley:

Thanks a lot !

1 Like

For anyone who maybe have the same problem, don’t sort the victims by alphabetical order when inserting them but when parsing them :wink:

Hey guys,

I still don’t understande why is not passing the 6th validator. Can anyone give an example?

Your algorithm has the same issue. Did you read this thread before posting?

Problem in Validator 6, please info of validators, or data test for testing.

Thank

1 Like

I figured it out. I am not very good at dictionaries, so i went for straight string manipulation. Found my problem, I lower cased key words, and these key words were apparently names. So be careful of that.

Hello,
For the Hunger Game puzzle by MSWS I have an error when submitting my code.
The 6th test does not pass, I know the submission tests are different from the ide tests however I am unable to find the reason to my error.
Is it possible to give me the 6th test so i can understand / correct my mistake please?
Thank you and sorry for the inconvenience.

1 Like

Hello,
Same issue for me :cry:

Does the discussion above help you?

Resolved, Thank you

Hello all,

I have a problem with the easy puzzle “Hunger games” in PHP :
I want to return an empty line, for make a return like this between each tributes :
Name: Bowser
Killed: None
Killer: Mario

Name: Mario
Killed: Bowser
Killer: Winner
But with an “echo(“Killer: Mario\n”);echo(“\n”);”, I have this error :
Find: Killer: WinnerEnd of line (\n)
Waiting : Killer: WinnerNothing
If you have an idea of how to do?

Thanks

Hello Roro, please add link to the puzzle you seek help.

Nevertheless, this puzzle does not accept end of line for the last line of your output.
So you need to change your code to deal with this.

Here is the puzzle : Coding Games and Programming Challenges to Code Better
I tried a lot of things, but nothing works, that’s why I post here :slight_smile:

Pretty clear for me. It’s says that the output ends with “end of line” while it should ends with “nothing”.
Have you tried to replace your echo(“\n”) with nothing (e.g. remove it :wink:)

Yes, I understand what you say, but the problem is this : I need to put one clear line between the two blocs of tributes.
But I can’t put a double “\n”, it make an error :confused:

EDIT: problem solved

For example you could use this inside the for cycle of tributes:
if (i<tributes-1)
{
Console.WriteLine();
}

Hi,
I have the same problem in JAVA.
If I put System.out.println(); or System.out.println(…“\n”) for the last line, I get the error message WinnerEnd of line (\n) instead of WinnerNothing.
And if I put no extra line, I get an error message too (found “Na…” instead of Nothing).
Did you find a solution (even in PHP, it might help me).
Thanx,

As I understand, the problem is that you are displaying new line to the very end of the list. It is expected that there is no empty line after last “Killer: …” line;
so we do like that:
if(i < tributes-1)
{
display empty line;
}
Did you understand?