diff options
-rw-r--r-- | problem59.ijs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/problem59.ijs b/problem59.ijs new file mode 100644 index 0000000..bbc5839 --- /dev/null +++ b/problem59.ijs @@ -0,0 +1,12 @@ +data =: ". fread 'p059_cipher.txt' +keysize =: 3 +blocks =: |:((keysize%~#data),keysize) $ data +xor =: 22 b. NB. what??? +chars =: 97+i.26 NB. Lowercase ASCII characters +solveBlock =: {{ + options =. |:chars xor"1 0 y + key =. chars{~{:/:score"1 options + key xor y +}} +score =: {{ y e. 32 46,chars }} +problem59 =: +/,solveBlock"1 blocks |