I've been using Sandifyto generate patterns to run on the table. There's just one problem- my table is rectangular. If I'm going to use the whole area of the table for the patterns, I have to generate patterns that are much larger than the table area. The problem with that is that it creates a lot of excess motion along the edges of the table which is boring to watch.
I needed a way to cut out the excess motion, so I thought about it for a while. Then I thought about it some more. Before I realized, months had passed and I was still thinking about it. It seemed as though there were too many different transitions to watch out for and decide if they should be kept in the pattern file or deleted.
One day I tried manually editing a file. I just looked for sequences of lines containing motion along the Xmin edge, and removed everything except the first and last line in each sequence. Notepad++ has a "mark all" function that makes it real easy to spot the sequences. Then I did the same for the other edges and tried the pattern on the table. It worked! I wrote a Perl program to automate that process and it worked well. It took me an hour to edit a file manually, but only a fraction of a second to do it with the Perl program (yay computers!).
But there was still a problem. Some patterns have the ball going around and around the table from corner to corner. My program didn't get rid of that stuff. So I thought about it for a little while - this time an hour or so, instead of months. I added some code to my Perl program that looks for corner to corner sequences and optimizes them. When I say optimizes those sequences, I mean it will eliminate unnecessary motion, and in the case of motion that is necessary, it substitutes the shortest path around the table for the longer path that was in the pattern file.
The result is a huge improvement in the "watchability" of the table because the patterns no longer waste a lot of time moving the ball around the edges of the table. It also saves a lot of wear and tear on the mechanism. Here's an example- this pattern, straight out of Sandify, took 2 hours to complete:
It isn't hard to see why that pattern would take two hours- there's a huge amount of time wasted along the upper and lower edges of the table.
Here's the same pattern after my Perl program (Trimify2x.pl) has edited out the crud:
The edited pattern, which creates the exact same drawing on the table, takes only 57 minutes to complete.
You can grab The Perl program "trimify2x.pl" here. Warning- this is the first code I have written in about 20 years, and the first Perl program I have ever written. It works, but there's no error checking- if you give bad input it will do weird stuff. You'll have to have a recent Perl install on your computer to use it. Type "perl trimify2x.pl" to start the program and it will ask for the name of the file you want to process. The output file will be stored with "_clean" appended to the filename you typed. I used Strawberry Perl running in windows. I haven't tested the program in linux, but I think it will work.
I have been communicating with Jeff Eberl, the author of Sandify, and he is now working on including the algorithm I used so that Sandify will generate clean patterns from the start. Until then, trimify2x.pl FTW!