Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make location of cipher.txt input file independent of run location
  • Loading branch information
Paul Cochrane committed Apr 28, 2015
1 parent e6a5495 commit 85003a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions categories/euler/prob059-andreoss.pl
Expand Up @@ -55,7 +55,6 @@ sub infix:<XOR>(@cipher, @password) {
@s.map(*.chr).join
}


sub guess-password(Str $w, @cipher) {
my @word = as-code $w;

Expand All @@ -80,7 +79,10 @@ sub infix:<XOR>(@cipher, @password) {
%tries;
}

sub MAIN(Bool :$verbose = False, :$file = 'cipher.txt', :$word = @common-words[0], :$pass is copy) {
sub MAIN(Bool :$verbose = False,
:$file = $*PROGRAM_NAME.IO.dirname ~ '/cipher.txt',
:$word = @common-words[0],
:$pass is copy) {
die "'$file' is missing" unless $file.IO.e ;
my @cipher = map *.Int, split /<[,]>/ , slurp $file;

Expand Down

0 comments on commit 85003a9

Please sign in to comment.