Ghost in the Cell - Puzzle Discussion


#1

:robot: Feel free to send your feedback or ask some help here! :robot:


#4

Anyway to get the last code I had in my editor from the contest, and not last submitted code?

Thanks!


#5

Nope, only the one in the Arena. Sorry


#6

Can you explain me why this battle is counted “won” for the Boss?


Just before the end, his last factory was being swamped with attacking troops, by far more than he produces in his last factory. So why is the final score of total troops 0:2?


#7

Looks like you crashed. If I had to guess I’d say your code is iterating a list of opponent factories and went thud when there weren’t any.


#8

Good point. I should have checked the console output at the end.


#9

I was going to say just that lol


#10

Hello world !
I don’t understand how arg 1,2,3,4,5 are working here !

//if it's mine 
if(arg1 == 1){
        print("move 1 3 1");
    }
      //if Factory 3 is mine
    if(entityId == 3 && arg1 == 1){
        print("move 3 4 1");
    }
    print("wait");

for example this code is doing nothing but “wait”, how can I select a Factory to use it’s args ?
Have fun everybody !


#11

If factory 1 and 3 belong to you, you will write 3 separate lines, thus giving output for 3 rounds.
An easy way is to store the complete input and then loop over all factories, checking if they are yours. If they are, find a factory that isn’t and capture it.
You may want to watch the livestream, where two people for CodinGame tackle the problem.


#12

@eulerscheZahl thanks for your time, don’t want to give up on this one :slight_smile: i’ll check.
Have fun !


#13

I keep my old code in Git via IntelliJ and the synchronizing plugins in Chrome.


#14

I have a problem in the code, I don’t understand why my code print the wrong message,
in python I wrote :

message = "MOVE " + … (I put my value here)
print >> sys.stderr, message
print message

And in the debug console I got :

Standard Error Stream:

MOVE 1 4 1

Standard Output Stream:

9MOVE 1 4 1

So I get an error …

Do you guys have any ideas ?


#16

I noticed some weird behavior with my bot, or more correctly a lack of behavior when sort of middle/late-game, despite there being considerably weak enemy factories left, my factories don’t react or do anything despite when my logic should be telling them to do something, I double-checked all my logic and it seems correct.

My main logic in the while loop is pasted here
Method Link.GetTargetFactory is defined here

An example of this can be seen in this screenshot —> imgur.com/a/YOhjnc3.


#17

Difficult to help you here. I’d advise replaying this same match and adding a lot of debug messages to understand why you don’t take any action to send troops to weak enemy factories.


#18

I think that “Ghost In The Cell” UI is bugged. It seems that bombs and troops are moving twice slower than expected. Battles are very hard to understand: factory production stops before the bomb hits the factory for example.
Is it possible to correct this bug please?
Thanks


#19

you’re right. It has been reported to us yesterday and we’re working on a fix. Sorry about that. I’ll keep you updated!


#20

Merci beaucoup!


#21

I face a strange problem, whenever I build a string, it doesn’t print in console at all.
I checked and double checked scope details, but anyway, when I print the final string in the error console, it prints nice, but after empty iterations.
Of course I checked that it wasn’t in a for or while loop, but it’s just in the main game loop.
Simple example :

    for (let j = 0, m = factory.length; j < m; j++) {
        if (factory[j].owner == 1) {
            instructions+= "MOVE "+factory[j].id+" 0 2;";
            // hardcoded destination just to test
        }
    }
    printErr("INSTRUCTIONS:"+instructions);
    console.log(instructions); 

there is the error console result :

Sortie d’erreur :

INSTRUCTIONS:
INSTRUCTIONS:
same again 21 times then the right string 3 times.
INSTRUCTIONS:MOVE 1 0 2;
INSTRUCTIONS:MOVE 1 0 2;
INSTRUCTIONS:MOVE 1 0 2;

Sortie standard :

(nothing in the output)

Informations :

invalid input. Expected ‘A valid action’ but found ‘’

When I first try to loop over the link map, there are only pairs related to factory 0, so my starting factory is just one line (hope I’m clear, I mean I can’t get pairs starting from my factory.

I don’t say there are any bugs, maybe I just got something wrong or missed an important point.


#22

The best to do in these cases is to print debut messages to check that you correctly read each input.

Here, your factory array is empty. The root error lies in your first readline


#23

Yeah, you were definitely right, it is fixed now, thank you @_CG_Thibaud !