Send your feedback or ask for help here!
Cool puzzle! For some reason, though, at first, my brain couldn’t wrap around what the word “fold” meant. It wasn’t until after I reread the description a couple times that I connected the dots to folding a physical piece of paper. Seems obvious in retrospect. Must just have been having a brain fart…
You can also say: ‘my brain folded’ (ie. as in card games)
Good puzzle, 5 stars!
I saw how the people solve the problem. Lists, stacks, queues… I did a dumb simulation on 3D arrays - passed.
Nothing dumb about using a 3D array. I essentially did that, myself. It’s all about how you use it that matters.
I made a dumb hardcoded solution.
We have few options for this task, the sizes of the original note are 1, 2, 4, 8, 16.
- I solved the problem in a “normal” way
- I made testcases - notes with unique symbols for each of the five cases (really 4 cases - 2, 4, 8, 16)
- I traced in the process of solving which coordinates are viewed and in what order. More precisely, I looked through the answer and for each character in the answer found its coordinates in the original note. I made all symbols unique for this.
- I hardcoded the list of coordinates from point 3 into an array and made a stupid second solution that does not fold any notes, but simply view the note according to the predefined instructions from point 3.
I made this bad solution just for fun.
But if you make a cryptographic chip, then you probably need to follow this way
I tried using an in-place 2D array that keeps track of which letter ends up in which ply after each fold. For example, when N = 4 in case 3:
8. 15 14 9.
7. 0. 1. 6.
4. 3. 2. 5.
11 12 13 10
It worked for the first few folds, and then I realized that it was not at all obvious how to figure out which ply ends up on top of which. For example, my answer for case #4 (N=8) is missing a flip somewhere:
Found: Oink oink… I want some bacon.The supervisor looks like a hog!
Expected: The supervisor looks like a hog! Oink oink… I want some bacon.
I also can’t physically fold a paper 8 times and check the answer without losing my brain, so I don’t know what I’m missing. I guess I’ll have to scrap this idea and manually fold 3D matrices…
Incidentally, if you tile the above 4x4 matrix, you’ll see that that the path that you trace going from 0 to 15 is continuous and makes pretty patterns. I have no idea how this pattern is defined, but I guess it must be a fractal of some sort.
Turns out that the continuous path for 4x4 doesn’t exist for higher dimensions. The same path is followed in a recursive manner: when moving from the 0th ply to the 1st ply, which looks like moving right one cell in the above matrix, you’re actually stepping right one cell and jumping right one 4x4 mega-cell at the same time. Kind of like ultimate tic-tac-toe.
Anyway, since my solution gave close to the right answer, I printed the ply matrix and manually shifted blocks of cells around in excel a few times to get the right answer. Then I reverse engineered the solution. I first did this for N=8, but the resulting solution failed for N=16 in the same manner as above. I made an assumption in the pattern that ended up false. After repeating this task for N=16, I believe I now have an extrapolatable rule for higher N, and apparently the first two flips are an exception to the rule that initially threw me off.
Is there any visual representation I can see on the internet of this matter ? English is not my first language and I’m struggling to understand how it is possible to read letters on a folded paper
Hi, I’m also stuck on test cases #4 and #5; also for me test case #4 ends with
Oink oink... I want some bacon.The supervisor looks like a hog!
Probably I’m missing something in understanding how folding works, here are my intermediate folds, can somebody tell me what’s wrong? Thank you.
I’m using a 2D array of strings, chars in the string must interpreted as stacked, first char at the top, last char at bottom.
Puzzle input krloo vi nmw Iaok ie. On o eeT!ghp s hoeua kacniob . t. ns. soskril Unfolded note k|r|l|o|o| |v|i n|m|w| |I|a|o|k i|e|.| |O|n| |o e|e|T|!|g|h|p| |s| |h|o|e|u|a k|a|c|n|i|o|b| .| |t|.| |n|s|. |s|o|s|k|r|i|l After Folding ToLeft ik|vr| l|oo kn|om|aw|I oi| e|n.|O e|pe|hT|g! a |us|e |oh k|ba|oc|in ..|s |nt| . l |is|ro|ks After Folding ToTop lik|sivr|or l|skoo ..kn| som|tnaw|. I k oi|ab e|con.|niO a e|supe| ehT|hog! After Folding ToRight kil skoo|rvisor l nk... I |mos tnaw io kniO |e bacon. e a hog!|epus ehT After Folding ToBottom ooks like a hog!|l rosivrepus ehT I ...knio kniO |want some bacon. After Folding ToLeft The supervisor looks like a hog! .nocab emos tnaw I ...knio kniO After Folding ToTop Oink oink... I want some bacon.The supervisor looks like a hog! Result Oink oink... I want some bacon.The supervisor looks like a hog! Expected: The supervisor looks like a hog! Oink oink... I want some bacon.
This seems off to me. Think about what should be in the top left corner when you fold the note from left to right.
Absolutely right, thank you.