changeset 49:527d37859f28

Sort the alloy tables more robustly.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 23 Aug 2021 18:19:40 +0300
parents 857333562777
children 2e4ed4d58660
files parsealloys.pl
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/parsealloys.pl	Mon Aug 23 18:19:17 2021 +0300
+++ b/parsealloys.pl	Mon Aug 23 18:19:40 2021 +0300
@@ -141,7 +141,7 @@
       foreach my $min2 (sort { $a cmp $b } keys %{$final{$min1}})
       {
         print "\"$min2\" => [";
-        foreach my $res (sort { $final{$min1}{$min2}{$a} <=> $final{$min1}{$min2}{$b} } keys %{$final{$min1}{$min2}}) {
+        foreach my $res (sort { $a cmp $b} keys %{$final{$min1}{$min2}}) {
           print "\"$res\" => ".$final{$min1}{$min2}{$res}.", ";
         }
         print "], ";
@@ -160,16 +160,16 @@
   my %restab = ();
   foreach my $res (keys %$Materials::matTable)
   {
-    foreach my $min1 (keys %final)
+    foreach my $min1 (sort { $a cmp $b } keys %final)
     {
-      foreach my $min2 (keys %{$final{$min1}})
+      foreach my $min2 (sort { $a cmp $b } keys %{$final{$min1}})
       {
         my $tmp = $final{$min1}{$min2};
 
         # Do we ignore unstable combinations, e.g. ones with multiple results?
         #if (scalar(keys %$tmp) == 1)
         {
-          foreach my $key (keys %$tmp)
+          foreach my $key (sort { $a cmp $b } keys %$tmp)
           {
             if ($key eq $res && !defined($restab{$res}{$min1}{$min2}) && !defined($restab{$res}{$min2}{$min1}))
             {