Skip to content

Commit

Permalink
will now attempt the Halls of Vrbansk recipes sorted by the fewest gl…
Browse files Browse the repository at this point in the history
…yph needing to be found
  • Loading branch information
ggoebel committed Jan 2, 2011
1 parent ab6babb commit 6f1b081
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/glyph_search.pl
Expand Up @@ -29,8 +29,8 @@
unless ( $cfg_file and -e $cfg_file ) {
die "Did not provide a config file";
}
my $glyph_recipes_file = shift(@ARGV) || 'glyph_recipes.yml';
my $plans_wanted_file = shift(@ARGV) || 'plans_wanted.yml';
my $glyph_recipes_file = shift(@ARGV) || 'glyph_recipes.yml';


if( $opt_update_yml ){
Expand Down Expand Up @@ -103,6 +103,10 @@ sub search {
my $item = $wish->[0];
print "Can we look for any ingredients for a $item?\n";
my (@recipes) = @{$recipes{$item}};
if (scalar @recipes > 1) { # if multiple recipies, look for one requiring fewest glyphs
@recipes = sort { grep({exists $glyph{$_}} @$b) <=> grep({exists $glyph{$_}} @$a) }
@recipes;
}
# try to complete any recipe for that wish
INNER: for my $recipe (@recipes) {
my %need;
Expand Down

0 comments on commit 6f1b081

Please sign in to comment.