In an earlier post,
I have developed a package dedicated to handling all of my traversing, available on github. All of the core patterns are shown on the official traverse-grid page.
I am going to skip a lot of these methods and focus on the methods that work best for optimizing a Shape Up component.
Alternate is a simple mutation that horizontally flips every other row. Applied to a horizontal pattern, it creates a pattern that moves back and forth.
00010203040506131211100908071415161718192027262524232221282930313233344140393837363542434445464748
It is the best method for traversing our pacman (actually a three way tie):
The reposition method only iterates even indices in the first iteration, and then odd indices in the second.
00250126022703280429053006310732083309341035113612371338143915401641174218431944204521462247234824
It works really well if your data looks like our waffle:
The bounce method bounces back and forth between two indices, both from the beginning incrementing forward and from the end decrementing backward, meeting in the center. It works well on data that has some symmetry. It is the best method for traversing our dollar sign:
00020406081012141618202224262830323436384042444648474543413937353331292725232119171513110907050301
00020406081012130103050709111514171921232526162818202224302732293436383931413343353745404642474448
Smooth looks at all adjacent spaces and tries moves toward the next closest index. It can also be straightened.
00020406081012010305070911131416182022242615171921232527283032343638402931333537394142434445464748
It is the best method for traversing our bee:
00142842352107011529433622080216304437230903173145382410041832463925110519334740261206203448412713
The waterfall is the best method for traversing our chair:
The diagonal method does not win out very often, but when it does it can be very effective.
21283439434648152229354044471016233036414506111724313742030712182532380104081319263300020509142027
It works very well when traversing our knife:
The spiral method is fairly effective as most data is off around the border and on in the center.
00010203040506232425262728072239404142290821384748433009203746454431101936353433321118171615141312
It is the best method for traversing our yin yang:
The diamond method is harder to implement than the others. It helps to visualize the entire diamond first:
06 05 29 07 04 28 48 30 08 03 27 47 63 49 31 09 02 26 46 62 74 64 50 32 10 01 25 45 61 73 81 75 65 51 33 11 00 24 44 60 72 80 84 82 76 66 52 34 12 23 43 59 71 79 83 77 67 53 35 13 22 42 58 70 78 68 54 36 14 21 41 57 69 55 37 15 20 40 56 38 16 19 39 17 18
In actuality, we trim off the triangles and we get this:
03 27 47 63 49 31 09 26 46 62 74 64 50 32 45 61 73 81 75 65 51 60 72 80 84 82 76 66 59 71 79 83 77 67 53 42 58 70 78 68 54 36 21 41 57 69 55 37 15
And we have to reduce our values to account for all of those gaps:
00051427150601041326382816071225374539291724364448464030233543474131181122344232190803102133200902
It works really well if you want to make a diamond:
The entire url for this diamond is /shapeup/]99EF because it is just 1 on value and 1 off value. The raw data is simply 9,9,40,41.
It is also the best way to traverse our moon:
The snake method is a 2x2 alternated vertical variation of the Tile method. It works like the horizontal method but instead of always moving to the right, it wiggles down and up throughout the process covering two rows at a time. It is the best method for traversing our dolphin.
00030407081112010205060910131417182122252615161920232427283132353639402930333437384142434445464748
00071421283542080122153629430209162330374410032417383145041118253239461205261940334706132027344148
Stitch zig zags in pairs along two cell columns until it fills a space. It is the best method for traversing our note (at a two-way tie):
00020406050301070911131210081416182019171521232527262422283032343331293537394140383642444648474543
00040812100602010509131107031418222624201615192327252117283236403834302933374139353142444648474543
The triangle method is pretty similar to the diamond method:
09 08 27 10 07 26 43 28 11 06 25 42 57 44 29 12 05 24 41 56 69 58 45 30 13 04 23 40 55 68 79 70 59 46 31 14 03 22 39 54 67 78 87 80 71 60 47 32 15 02 21 38 53 66 77 86 93 88 81 72 61 48 33 16 01 20 37 52 65 76 85 92 97 94 89 82 73 62 49 34 17 00 19 36 51 64 75 84 91 96 99 98 95 90 83 74 63 50 35 18
Trimmed:
06 25 42 57 44 29 12 24 41 56 69 58 45 30 40 55 68 79 70 59 46 54 67 78 87 80 71 60 66 77 86 93 88 81 72 76 85 92 97 94 89 82 84 91 96 99 98 95 90
And reduced:
00030815090401020714221610050613212923171112202836302418192735423731252634414643383233404548474439
It works better than anything else if your shape is this exact type of triangle
The entire url for this triangle is /shapeup/--+9h$0{0i because it is just 1 on value and 1 off value. The raw data is simply 9,17,72,81.
However none of the shapes in my library are smallest using this exact triangle. It's a good thing we can flip the pattern and try the same thing upside down.
33404548474439263441464338321927354237312512202836302418061321292317110207142216100500030815090401
The upside down triangle method is the best method for traversing our checkmark (at a two-way tie).