Need help

Hi Everyone !

     This is my first day on Codingame, I started with the Training and passed the test cases for the first game, But When I wanted to submit my code,My final score was 0% and didnt pass any of the test. Can you explain How I should submit my code ?.

Looking forward to your replies :).

Hi, we can’t see your code so it’s hard to help you, anyway here is a general answer :

When you submit your code, it will pass another bench of random enemies. That way, you can’t just write the enemy name like Buzz, HotDroid (you have to find the best target in the for-loop then print it. One enemy per round)

Moreover, your code have to pass all tests in a row.

Hope it’ll help you because these are common mistakes

1 Like

Hi, Thank you for your Reply. But How Could I combine the Code for the 4 test cases ?.

Your solution should be generic, not using conditional statements like
if(itLookLikesImDoingTest1()) {cout<<answer1;} else if...
So for every data possible, your solution should be correct. You need to select enemies to shoot dynamically by verifying in your code what enemy is the closest to your spacecraft.

1 Like

Here is the code for the 2 first test cases:

int main()
{
......
      printf("HotDroid\n");
      printf("Buzz\n");
}

And for the 2nd test case :

int main()
{
            printf("Rock\n");
            printf("HotDroid\n");
            printf("Bolt\n");
            printf("Sectoid\n");
            printf("Buzz\n");
            printf("Zap\n");
            printf("Charger\n");
            printf("Whacker\n");
            printf("HardHat\n");
            printf("MaulMaker\n");
            printf("Fuse\n");
            printf("NutCracker\n");
            printf("Buster\n");
            printf("Hitbot\n");
            printf("DangerDart\n");
}

both of them properly separately .

That’s why. Not only you hardcoded the solution but you didn’t get the point.

Your program have to think by itself which battleship is the closest and shoot it.
In the end, you have to stock the name of that said ship into a string and do something like this:

printf("%s\n", target_ship);
1 Like

Alright, I knew I was doing it wrong :frowning: , Thank you so much your reply was so helpful :smiley: .

1 Like