Friday 25 January 2013

Paper folding.

What to do on a friday night? Fold paper to develop an equation for it. So I got home and took a giant strip. First I wanted to record the foldings.
1 Fold: 1 down
2 Folds: 2 down, 1 up
3 Folds: 2 down, 1 up, 2 down, 2 up
4 Folds: 2 down, 1 up, 2 down, 2 up, 3 down, 2 up, 1 down, 2 up
I'll stop at 4, it should not be more than that anyway.
So now for a plan.
Plan A:
Organize the data in a 'cone'.
Plan B:
Organize the data in a 'cone' and break out everything in 1s
I'll start with Plan B. It seems more detailed.
                                                                     D
                                                                 D D U
                                                          D D U D D U U
                                           D D U D D U U D D D U U D U U
So it seems like the D in the middle breaks the cone into two sides, where the left side is the previous line. Which makes sense because that middle D will always be the middle from the folding. But, now I am stuck at the second side. Well alright, maybe it'll come to me after I try to relate this to recursion.
Recursion is the reuse of a function. So our final step is the first fold, that creates a D in the middle. The middle position is all folds divided by 2 and rounded up. If x were to be the number of folds, then D's position would be (2x-1)/2 (The positions as in 1,2,3,4,5, without the zeros). OOOOOH the right side is the mirror image of the left side with U's and D's flipped. That creates a pattern, but a pretty 'have no idea how to put this in Python' pattern. So a line takes the previous line and puts it before the D. It takes the same line, flips the Us and Ds and builds it to the right side but backwards. Well, I tried to put this in Python, but recursion is far forgotten. But the pattern was found :D.
Moral of the story: Time to get coloured pencils and pens. It can really highlight important parts.

2 comments:

  1. Good job! Take a look at a fellow student's blog for their approach, and how they put it in Python, it's a fairly different approach, you might find it interesting! http://peph8.blogspot.ca/2013/01/paper-folding-creases.html

    ReplyDelete
  2. Oooh tree diagrams. I fully forgot about those and they implemented it, with recursion and classes!
    Thank you for sharing, it was very interesting and useful to see how they did it.

    ReplyDelete