Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @P4V3L14K0V,validated by @irmo322,@fungi_star and @adila.
If you have any issues, feel free to ping them.
Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @P4V3L14K0V,validated by @irmo322,@fungi_star and @adila.
If you have any issues, feel free to ping them.
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 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.
Post-success edit:
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.
Hi guys,
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
Thank you
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.