Onboarding - Puzzle discussion


I think that your code does not print anything.


How do you type codes? I am new


please tell


I don’t even know how to play. Or code


Have you read the tutorial?


Onboarding puzzle
In C language
How to attack?
everytime I write printf(“Attack”);
It shows error


To attack, you need to write the name of the enemy you want to attack. If you use printf("Attack");, it will try to attack an enemy called “Attack”, however there are no enemies with this name :worried:


I’m working with C++, i think i’ve done my code correctly but the cannon doesn’t shoot, could you help me please?


I was having this problem and it turns out there is a print statement at the bottom i was using python and that was holding up the loop once i took it out it started to work. I hope this helps :slight_smile:


I just find some errors, you can not do this.

  1. dist is integer, and closet_enemy is a point. how can you use “dist < closet_enemy”?
  2. how can you use strcat function?


hello everyone,i m a ungraduate student and don t know hot to create a game like this,but more easier,how to start?


Hi, i try to make a struct to storage data from enemies but in main function cin does not get the name of enemies.
Any help please?

#include <iostream>
#include <string>
#include <list>
#include <algorithm>

using namespace std;

 struct Enemy
     int dist;
     string name;     
int main()
    list<Enemy> enemies;
    // game loop
    while (true) {
        Enemy a;
        cin >> a.name; cin.ignore();
        cin >> a.dist; cin.ignore();
        cout << "Enemy: ";
        cout << (*enemies.begin()).name << endl;
        cout << "HotDroid" << endl;
        // To debug: cerr << "Debug messages..." << endl;


Hi all,
please look at this snippet:
val enemy1 = readLine // name of enemy 1
val dist1 = readInt // distance to enemy 1
Console.err.println(enemy1+" “+dist1)
val enemy2 = readLine // name of enemy 1
val dist2 = readInt // distance to enemy 1
Console.err.println(enemy2+” "+dist2)

the output is:
Standard Error Stream:
Nobody 9999
Rock 70
WTF the Nobody with distance 9999 is?


“Nobody” is given when there’s only one enemy on the screen. Since the input is hardcoded to have 2 enemies always provided, if there’s only one, then a “dummy” enemy of “Nobody” is given for one of them. Since it is “very” far away, it should not have any adverse effect on the logic of your program.

  • danBhentschel


@player_one thanks for your answer. The strange thing is that event if there are more then 2 enemies visible (sometimes are 5 at once) you cannot get the name and range of the 3rd, 4th etc. Bug or feature?


That’s by design. The description clearly states:

On each start of turn (within the game loop), you obtain information on the two closest enemies

If it seems like the design is a bit strange it’s because this puzzle has evolved. It actually used to give you information about all enemies on screen, but that seemed a bit hard for newbies, so now it always makes you choose between two options.

  • danBhentschel


Hello Everyone,

This is Prasad. I am trying to complete first program in URL

This program is about destroying the enemy ships by shooting the closest enemy on each turn.

I am trying to figure out how to pass inputs to this program.

Would be very helpful if someone can answer.



It depends on the language you are using but you have help in the puzzle (there is a link somewhere).


i know irs so cool i love coding


Hi I need help in how to code python3