Commits

Shlomi Fish  committed 5f87311

A small refactoring/optimisation.

  • Participants
  • Parent commits 39e1494

Comments (0)

Files changed (1)

File project-euler/126/euler-126-take4.pl

 my $LIMIT = 50_000;
 
 my $z = 1;
-my $z_count = 1;
 
-while ($z_count)
+Z_LOOP:
+while (1)
 {
-    $z_count = 0;
     print "Checking z=$z\n";
     Y_LOOP:
     for my $y (1 .. $z)
             {
                 if ($x == 1)
                 {
-                    last Y_LOOP;
+                    if ($y == 1)
+                    {
+                        last Z_LOOP;
+                    }
+                    else
+                    {
+
+                        last Y_LOOP;
+                    }
                 }
                 else
                 {
             }
             while ($new_layer_count < $LIMIT)
             {
-                $z_count++;
                 $C[$new_layer_count]++;
                 $new_layer_count += ($delta += 4);
             }