35 lines
809 B
Perl
Executable file
35 lines
809 B
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use Text::LevenshteinXS qw(distance);
|
|
use List::Util qw(reduce);
|
|
use Data::Dumper;
|
|
|
|
my @peeps = qw/ShadowVen myers121 Slay_WOLF Lee1138 killfce Bambalam nick1208 Talock NotoriousKid TomchrisMartin soliddave dirkson websturd/;
|
|
|
|
sub optipeep {
|
|
my ($peep, $input) = @_;
|
|
|
|
my $l = length($input);
|
|
|
|
print "CHECKING $input $peep\n";
|
|
|
|
my $min = [length($peep)*10, $peep]; # set maxes
|
|
for my $p (0..length($peep)-length($input)) {
|
|
my $subpeep = substr($peep, $p, $l);
|
|
my $d = distance($input, substr($peep, $p, $l));
|
|
print "LOOKING $p $subpeep $d\n";
|
|
if ($d <= $min->[0]) {
|
|
$min = [$d, $peep]
|
|
}
|
|
}
|
|
|
|
return $min
|
|
}
|
|
|
|
my $user = "lee";
|
|
|
|
my $peep = reduce {$a->[0] > $b->[0] ? $b : $a} map {optipeep($_, $user)} @peeps;
|
|
print Dumper $peep;
|