Ghost in the Cell (aka Cyborg Uprising) - Puzzle Discussion

The challenge doesn’t seems to work in scala, at least the default implementation provided is throwing exceptions

Stub generator problem … You need to replace

  • linkcount by linkCount
  • entitycount by entityCount

After modification it should work

1 Like

Thanks Dwarfie, I’m ashamed to have not seen it ^^

I’m struggling with random timeouts in about a third of the runs. It happens against the boss, against other players and also against an older version of my code. Here’s the code in the main loop where I’m reading the inputs:

# game loop
while True:
    # the number of entities (e.g. factories and troops)
    e_count = int(input())
    troop_lst = []
    print("Start Input", file=sys.stderr)
    for i in range(e_count):
        print("Next!", file=sys.stderr)
        entity_id, entity_type, arg_1, arg_2, arg_3, arg_4, arg_5 = input().split()
        print("%d/%d:"%(i+1,e_count),entity_id, entity_type, arg_1, arg_2, arg_3, arg_4, arg_5, file=sys.stderr)
        entity_id, arg_1,arg_2,arg_3,arg_4,arg_5 = int(entity_id), int(arg_1),int(arg_2),int(arg_3),int(arg_4),int(arg_5)
        if i<f_count:
            facs[i]=[entity_id,arg_1,arg_2,arg_3,arg_4,arg_5]
        else:
            if entity_type == "TROOP":
                troop_lst.append([entity_id,arg_1,arg_2,arg_3,arg_4,arg_5])
            else:
                bombs = update_bombs(bombs, entity_id, arg_1, arg_2, arg_3, arg_4)
    print("Finish Input", file=sys.stderr)

While I don’t get an actual error message, it always happens while reading the last input line. My guess is that it’s waiting for a non-existing input, but I can’t think of any reason for such an issue to occur.

Here’s an (shortened) example log:

Standard Error Stream:
Start Input
Next!
1/24: 0 FACTORY 0 0 0 0 0
Next!
2/24: 1 FACTORY 1 0 1 1 0
Next!
3/24: 2 FACTORY -1 8 2 0 0
[...]
Next!
22/24: 67 TROOP -1 2 9 1 1
Next!
23/24: 70 TROOP -1 6 4 6 2
Next!
Game information:
Timeout: the program did not provide 1 input lines in due time... hasl3r will no longer be active in this game.

or

### Standard Error Stream:
Start Input
Next!
1/20: 0 FACTORY 0 0 0 0 0
Next!
2/20: 1 FACTORY 1 2 0 0 0
Next!
3/20: 2 FACTORY -1 0 0 0 0
[...]
Next!
17/20: 47 TROOP -1 10 4 3 3
Next!
18/20: 51 TROOP -1 12 10 1 3
Next!
19/20: 52 TROOP -1 12 9 1 12
Next!
Game information:
Timeout: the program did not provide 1 input lines in due time... hasl3r will no longer be active in this game.

I’d be very grateful if someone could help me with this issue.

Python buffers messages so you are probably getting past where you think you are but not seeing the message.

Change all your stderr prints to print(msg, file=sys.stderr, flush=True) - you’ll probably see you get past the inputs.

2 Likes

hello,

how i can calculate the distance between factories?

Le dernier print à la fin de la ligne ne doit pas avoir de ;

Like you said, You ask one more input but have you removed one before ?
Perhaps
factory_count = int(input())

link_count = int(input())
for i in range(link_count):
factory_1, factory_2, distance = [int(j) for j in input().split()]

Hello @BLVCK971, t’as déterré un post de plus de 6 mois :slight_smile:
Thibaud avait déjà répondu. Sinon donne de tes news en MP…

My feedback is probably a bit late :slight_smile: But some numbers seem off in the input:

  • Distances between factories seem actually 1 more than the ones given during the first turn: if a "MOVE a b" order is made on turn N, and d is the given distance between factories a and b, then are the following correct ?
    ** The sent cyborgs will be available on turn N+(d+1) if they win the fight
    ** If there are “TROOP _ _ b _ (d+1)” entities at the time of the order, they will arrive at the same time
    ** Factory b will produce (d+1) times before the fight

  • Bombs seem to disable factory production for 4 turns instead of the advertised 5: in the input, factories shown with a breakdown of 1 seem to produce normally as if they had no breakdown.
    It is probably too late to change this behaviour but it may still be clarified in the rules.

Is there a way to disable the turn number labels on the console? I find them to be covering part of my debug output, and would like the option to toggle them.

Thank you!

Press F12, go to the console and paste the following, then hit Enter:
$('.frame-number-bloc').css('visibility','hidden')

2 Likes

I wish to print a few example maps of this game for the purposes of working out some strategy and algorithms by hand, and on these maps I would like the distance between each factory represented. Is there any way to have the game render the distances between factories at all times, so that I might screenshot it, or will I need to construct my own representation to include the distance between each factory?

The viewer don’t allow you to do that. But you can print the graph information and then use another tool to draw it. But since each the factory are linked to all the others the result can be a bit confuse…
Here’s an example generated with this tool: https://graphonline.ru/en/ (I don’t recomand it most than another, it’s just the first I found).

1 Like

Thank you, I will look into various ways to represent it.

When attempting to use debug mode, the view of the action becomes incredibly outsized, only allowing me to see the very top-left of the action. I would like to restore the zoom of the viewport to normal, and am unsure how to do so. I am happy to provide any and all necessary information, I do not know at this time what would be relevant to know. Picture of problem attached.

1 Like

I don’t have any problem with that… What browser do you use ? And do you use some extensions ?

I am using Google Chrome. I checked extensions and removed an epub reader, vpn I have not used for a while, and google apps (docs, sheets, slides), and it is working now, with the only extension being the codingame external ide sync. I am not certain if that is why it is working now, but I thank you.

Hi all!

When launching my clojure! AI in the arena, it suffers random timeout before the first turn.
It really is random because when loading the battles where it happens in the IDE, there is no timeout.

In order to be sure it’s not because of my AI being at the very time limit, I printed the time at multiples places in my code.

  1. When the timeout occurs, nothing is printed. Since the first timestamp is printed at the very beginning of the program (even before reading the first input), that means it’s not my code that causes the timeout.
  2. When it works (i.e. no timeout), my code spends around 60ms on the first turn out of 1000ms allowed, and 30ms on each turn out of 50ms allowed.

Since it’s written in clojure, it runs on the JVM which loads an additional JAR. Could the problem comes from there?

Thanks for your help!

Hi !
It’s a known problem that was reported about one month ago, during the last contest. It is officially “being solved” but I don’t know more about that. The staff is currently on holidays, but I will ask for news next week…

1 Like