1
0
www.mikescher.com/www/statics/euler/euler_059_explanation.md

12 lines
1.1 KiB
Markdown
Raw Normal View History

2017-11-08 17:39:50 +01:00
This task had a lot of Befunge specific problems, but first let's look at the solving strategy:
- We go through all `26^3` passwords and test look if they generate illegal characters (smaller 32 or bigger 127).
- We also see if one of the first twelve characters is a space, assuming the first word is no longer than twelve characters.
- The leaves us with around one-hundred viable passwords.
- We use the fact that in the English language the letter `e` is pretty common and take the password with the highest count of `e`.
- The rest is just decrypting the text and counting the values.
Now to our Befunge specific problems:
- First we need to input the raw data. Our best call is inserting the data directly into the program and then parsing it in the first step into an array.
- The next problem is the missing xor operator. To perform an xor operation we need to go through all bits and xor them individually (`a xor b == (a+b) % 2`). This is an extremely pricey operation. And to speed this up we generate an complete 128x128 xor look up-table with all possible xor operations.
All in all a not really optimal problem for Befunge but still a fun challenge