';
foreach ($positions as $i)
{
$buffer = $replace;
$buffer[$i] = "\r";
$new = str_replace("+\n","\n",$buffer);//keep right size
$data = bzdecompress($new);
if ( $data != -4 && $data != "")
{
file_put_contents("solution.png", $data);
exit('Fixed');
}
}
echo 'Checking 2 at a time
';
foreach ($positions as $i)
foreach ($positions as $j)
{
if ( $i >= $j ) continue;//don't check same combo twice
echo $i . ' '. $j . '
';
$buffer = $replace;
$buffer[$i] = "\r";
$buffer[$j] = "\r";
$new = str_replace("+\n","\n",$buffer);
$data = bzdecompress($new);
if ( $data != -4 && $data != "")
{
file_put_contents("solution.png", $data);
exit('Fixed');
}
}
echo 'Checking 3 at a time
';
foreach ($positions as $i)
foreach ($positions as $j)
foreach ($positions as $k)
{
if ( $i >= $j || $j >= $k ) continue;
$buffer = $replace;
$buffer[$i] = "\r";
$buffer[$j] = "\r";
$buffer[$k] = "\r";
$new = str_replace("+\n","\n",$buffer);
$data = bzdecompress($new);
if ( $data != -4 && $data != "")
{
file_put_contents("solution.png", $data);
exit('Fixed');
}
}