Ghost in the Cell - Bugs

Hi fellow coders,

Use this topic to report bugs or remarks about the Ghost in the Cell challenge.

If you still don’t know what’s Ghost in the Cell yet, take a look here : https://www.codingame.com/contests/ghost-in-the-cell

The referee code is publicly available on Github
Codingame JAVA: CodinGame Github
kibotu C# (Pull request): https://github.com/CodinGame/ghost-in-the-cell/pull/1/files

List of fixed bugs:

  • TypeError: Cannot read property 'width' of null on the second run
  • Fix troops’ transparency when paused in the middle of a frame

To help us investigating, please open the console (F12) and check if there are errors that could be related. The link to the game (share button) can be useful too. Thank you.

I am having a problem with seed=729759054.

I am not sure if its a bug or not but the enemies entity id 2 is being identified as being owned by me. To test make sure you test BOTH sides of the map.

If I am on the right hand side it works better, whoever is on the left hand side seems to get the wrong value for entity id 2. If I swap the enemy doesnt seem to be able to do anything either and mine works a bit better.

c++ std::chrono broken as described here: stackoverflow

Hey,

Small precision that should be added on the subject (I think).
It is said in the order of a turn :

1- Move troops and bombs
2- Execute orders
3- Produce new units
4- Solve battles

However, reading the referee, it looks like 4 is more than just solve battles. If you have troops incoming on a factory that is not attacked, the unit count of the troop will be added to the factory’s only at point 4 and not at point 1 as we would think. In any case, unit count modification is done at step 4 (and 5 for the bombs), but not at step 1.

I guess the players not motivated to read the referee would benefit from the precision :slight_smile:

TypeError: Cannot read property 'width' of null should be fixed now.

1 Like

I always take timeout when I try to run my code in PHP. When I use microtime() and dump it, it say that It take less than 0.4sec and I don’t know why it doesn’t work.

Timeout is either a infinite loop or a lack of output. You can easily fix the latest while printing atleast a “WAIT” every turn.

Use the error prints in your path code to spot why/where it doesn’t fit your need

Hi there – the referee may to have a small error in calculating distances between factories (when converting to turns from point measurement) – the result is that in some cases it can be shorter to send troops on two hops instead of directly. For instance if the distance between A and B is 1.3, B and C is 1.3 and A and C is 2.6, then according to the code, the distances in turns become A->B = 1, B->C = 1, A->C = 3.

    public void computeDistances(Factory[] factories) {
    distances = new LinkedHashMap<>();
    for (Factory factory : factories) {
        if (this != factory) {
            distances.put(factory.id, (int) Math.round((position.distance(factory.position) - getRadius() - factory.getRadius()) / 800.));
        }
    }
}

See this comment from the chat this morning for a concrete example: http://chat.codingame.com/pastebin/f51ab9a4-a5a1-4e4a-bf77-8a8d8d6e2e07

If distances were always rounded up (since if you haven’t covered the full distance, you aren’t there), then the results might be more reasonable: A->B = 2, B->C = 2, and A->C = 3.

1 Like

Hello,
In rust I have made some code that seems to output what should be a valid string for your parser, but it is not accepted by it.
Consider the following code (in rust):

let result : String = "MOVE 1 3 5;".to_string();
        println!("{}", result + format!("MOVE {} {} {}",1,9,6).as_str());

The output is :
MOVE 1 3 5;MOVE 1 9 6
And the game tells me that it is : invalid input. Expected 'A valid action' but found 'MOVE 1 9 6'
Of course I have all the factory, fell free to tweak the values as you need. To test the code just put it in a game loop.
I really don’t understand why this is happenning.
I also triple-checked that
println!("MOVE 1 3 5;MOVE 1 9 6"); forms a valid output, and it seems to.
I don’t know if it is a bug in Rust or in my code or in yours, but if you can help me I would be really grateful.
Thanks for your help,

That’s not really a bug but a feature :). Yes, you can save time by going through an intermediate factory. When we did that, we thought it could be funny to see algorithms that do a shortest path even if the graph is complete.

2 Likes

Replay bug:
was watching this replay(as an example) at x0.5 speed. Just start hitting space (or play/pause button) and you see tracks/troops from the next turn appear and disappear. Instead when I hit space I expect from replay only to “stop/run”

In this screenshot I just hit pause in the very beginning of the replay and troops appeared on both factories. If I press space(run) again troops disappear until game timer ticks to 3/71.

If you have a look at this replay https://www.codingame.com/replay/189586255, you will find a production increase on step 36 for the entityId 1, but where are not enough cyborgs in the entity and also there was also no command for the increase.

The factories goes from 0 production (Disabled) to 1 production (last growthrate before the bomd).

Thanks for the answer.

Should be fixed for most puzzles.

Fixed thank you.

Thank you very much!

Is there a reason we don’t see 1st lap in the game informations ?
And why the error output and the response output are not sync ?

When entering the silver league, I got this text as an update to the rules:

Summary of new rules
You can now increase the production rate of your factories.
See the updated statement for details.

However, this was already possibly in the Bronze league. So is it a bug to bring it up as a new rule? Or am I missing something? Upgrades cost 10 cyborgs and max upgrade is a production of 3. I thought that’s what this rule means, but if it’s something else I gladly like to know :slight_smile: