[PHP] [Skynet: The Virus] Error fetching more than one gateway node


#1

Hello,

I think I found an issue in the Triple Star test in Skynet: The Virus while coding in PHP: when there is more than one gateway node, the system seems having some issues fetching the gateways nodes and only fetch the last one. I verified this with the error_logs as following :

error_log(var_export($E, true));
error_log(var_export('------', true));

for ($i = 0; $i < $E; $i++);
{
    fscanf(STDIN, "%d",
        $EI // the index of a gateway node
    );
    error_log(var_export($EI, true));
$exits[$i] = $EI;
}

error_log(var_export($exits, true));

Which shows that there are 3 nodes (nodes 0, 18 and 28 using debug mode), but only returns the third node (node 0)

3
'------'
0
array (
  3 => 0,
)

Thanks in advance for your help fixing this issue and sorry for the grammar :slightly_smiling:

Gilgen


#2

By no means a php expert but what if instead you did

$exists[] = $EI;

What is your output then? I suspect you'll have 3 entries in your array. At the moment it looks like in each iteration of the loop you are reinitialising your array.


#3

+
The problem is the semicolon at the end of this line