Quick push.
This commit is contained in:
parent
3a7923177d
commit
11683ae175
5 changed files with 3002 additions and 2852 deletions
85
README.org
85
README.org
|
@ -260,7 +260,8 @@ cp ./mod-recipes/recipes-all-sorted-product.csv ./mod-recipes/intermediate.csv
|
||||||
From here on, all changes will take place on the basis of the ~intermediate.csv~ file, and outputs will be directed to ~output.csv~. This will prevent time loss in case of a mistyped command.
|
From here on, all changes will take place on the basis of the ~intermediate.csv~ file, and outputs will be directed to ~output.csv~. This will prevent time loss in case of a mistyped command.
|
||||||
|
|
||||||
*** Define raw ingredients by their category
|
*** Define raw ingredients by their category
|
||||||
We have the following categories we'll be assigning:
|
|
||||||
|
**** We have the following categories we'll be assigning:
|
||||||
- Telescoping, (inserters, belts, things that reach)
|
- Telescoping, (inserters, belts, things that reach)
|
||||||
- Metalworking,
|
- Metalworking,
|
||||||
- Plastic,
|
- Plastic,
|
||||||
|
@ -285,13 +286,87 @@ To do this, we'll start with something like this:
|
||||||
open(my $in, "<", "./mod-recipes/intermediate.csv") or die "Can't open intermediates.csv";
|
open(my $in, "<", "./mod-recipes/intermediate.csv") or die "Can't open intermediates.csv";
|
||||||
open(my $out, ">", "./mod-recipes/output.csv") or die "Can't open output.csv";
|
open(my $out, ">", "./mod-recipes/output.csv") or die "Can't open output.csv";
|
||||||
|
|
||||||
|
my @patterns = (
|
||||||
|
|
||||||
|
# 0 metal
|
||||||
|
|
||||||
|
"m/[\-?,?s*]
|
||||||
|
(bronze|iron|steel|copper|\
|
||||||
|
zinc| tungsten|titanium|tin|\
|
||||||
|
nickel|silver|platinum|manganese|\
|
||||||
|
lead|gold|aluminium|aluminum)\
|
||||||
|
[\-?,?\s*]/",
|
||||||
|
|
||||||
|
# 1 wood
|
||||||
|
|
||||||
|
"m/[\-?,?s*]
|
||||||
|
(bronze|iron|steel|copper|\
|
||||||
|
zinc| tungsten|titanium|tin|\
|
||||||
|
nickel|silver|platinum|manganese|\
|
||||||
|
lead|gold|aluminium|aluminum)\
|
||||||
|
[\-?,?\s*]/",
|
||||||
|
|
||||||
|
# 2 plastic
|
||||||
|
|
||||||
|
"m/[\-?,?s*]
|
||||||
|
(bronze|iron|steel|copper|\
|
||||||
|
zinc| tungsten|titanium|tin|\
|
||||||
|
nickel|silver|platinum|manganese|\
|
||||||
|
lead|gold|aluminium|aluminum)\
|
||||||
|
[\-?,?\s*]/",
|
||||||
|
|
||||||
|
# 3 electronics
|
||||||
|
|
||||||
|
"m/[\-?,?s*]
|
||||||
|
(bronze|iron|steel|copper|\
|
||||||
|
zinc| tungsten|titanium|tin|\
|
||||||
|
nickel|silver|platinum|manganese|\
|
||||||
|
lead|gold|aluminium|aluminum)\
|
||||||
|
[\-?,?\s*]/",
|
||||||
|
|
||||||
|
# 4 glass
|
||||||
|
|
||||||
|
"m/[\-?,?s*]
|
||||||
|
(bronze|iron|steel|copper|\
|
||||||
|
zinc| tungsten|titanium|tin|\
|
||||||
|
nickel|silver|platinum|manganese|\
|
||||||
|
lead|gold|aluminium|aluminum)\
|
||||||
|
[\-?,?\s*]/",
|
||||||
|
|
||||||
|
# 5 stone
|
||||||
|
|
||||||
|
"m/[\-?,?s*]
|
||||||
|
(bronze|iron|steel|copper|\
|
||||||
|
zinc| tungsten|titanium|tin|\
|
||||||
|
nickel|silver|platinum|manganese|\
|
||||||
|
lead|gold|aluminium|aluminum)\
|
||||||
|
[\-?,?\s*]/");
|
||||||
|
|
||||||
|
|
||||||
while (<$in>) {
|
while (<$in>) {
|
||||||
@line = split(",", $_);
|
@line = split(",", $_);
|
||||||
if ($line[1] =~ /(iron|steel|copper|zinc|tungsten|titanium|tin|nickel|silver|platinum|manganese|lead|gold|aluminium)/) {
|
if ($line[1] =~ "$patterns[0]") {
|
||||||
$line[0] = 'metal'
|
print $out "metal @line";
|
||||||
|
}
|
||||||
|
if ($line[1] =~ "$patterns[1]") {
|
||||||
|
print $out "wood @line";
|
||||||
|
}
|
||||||
|
if ($line[1] =~ "$patterns[2]") {
|
||||||
|
print $out "plastic @line";
|
||||||
|
}
|
||||||
|
if ($line[1] =~ "$patterns[3]") {
|
||||||
|
print $out "electronics @line";
|
||||||
|
}
|
||||||
|
if ($line[1] =~ "$patterns[4]") {
|
||||||
|
print $out "glass @line";
|
||||||
|
}
|
||||||
|
if ($line[1] =~ "$patterns[5]") {
|
||||||
|
print $out "stone @line";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print $out "@line";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
my $lineout = join (',', @line);
|
|
||||||
print $out "$lineout";
|
|
||||||
}
|
}
|
||||||
close $in or die "$in: $!";
|
close $in or die "$in: $!";
|
||||||
close $out or die "$out: $!";
|
close $out or die "$out: $!";
|
||||||
|
|
82
fra.pl
82
fra.pl
|
@ -1,13 +1,87 @@
|
||||||
open(my $in, "<", "./mod-recipes/intermediate.csv") or die "Can't open intermediates.csv";
|
open(my $in, "<", "./mod-recipes/intermediate.csv") or die "Can't open intermediates.csv";
|
||||||
open(my $out, ">", "./mod-recipes/output.csv") or die "Can't open output.csv";
|
open(my $out, ">", "./mod-recipes/output.csv") or die "Can't open output.csv";
|
||||||
|
|
||||||
|
my @patterns = (
|
||||||
|
|
||||||
|
# 0 metal
|
||||||
|
|
||||||
|
"m/[\-?,?s*]
|
||||||
|
(bronze|iron|steel|copper|\
|
||||||
|
zinc| tungsten|titanium|tin|\
|
||||||
|
nickel|silver|platinum|manganese|\
|
||||||
|
lead|gold|aluminium|aluminum)\
|
||||||
|
[\-?,?\s*]/",
|
||||||
|
|
||||||
|
# 1 wood
|
||||||
|
|
||||||
|
"m/[\-?,?s*]
|
||||||
|
(bronze|iron|steel|copper|\
|
||||||
|
zinc| tungsten|titanium|tin|\
|
||||||
|
nickel|silver|platinum|manganese|\
|
||||||
|
lead|gold|aluminium|aluminum)\
|
||||||
|
[\-?,?\s*]/",
|
||||||
|
|
||||||
|
# 2 plastic
|
||||||
|
|
||||||
|
"m/[\-?,?s*]
|
||||||
|
(bronze|iron|steel|copper|\
|
||||||
|
zinc| tungsten|titanium|tin|\
|
||||||
|
nickel|silver|platinum|manganese|\
|
||||||
|
lead|gold|aluminium|aluminum)\
|
||||||
|
[\-?,?\s*]/",
|
||||||
|
|
||||||
|
# 3 electronics
|
||||||
|
|
||||||
|
"m/[\-?,?s*]
|
||||||
|
(bronze|iron|steel|copper|\
|
||||||
|
zinc| tungsten|titanium|tin|\
|
||||||
|
nickel|silver|platinum|manganese|\
|
||||||
|
lead|gold|aluminium|aluminum)\
|
||||||
|
[\-?,?\s*]/",
|
||||||
|
|
||||||
|
# 4 glass
|
||||||
|
|
||||||
|
"m/[\-?,?s*]
|
||||||
|
(bronze|iron|steel|copper|\
|
||||||
|
zinc| tungsten|titanium|tin|\
|
||||||
|
nickel|silver|platinum|manganese|\
|
||||||
|
lead|gold|aluminium|aluminum)\
|
||||||
|
[\-?,?\s*]/",
|
||||||
|
|
||||||
|
# 5 stone
|
||||||
|
|
||||||
|
"m/[\-?,?s*]
|
||||||
|
(bronze|iron|steel|copper|\
|
||||||
|
zinc| tungsten|titanium|tin|\
|
||||||
|
nickel|silver|platinum|manganese|\
|
||||||
|
lead|gold|aluminium|aluminum)\
|
||||||
|
[\-?,?\s*]/");
|
||||||
|
|
||||||
|
|
||||||
while (<$in>) {
|
while (<$in>) {
|
||||||
@line = split(",", $_);
|
@line = split(",", $_);
|
||||||
if ($line[1] =~ /(iron|steel|copper|zinc|tungsten|titanium|tin|nickel|silver|platinum|manganese|lead|gold|aluminium)/) {
|
if ($line[1] =~ "$patterns[0]") {
|
||||||
$line[0] = 'metal'
|
print $out "metal @line";
|
||||||
|
}
|
||||||
|
if ($line[1] =~ "$patterns[1]") {
|
||||||
|
print $out "wood @line";
|
||||||
|
}
|
||||||
|
if ($line[1] =~ "$patterns[2]") {
|
||||||
|
print $out "plastic @line";
|
||||||
|
}
|
||||||
|
if ($line[1] =~ "$patterns[3]") {
|
||||||
|
print $out "electronics @line";
|
||||||
|
}
|
||||||
|
if ($line[1] =~ "$patterns[4]") {
|
||||||
|
print $out "glass @line";
|
||||||
|
}
|
||||||
|
if ($line[1] =~ "$patterns[5]") {
|
||||||
|
print $out "stone @line";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print $out "@line";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
my $lineout = join (',', @line);
|
|
||||||
print $out "$lineout";
|
|
||||||
}
|
}
|
||||||
close $in or die "$in: $!";
|
close $in or die "$in: $!";
|
||||||
close $out or die "$out: $!";
|
close $out or die "$out: $!";
|
||||||
|
|
2843
mod-recipes/output-sorted-material.csv
Normal file
2843
mod-recipes/output-sorted-material.csv
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
0
output-sorted-material.csv
Normal file
0
output-sorted-material.csv
Normal file
|
Loading…
Reference in a new issue