digitalmars.D.learn - Folding algorithm help.
- rookie (21/21) Mar 18 2013 Hi,
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (8/21) Mar 18 2013 I have absolulety no idea what this is about but I am brave enough to
- Zz (18/46) Mar 18 2013 Ali,
- bearophile (7/9) Mar 18 2013 The Ruby code by Luke Blanshard converted to D:
Hi, I was trying to do a folding algorithm in D and just got stuck on how to approach the problem - I must be missing something (math). Given the following: 2 1 - Both folds are from Left to Right - 1 is the fist fold V V 1 | 2 | 3 --------- - 3 Bottom to Up 4 | 5 | 6 result 6 | 5 | 4 ----------- 1 | 2 | 3 If folds cover one another so that there is no crossover like in the first fold above then a multidimensional stack could be used. There were some interesting solutions for squares like: https://groups.google.com/forum/#!msg/comp.lang.ruby/lf4Zd9fvuYY/tjT2q65mcFAJ But nothing like the above. It isn't homework. Cheers, Rookie
Mar 18 2013
On 03/18/2013 02:20 PM, rookie wrote:Hi, I was trying to do a folding algorithm in D and just got stuck on how to approach the problem - I must be missing something (math). Given the following: 2 1 - Both folds are from Left to Right - 1 is the fist fold V V 1 | 2 | 3 --------- - 3 Bottom to Up 4 | 5 | 6 result 6 | 5 | 4 ----------- 1 | 2 | 3I have absolulety no idea what this is about but I am brave enough to offer a correction. :) According to my nil understanding the result should be the following: 6 | 4 | 5 ----------- 3 | 1 | 2 Ali
Mar 18 2013
On Monday, 18 March 2013 at 22:31:20 UTC, Ali Çehreli wrote:On 03/18/2013 02:20 PM, rookie wrote:Ali, It about trying to get help with a problem that froze my brain. Your diagram is: Right X 1 Up, Left X 1 Up, Bottom Y 1 Up - Which is different from what I presented. Look at the above fold as: Left X 2 UP, Left X 1 Up, Bottom Y 1 Up - Where the numbers are physical location in an open sheet. Try folding the paper according to the diagram above the first fold is 2nd from the left - 1 can't be in the middle for the above sequence, generally it's folding and counting from the top to bottom. If all fold's from the left are within the sheet I don't have a problem but once something goes beyond the sheet like in the fist fold i'm stunned. Cheers, RookieHi, I was trying to do a folding algorithm in D and just gotstuck on how toapproach the problem - I must be missing something (math). Given the following: 2 1 - Both folds are from Left to Right - 1 is the fistfoldV V 1 | 2 | 3 --------- - 3 Bottom to Up 4 | 5 | 6 result 6 | 5 | 4 ----------- 1 | 2 | 3I have absolulety no idea what this is about but I am brave enough to offer a correction. :) According to my nil understanding the result should be the following: 6 | 4 | 5 ----------- 3 | 1 | 2 Ali
Mar 18 2013
rookie:There were some interesting solutions for squares like: https://groups.google.com/forum/#!msg/comp.lang.ruby/lf4Zd9fvuYY/tjT2q65mcFAJThe Ruby code by Luke Blanshard converted to D: http://codepad.org/gtWDdRoJ Ruby is very flexible, and its multi-precision integers help avoid some bugs, but I often prefer the coding precision D offers. Bye, bearophile
Mar 18 2013
On Tuesday, 19 March 2013 at 00:36:20 UTC, bearophile wrote:rookie:Hi bearophile, Thanks for the sample. Someone gave me a direction to try out (once I've read the material) and I'll be writing it later. RookieThere were some interesting solutions for squares like: https://groups.google.com/forum/#!msg/comp.lang.ruby/lf4Zd9fvuYY/tjT2q65mcFAJThe Ruby code by Luke Blanshard converted to D: http://codepad.org/gtWDdRoJ Ruby is very flexible, and its multi-precision integers help avoid some bugs, but I often prefer the coding precision D offers. Bye, bearophile
Mar 19 2013
On Tuesday, 19 March 2013 at 00:36:20 UTC, bearophile wrote:rookie:Hi bearophile, Thanks for the sample. Someone gave me a direction to try out (once I've read the material) and I'll be writing it later. RookieThere were some interesting solutions for squares like: https://groups.google.com/forum/#!msg/comp.lang.ruby/lf4Zd9fvuYY/tjT2q65mcFAJThe Ruby code by Luke Blanshard converted to D: http://codepad.org/gtWDdRoJ Ruby is very flexible, and its multi-precision integers help avoid some bugs, but I often prefer the coding precision D offers. Bye, bearophile
Mar 19 2013