Do not post unencrypted solutions.
General:
This thread is for general discussion, hints, tips, or anything related to solving Project Euler problems using AHK. Solutions posted here should be encrypted using the correct answer as the password.
Topics of Discussion:
- Problems you have recently solved.
- Problems you are stuck on.
- Ask for a hint.
- The Project Euler website.
- AHK's ranking.
- Share your Project Euler username or your Friend Code.
- Share links to solutions you have posted on the Project Euler forum.
Note: "Only the first one hundred posts are automatically made permanent. After this only the most recent one hundred posts are kept; older posts will be automatically deleted." - Anything related to Project Euler as long as it does not spoil anything for other users.
Use spoiler tags for hints and encrypt full solutions.
Hints should always be posted in spoiler tags. Try not to give too much away. Examples of hints are links to AHK commands, Wikipedia articles, or descriptions of general ideas. Include a title so the subject is evident before clicking the spoiler button.
Hint for problem #1:
Spoiler
Why Encrypt Solutions?:
Encrypting / Decrypting Solutions:[url=http://projecteuler.net/about]About Project Euler[/url] <- You must be logged in to see this page. wrote:Q: I learned so much solving problem XXX so is it okay to publish my solution elsewhere?
A: It appears that you have answered your own question. There is nothing quite like that "Aha!" moment when you finally beat a problem which you have been working on for some time. It is often through the best of intentions in wishing to share our insights so that others can enjoy that moment too. Sadly, however, that will not be the case for your readers. Real learning is an active process and seeing how it is done is a long way from experiencing that epiphany of discovery. Please do not deny others what you have so richly valued yourself.
A how-to for encrypting and decrypting solutions posted in this thread. This method will use nnnik's encryption functions from here: http://ahkscript.org/boards/viewtopic.p ... =493#p4175
Encryption:
- Create a new AHK scrip. Copy and paste this code into it, or click the Download button:
Code: Select all
;Encrypt text from the clipboard InputBox, Pass, Password Required, Enter a Password,, 300, 140 Loop, % (StrLen(Clipboard) // 50) + 1 { String .= A_Index = 1 ? "" : "`t`t. " String .= """" StrEncrypt(SubStr(Clipboard, ((A_Index - 1) * 50) + 1, 50), Pass, 5) "``n""`r`n" } MsgBox, % Clipboard := String return ;nnnik's functions or #Include go here.
- Copy nnnk's encryption functions, available here. Paste them into the new script or #Include them. The encryption functions should go at the end of the script.
- Copy the text that will be encrypted onto the clipboard.
- Run the script that was just created (above).
- Enter a password when prompted. This will be the same password used for decryption later.
- Click OK. The encrypted text should be shown in a message box and placed on the clipboard.
- Create a new AHK script. Copy and paste this code into it, or just click the Download button:
Code: Select all
String := "B88CA3190215DAF7D17C16CB2CF5FEEF3DEF19949447B629F3ED501BBFED941A0713E77F5A10B70561CA554C42D48826C25C192301F4`n" . "0E2DFF29B62A12F6CCF4A337382AEA272C7F6F0EFB4B4B82535B091E1008EC0DC6522DAC24746A5CA244DC09DAE534CD9FA78ADB01F4`n" InputBox, Pass, Password Required, Enter the answer to problem XX.,, 300, 140 Loop, Parse, String, `n, `n result .= StrDecrypt(A_LoopField, pass) MsgBox, % Clipboard := result return ;nnnik's functions or #Include go here.
- Replace the encrypted text "B88CA3190215DAF7D17C16CB2CF5FEEF3DEF199... with the text you have encrypted (see previous steps).
- Change the text in the input box InputBox, Pass, Password Required, Enter the answer to problem XX.,, 300, 140
- Post your code. You don't need to post nnnik's functions when you post your code. Just mention that those were the functions you used, and where to get them. People can copy and paste or #Include the functions themselves, no need to repost them in every script.
(Assuming they were encrypted with nnnik's functions and a method similar to the one described above.)
- Create a new script. Copy and paste the code you wish to decrypt into it. Or just click the Download button.
- Copy and paste nnnik's functions into the new script and place them at the end, or #Include.
- Run the script and enter the password when prompted. The unencrypted text should then be shown in a message box and placed on the clipboard.