Death First Search - Episode 2 - Puzzle discussion

Am I missing something on test4 “Ordered gateways”? The virus starts off one move away from a node connected to two gateways. I can only shut off one gateway in a turn so I the virus can never be prevented from getting to one of the two gateways.

Never mind on the Test4 Ordered gateway question. My bad.

Test 06 failed only Submit session.
I am trying to complete the “Skynet 2” puzzle, i wrote my solution and all my tests are success.
But when i try to submit and validate the solution, something goes wrong with the last case 06.

I have problem with this validator too. Passed all test cases, but failed this one “Ordered gateways” which should be a simple one. Is there a chance I can see the validator input? Or anyone can share insight on this?

You should be able to watch the replay of the failed validator from the results tab (see screenshots on post above).

yeah, I watched it a lot times and check my game clause several times and debug all the variables in test cases. Nothing went wrong. If it’s the last hardest one, I probably have some bug in my code. But this is an easy case. I just can’t figure it out.

update: Solved it with help from the moderator.

Found ideal solution using Dijkstra. Just have to implement it…

  1. Mark $agentPosition as $actualNode with distance 0
  2. repeat until all nodes are visited
  3. a) set distance of adjacent nodes to $actualNode distance + 1 -1 for each terminal point the node is connected to (secret formula from my whiteboard)
  4. b) $actualNode = non-evaluated node with lowest distance
  5. c) if (actualNode distance< -1) cut any connection from this node to terminal node and return
  6. cut any connection to terminal node and return

Update - with very slight modifications works like charm :slight_smile: First hard puzzle solved under 1hr

1 Like

@LikeUnkai @Action_Dan I know how frustrating it can be to fail a validator while passing all the tests. I’ll send you a PM to help you debug the validator

2 Likes

Is there any difference between the graphs in test case 6 and validator 6? The agent makes different choices, but the networks look the same.

if I remember well, the ids of nodes are just reversed symmetrically.

Ah, I didn’t notice that. That tracks.

Hi all!
All tests is clear but not evaluations (66%)

I don’t understand why test 06 is ok but not the validator 06.
They are the same (except for the node id)

test 06: https://www.codingame.com/share-replay/546286933
validator 06: https://www.codingame.com/replay/546285459

:cry:

you can see the structure is the same but the ids are not, so either you have an issue handling the links and ids of nodes or your program is not deterministic

Hello!
really I don’t find the bug :’( is it possible to have the init parameters in PM?

Here’s the input of this test (the nodes in order, the links, and then the gateways)

49
816 275
702 652
271 13
952 652
270 247
816 535
1097 139
1095 881
584 138
700 388
171 193
271 652
951 138
455 248
590 534
409 652
701 534
951 534
1096 13
271 138
455 388
589 388
816 388
144 881
144 777
952 388
-10 193
455 13
455 138
-10 388
144 533
816 138
75 193
409 533
144 652
816 13
455 776
591 652
144 388
816 652
269 388
74 13
951 881
-10 652
952 275
270 775
455 881
-10 533
269 533
62
2 41
2 19
19 28
28 8
8 31
28 27
13 28
0 31
31 35
26 41
29 26
47 29
32 26
38 29
30 47
43 47
43 34
43 30
30 34
24 34
41 10
10 29
10 32
11 34
48 11
48 38
42 46
46 23
46 36
36 45
45 11
11 15
15 33
37 14
1 16
3 39
39 5
39 1
1 37
37 15
39 17
0 22
17 22
4 19
17 25
25 44
44 12
33 40
14 21
5 22
4 40
9 21
9 22
13 4
31 12
6 7
18 6
12 6
44 6
40 20
21 20
20 13
41
17
0
3
5
7
13
14
16
18
23
24
27
30
32
33
35
38
42

Minor spelling error in error message:
“Failure: Link [0-3] is protected. Your virus has been destroyed while trying to severe it!”

The next-to-last word should be “sever”.

1 Like

I second @bjarke, I have a feeling that this problem is NP-hard. (I don’t even think that it is even in NP (or co_NP), that there exist a polynomial sized witness if the player (or the Skynet) has a winning strategy).

Some people claimed O(n) log n and O(n^3) solutions. Can I have one?

I thought about the same solution but mine is too slow to provide an answer, and Djikstra shouldn’t work with negative weights.

Hey! Thanks so much for this, it’s is the most helpful comment. I was stuck because I didn’t use KIND1 wisely as you said. Hopefully now I can adapt my code to make this work better than 66% :smiley:

Is there a working polynomial solution yet to this problem?