<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://atitd.wiki/tale10/w/index.php?action=history&amp;feed=atom&amp;title=User%3ABeren%2FScripts%2FGlassware</id>
	<title>User:Beren/Scripts/Glassware - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://atitd.wiki/tale10/w/index.php?action=history&amp;feed=atom&amp;title=User%3ABeren%2FScripts%2FGlassware"/>
	<link rel="alternate" type="text/html" href="https://atitd.wiki/tale10/w/index.php?title=User:Beren/Scripts/Glassware&amp;action=history"/>
	<updated>2026-04-12T10:07:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.6</generator>
	<entry>
		<id>https://atitd.wiki/tale10/w/index.php?title=User:Beren/Scripts/Glassware&amp;diff=163419&amp;oldid=prev</id>
		<title>Beren: Created page with &quot;&lt;pre&gt;#!/usr/bin/perl  use strict; use warnings;  # Constants for the individual glassware names my $beaker = 'Beaker'; my $distillation_coil = 'Distillation Coil'; my $florenc...&quot;</title>
		<link rel="alternate" type="text/html" href="https://atitd.wiki/tale10/w/index.php?title=User:Beren/Scripts/Glassware&amp;diff=163419&amp;oldid=prev"/>
		<updated>2021-05-12T19:41:18Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt;#!/usr/bin/perl  use strict; use warnings;  # Constants for the individual glassware names my $beaker = &amp;#039;Beaker&amp;#039;; my $distillation_coil = &amp;#039;Distillation Coil&amp;#039;; my $florenc...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;#!/usr/bin/perl&lt;br /&gt;
&lt;br /&gt;
use strict;&lt;br /&gt;
use warnings;&lt;br /&gt;
&lt;br /&gt;
# Constants for the individual glassware names&lt;br /&gt;
my $beaker = 'Beaker';&lt;br /&gt;
my $distillation_coil = 'Distillation Coil';&lt;br /&gt;
my $florence_flask = 'Florence Flask';&lt;br /&gt;
my $test_tube = 'Test Tube';&lt;br /&gt;
my $thistle_tube = 'Thistle Tube';&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Data structure to hold all input glassware&lt;br /&gt;
my %candidates = (&lt;br /&gt;
	$beaker =&amp;gt; [],&lt;br /&gt;
	$distillation_coil =&amp;gt; [],&lt;br /&gt;
	$test_tube =&amp;gt; [],&lt;br /&gt;
	$thistle_tube =&amp;gt; [],&lt;br /&gt;
	$florence_flask =&amp;gt; []&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
# Found combinations which should result in successful calibration&lt;br /&gt;
my %matches = ();&lt;br /&gt;
&lt;br /&gt;
# Parse candidate glassware out of input&lt;br /&gt;
while (&amp;lt;&amp;gt;) {&lt;br /&gt;
	if (/($distillation_coil|$beaker|$test_tube|$thistle_tube|$florence_flask):Quality (\d+)/) {&lt;br /&gt;
		# Found glassware, register as a candidate&lt;br /&gt;
		push @{$candidates{$1}}, $2; &lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Work through all combinations of each type&lt;br /&gt;
foreach my $ff (@{$candidates{$florence_flask}}) {&lt;br /&gt;
	foreach my $tt (@{$candidates{$test_tube}}) {&lt;br /&gt;
		foreach my $tht (@{$candidates{$thistle_tube}}) {&lt;br /&gt;
			foreach my $b (@{$candidates{$beaker}}) {&lt;br /&gt;
				foreach my $dc (@{$candidates{$distillation_coil}}) {&lt;br /&gt;
					my $sum = $ff + $tt + $tht + $b + $dc;&lt;br /&gt;
&lt;br /&gt;
					# Skip low quality combinations&lt;br /&gt;
					next if $sum &amp;lt; 35000;&lt;br /&gt;
&lt;br /&gt;
					# Check for calibration level&lt;br /&gt;
					my $calibration_level = 0;&lt;br /&gt;
&lt;br /&gt;
					if (($sum &amp;gt;= 40000 &amp;amp;&amp;amp; $sum &amp;lt;= 40004) || ($sum &amp;gt;= 45000 &amp;amp;&amp;amp; $sum &amp;lt;= 45004)) {&lt;br /&gt;
						# Match for level 3 calibration&lt;br /&gt;
						$calibration_level = 3;&lt;br /&gt;
					}&lt;br /&gt;
					if ($sum &amp;gt;= 35000 &amp;amp;&amp;amp; $sum &amp;lt;= 35004) {&lt;br /&gt;
						# Match for level 2 calibration&lt;br /&gt;
						$calibration_level = 2;&lt;br /&gt;
					}&lt;br /&gt;
					if ($sum % 100 == 0) {&lt;br /&gt;
						# Match for level 1 calibration&lt;br /&gt;
						$calibration_level = 1;&lt;br /&gt;
					}&lt;br /&gt;
&lt;br /&gt;
					# Store results&lt;br /&gt;
					if ($calibration_level &amp;gt; 0) {&lt;br /&gt;
						my $set = {$beaker =&amp;gt; $b, $distillation_coil =&amp;gt; $dc, $florence_flask =&amp;gt; $ff, $test_tube =&amp;gt; $tt, $thistle_tube =&amp;gt; $tht, 'Sum' =&amp;gt; $sum};&lt;br /&gt;
						$matches{$calibration_level} //= [];&lt;br /&gt;
						push @{$matches{$calibration_level}}, $set;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Output any successful combinations&lt;br /&gt;
for my $calibration_level (sort keys %matches) {&lt;br /&gt;
	print &amp;quot;\nCalibration Level $calibration_level:\n&amp;quot;;&lt;br /&gt;
	foreach my $set (@{$matches{$calibration_level}}) {&lt;br /&gt;
		print &amp;quot;Sum: ${$set}{'Sum'} Beaker: ${$set}{$beaker} Distillation Coil: ${$set}{$distillation_coil} Florence Flask: ${$set}{$florence_flask} Test Tube: ${$set}{$test_tube} Thistle Tube: ${$set}{$thistle_tube}\n&amp;quot;;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Beren</name></author>
	</entry>
</feed>