OK, and now here's the script that does the thinking. If you look hard enough, it will start to resemble Traveller's "Trade Code" determination rules. In fact, Iceball worlds are nearly the same thing as the "Ic" trade code.
</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">package UwpClassifier;
1;
my @type =
(
['Molten' ,{ 'size' => '.', 'atm' => '[0BC]', 'hyd' => 'A', 'pri' => '.', 'orbit' => 'Close' }],
['Metallic' ,{ 'size' => '.', 'atm' => '1', 'hyd' => '0', 'pri' => '[OBA]', 'orbit' => 'Close' }],
['Metallic' ,{ 'size' => '.', 'atm' => '0', 'hyd' => '0', 'pri' => 'F', 'orbit' => 'Close' }],
['Metallic' ,{ 'size' => '.', 'atm' => '[BC]', 'hyd' => '.', 'pri' => '.', 'orbit' => 'Warm' }],
['Mercurial',{ 'size' => '.', 'atm' => '0', 'hyd' => '0', 'pri' => '.', 'orbit' => 'Outer' }],
['Mercurial',{ 'size' => '.', 'atm' => '1', 'hyd' => '0', 'pri' => '.', 'orbit' => 'Close' }],
['Lunar' ,{ 'size' => '.', 'atm' => '0', 'hyd' => '0', 'pri' => '.', 'orbit' => 'Any' }],
['Iceball' ,{ 'size' => '.', 'atm' => '[0-2]', 'hyd' => '[1-9]','pri' => '[^KM]', 'orbit' => 'Outer' }],
['Iceball' ,{ 'size' => '.', 'atm' => '[0-2]', 'hyd' => '[1-9]','pri' => '[KM]', 'orbit' => 'Any' }],
['Europan' ,{ 'size' => '.', 'atm' => '[01]', 'hyd' => '[1-9]','pri' => '.', 'orbit' => 'Warm' }],
['Thalassic',{ 'size' => '[A-F]', 'atm' => '[A-F]', 'hyd' => 'A', 'pri' => '.', 'orbit' => 'Snowline' }],
['Martian' ,{ 'size' => '[1-4]', 'atm' => '[1234]', 'hyd' => '[012]','pri' => '[FGK]', 'orbit' => 'Snowline' }],
['Venus I' ,{ 'size' => '.', 'atm' => '[A-F]', 'hyd' => '[01]', 'pri' => '[FG]', 'orbit' => 'Snowline' }],
['Venus II' ,{ 'size' => '.', 'atm' => '[A-F]', 'hyd' => '0', 'pri' => '[FG]', 'orbit' => 'Snowline' }],
['Terran Ia',{ 'size' => '.', 'atm' => '.', 'hyd' => '0', 'pri' => '.', 'orbit' => 'Snowline' }],
['Terran Ib',{ 'size' => '.', 'atm' => '[^0]', 'hyd' => '[^0]', 'pri' => '.', 'orbit' => 'Snowline' }],
['Terran II',{ 'size' => '.', 'atm' => '[^012]', 'hyd' => '[^0]', 'pri' => '[FG]', 'orbit' => 'Hab-Zone' }],
['T Prime' ,{ 'size' => '[6-9]', 'atm' => '[4-9]', 'hyd' => '[3-9]','pri' => '[FG]', 'orbit' => 'Hab-Zone' }],
['T Norm' ,{ 'size' => '[789]', 'atm' => '[67]', 'hyd' => '[567]','pri' => '[FG]', 'orbit' => 'Hab-Zone' }],
['T Tundric',{ 'size' => '[6-9]', 'atm' => '[4-9]', 'hyd' => '[3-9]','pri' => '[FG]', 'orbit' => 'Snowline' }],
['T Tundric',{ 'size' => '[6-9]', 'atm' => '[4-9]', 'hyd' => '[3-9]','pri' => '[KM]', 'orbit' => 'Hab-Zone' }],
['Terran IV',{ 'size' => '.', 'atm' => '[0-A]', 'hyd' => '[012]','pri' => '.', 'orbit' => 'Snowline' }],
['Terran IV',{ 'size' => '.', 'atm' => '[0-A]', 'hyd' => '[012]','pri' => '[KM]', 'orbit' => 'Close' }],
['T-form' ,{ 'size' => '.', 'atm' => '[4-9]', 'hyd' => '[0-9]','pri' => '[KM]', 'orbit' => 'Hab-Zone' }],
['T-form' ,{ 'size' => '.', 'atm' => '[4-9]', 'hyd' => '[0-9]','pri' => '[OBA]', 'orbit' => 'Snowline' }],
);
sub classify
{
my $wsize = shift;
my $watm = shift;
my $whyd = shift;
my $wprimary = shift;
my @matches = ();
my $source = $wsize . $watm . $whyd . ' ' . $wprimary;
foreach my $type ( @type )
{
my $match = &matches( $source, $type );
push @matches, $match if $match;
}
push @matches, shift @matches if $watm =~ /[2468]/;
return @matches;
}
sub matches
{
my $source = shift;
my $type = shift;
my $size = $$type[1]->{size};
my $atm = $$type[1]->{atm};
my $hyd = $$type[1]->{hyd};
my $pri = $$type[1]->{pri};
my $orbit = $$type[1]->{orbit};
my $pattern = $size . $atm . $hyd . ' '. $pri;
return [ $$type[0], $orbit ] if $source =~ m/$pattern/;
}</pre>[/QUOTE]