# Re: Grid Folding (#63)

**URL:** <https://www.ruby-forum.com/t/re-grid-folding-63/64303>\
**Category:** Ruby\
**Created:** [January 23, 2006, 2:45am UTC](https://www.ruby-forum.com/t/re-grid-folding-63/64303 "2006-01-23T02:45:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bill\_Dolinar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f0a364/32.png) [@Bill\_Dolinar](https://www.ruby-forum.com/u/Bill_Dolinar)\
**Post date:** [January 23, 2006, 2:45am UTC](https://www.ruby-forum.com/t/re-grid-folding-63/64303/1 "2006-01-23T02:45:18Z")

</div>

Here’s my solution. Looks like it didn’t get from google to the  
mailing list. I used arrays within arrays as well. I wrote my own  
loops to do the folding. I see now I could have done it much more  
succinctly. I went for all the extra credit. Can unfold by noticing  
the last element of the array hasn’t been folded over and the first  
element was previously unfolded. The direction from the first to the  
last element gives the fold direction. Then just keep cutting off  
the first half of the array successively gives the array to get the  
next unfold direction from. Should be quite fast and check\_fold.

ï¿¼
