Last April, a friend who knows me too well told me about this new KickStarter for a Cycloid Drawing Machine. I looked at this intriguing adult spyrograph with great wonder, but then moved onto other things. But the machine continued to pique my interest, and every few days I would look at it again, trying to rationalize practical uses for it so I could justify buying one. Finally, in early May, I threw caution to the wind and ordered one.
Immediately, without having received the physical object, I grew concerned that I would run out of, or waste the paper that it uses. So I decided to create a “virtual” software version of the Cycloid Drawing Machine that I could use to experiment with, and figure out ideal settings for the machine.
I looked carefully at the photographs & videos of the existing device, and made a Processing sketch (a computer program in the Processing language) that simulated a particular drawing depicted on Joe’s Kickstarter page.
After a day or so, I was able to get my simulation within the ballpark, but I had a few issues.
Firstly, since I had eyeballed the measurements of the machine based on photographs and videos, I knew they weren’t quite close enough to the real thing — I wanted to get more accurate measurements. Secondly, I was worried that if I were to publish this code, as I do with many of my projects, I might be cannibalizing sales of the physical device.
Both problems could be addressed by contacting Joe Freedman, the inventor, so I sent him the above picture, told him about my project, and asked for his input, somewhat worried that he might have a very negative reaction to this development.
I was relieved that Joe was actually quite thrilled. “I’d love to have you do the interactive simulation,” Joe wrote. He not only sent me the vector illustrations of his parts that I asked for, but also an actual working Cycloid Drawing Machine, months ahead of his planned delivery date, not to mention a few other awesome toys that he makes in his workshop.
[ Warning: If you are reading this on a phone or tablet, I suggest you use a desktop computer for playing with the CDMS – it’s too big for phones, and many tablets are either too small, or too slow to handle it.
I should also warn you that its not hard to create configurations on the CDMS which are impractical on the real device. I’ve stumbled into designs that are difficult to crank because of inadequate torque, a non-issue on the CDMS. These issues are best discovered by using the real thing. ]
As Joe and I worked together over the following days, we were able to help each other immensely — Joe gave me lots of insider knowledge about how to use the machine effectively; and as an early beta-tester for Joe, I was able to provide some feedback about what new users of the machine would struggle with. Spurred on by the project, Joe made a series of helpful instructional videos, which he shared.
While Joe seemed delighted with the simulation, he did eventually show some worry about what effect it might have on his existing customers. “I’m uncertain about how people will respond to the appearance of a free digital version,” he wrote. “It is a different thing and a different experience but you’ve done such a brilliant job of recreating the analog that I worry. I still like to crank the gears but its been great to explore potential setups with the digital cdm.” This was a worry that I shared, initially. It would be a shame if my virtual machine were to deprive folks from experiencing the very valuable tactile experience of the real machine.
At the same time, I saw that my simulation was proving to be a valuable educational tool for both Joe and myself. We were able to quickly discover new drawings, and to intuit better the mathematical underpinnings of the machine. One particularly interesting question I managed to answer was “given a particular configuration of the machine, how many times do you need to crank it to finish a drawing?” and the related question “is it possible to create a drawing that never finishes?”. Having solved these to my own satisfaction, I will let you discover the answers in your own time.
In addition, Joe and I were able to create movies that showed the effect of the changing parameters (such as pen arm position) on the finished drawings. These proved to be hugely instructive.
[ By the way, the web version of the CDMS can’t make movies easily, but I have also published my code for the stand-alone Processing version, which can. ]
While I started out being worried that my virtual machine might hurt the sales of the real machine, those fears began to evaporate as Joe and I continued to work together.
I realized that the combination of the physical and the virtual machine creates a kind of virtuous feedback loop that improves both immensely. I believe that the virtual machine may certainly dissuade some folks from buying the real thing, but I believe it will also encourage other folks to buy, in equal or greater numbers (for the same reason that using a flight simulator doesn’t dissuade me from flying).
The virtual machine is cool and easier to use, but it lacks much of the charm of the physical device. Moreover, the output of the real CDM is inevitably different than the CDMS, not only because my measurements are still slightly off, but because its real. Different pens have different radii. Pens don’t output perfect strokes. Wooden gears don’t create perfect circles, and human hands don’t produce constant force. All of this combines to create output which is much less perfect, and much more human. The drawings I am choosing to frame are the ones that have these imperfections.
You’ll find my Cycloid Drawing Machine Simulation (CDMS) here.
I kept myself busy over the Christmas break (when I wasn’t feeding the birds and entertaining my cat) by adding 13 new Interactive Puzzle pages to this website. The puzzles work in modern web browsers (Chrome, Firefox, Safari, IE 9 or later), on iPads, and on some Android tablets . I think these puzzles are too large to solve comfortably on smaller smart phones (like iPhones), but I still managed to work a few while waiting at my dentist’s office.
Android support is a little spotty right now, because I can’t test on every Android device, and some of the older ones have performance issues. It’s working okay on the Samsung Galaxy Pro and on my Android phone. If you’re planning on buying a tablet, I would recommend the iPad, if you can afford it.
For the puzzles that come in different sizes (like Slitherlink, Kakuro, and so on), I’m offering a few new sizes, including 10x12s that work nicely on iPads, and some larger sizes that are intended for big monitors or tablets turned sideways.
If the size isn’t right, click the ? icon and choose a different size.
I wanted to point out a few hidden, or not so obvious, features:
* For all the puzzles that involve number grids (Sudoku, Killer Sudoku, Jigsaw Sudoku, Comparison Sudoku, Kakuro, Inkies) there are options for making marks on the cells. You use the little numbers to make marks (indicating possible numbers for a cell) and the big numbers for entering solutions. In most of these puzzles, if you double-click or double-tap, it’ll select ALL the cells in a block or cage, and then you can mark them all at once (e.g. touching the little 5 will make all the selected cells get a little 5). You can also drag your finger, or use the shift key on a keyboard to select multiple cells — this is a huge time saver, and makes solving Killer Sudoku, in particular, a pleasure.
* Speaking of shift keys, there are a few features that activated by the various shift or modifier keys on keyboards.
* For the Sudoku-like puzzles, shift is used for multiple cell selection. In addition you can hold down Shift while typing number-keys to make and clear marks.
* For the Slitherlink-like puzzles (Slitherlink, Masyu, Cow & Cactus, Area 51), shift-click can be used to place and clear X-marks (which indicate an open edge). The Alt Key (or Option key on a PC) activates the yellow highlighter, and the Windows/Command key activates the blue/green highlighter. I should note that I use the highlighters extensively on slitherlink puzzles to keep track of the interior and exterior of the loop.
* If you haven’t done so yet, click the Question Mark, Magnifying Glass and Gear Icons so you can see what they are for. The Question Mark offers multiple kinds of help, including the very important Puzzle Instructions. The Magnifying Glass allows you to change the puzzle variety, size and/or difficulty. The Gear controls different settings, which can make the puzzle easier to read or easier to solve.
* The “Krazydad” word in the puzzle title is a link that’ll take you back to the interactive puzzle menu, where there are 13 puzzle varieties to choose from.
I should mention that in addition to some new flavors of Variety Slitherlink, I’m introducing two brand new puzzles: Cow & Cactus and Area 51, which are not yet available elsewhere on the site. Both of these puzzles are Slitherlink variants, similar to Slitherlink and Masyu. I’m personally very fond of the Area 51s (had tip to David Millar, who invented the format), which is an advanced puzzle that combines all the different clues from Slitherlink, Masyu and Cow & Cactus.
So have a happy and puzzling 2015, and enjoy the new puzzles!
Permalink|Comments Off on Interactive Puzzles are here!
For the past few days, I’ve been preparing a wireless carillon that will hang on our Christmas tree this year. The carillon is a set of 9 brass bells, which can play different tunes. It is connected to an Arduino micro-controller that controls the bells. The Arduino receives messages from my desktop computer via an XBee radio. The desktop computer can trigger the bells in a variety of ways.
I’ve programmed my carillon to chime the quarter hours, like a grandfather clock, and to play a collection of different short tunes to tell me about the state of the world, and the Internet. The bells play “We’re in the money” when I get notified of an electronic payment, “Baby it’s cold outside” when the thermostat gets turned down (or up?), and “Home on the Range” when we come back from an outing. I can easily create more interesting triggers using IFTTT. Once the tree is set up, I’ll be able to play the bells directly from my cell phone.
As a long-time programmer with virtually no electronics experience, this is my first Arduino project that involves more than lighting a few LEDs, and I’m very happy with the way it is turning out.
The project started last Christmas when I visited my friend Beatrice, and she showed me a mass-market set of caroling christmas bells on her Christmas tree. Apparently these things have been around since 1989, but I had never seen one before. I immediately bought a set on EBay for twenty bucks, so it could be hacked.
The built-in micro-controller plays a never-ending stream of Christmas carols, which is cool/annoying, but I wanted to be able to control it myself, which is even more cool/annoying. It seemed like a natural for an Arduino project. One of the cool things about these bells is that the solenoids are already built-in to each bell, which greatly reduces the amount of work needed to make them ring. When the voltage is raised, a clapper on a flexible wire strikes the bell, and then springs back to a natural resting position, which prevents accidentally damping the bell by leaving the voltage high too long. Since there are only 9 bells, that’s enough to be played by an Arduino Uno while leaving a few pins left over for serial communication or other needs.
In March, I took these bells to SpecWork, a local Hack-a-thon, with the intent of using them to provide live sound effects for a video game. My electronics hacking skills are not that great, but CStone (Brandon Creighton) was on hand to help out. We opened the case that contains the bell controller and found that the bells were connected via individual wires to a mysterious custom IC that was dated 1989. My intent was to replace that IC with an Arduino.
CStone measured the line triggering a bell on his oscilloscope, which showed a 17v trigger. We decided to try a 9v battery to trigger them, and it worked! CStone disconnected the two bunches of wires, and connected them to the Arduino, with an individual N-Channel mosfet for each bell. The 9v worked okay, but I was having trouble getting a couple of the bells to ring consistently. I found out later that using the 12v power supply that came with the bells fixed this problem.
Below is a video of the bells ringing while I’m playing the game 2048. For the 2048 project, I used the Firmata driver on the Arduino, and wrote a node.js backend that could talk to the Arduino via Firmata, so I could chime individual bells via a REST API. I then modified a local copy of the 2048 game to ring the bells via this API (this amounted to inserting a couple lines of code in the 2048 game). In the video, you can also hear some additional digital sounds I added to add ambience to the game.
Ultimately, though, I wanted to use the bells to do more interesting things than playing that one game, and I didn’t want to have to keep a computer adjacent to my Christmas tree.
I moved the project to a larger breadboard, added a socket for the 12v power supply that comes with the bells. I also added some resisters to reduce spurious rings when I power on, although I don’t think they are a necessity for this project.
I then swapped in a different Arduino clone (a RedBoard from SparkFun), and picked up a couple of XBee radios. One radio sits on an XBee Shield on it, mounted on the RedBoard, and the other sits on an XBee Explorer Dongle hooked up to my desktop computer via USB. Now I can control the bells by sending messages to the Arduino via radio. The total cost of the project, including radios, is about $140. However, if you don’t use the radios, it’s about $50. Jamie Robertson and Joe Hager helped me figure what was needed here, and the book “Building Wireless Sensor Networks” by Robert Faludi was also helpful.
Programming the Arduino to use the radios is almost identical to programming it to use a serial connection. The main difference is that you can’t send entire strings and expect the radios to handle it — I found I had to insert little delays (around 10 milliseconds) between each character as I send a string.
When I googled “Firmata XBee” I saw that I might run into some issues using Firmata with XBee. Also, since I was using radios, I wanted to have a little more local control over rhythm, so in place of Firmata, I wrote a short Arduino script that chimes the bells according to a simple serial protocol. The protocol is intended for music: it allows different tempi to be specified, and for chords to be played. Here are the first few notes of the “Star Wars” theme:
The letters in the beginning are used to set the tempo of each note, and the numbers indicate note numbers. The hyphens are delays (used to extend notes), and ampersands (not shown) are used to indicate chords.
I replaced the node.js backend with a Python/Flask backend, based on a very flexible Flask framework by my colleague Ray Scanlon, which I’m going to call “FlaskRack” since he hasn’t given it a name. This framework allows you to make a set of modular services, each running in its own thread, and each of which has a publish/subscribe hook. It’s really good for making Kiosks that involve talking to diverse bits of hardware. I made a few different Flask modules using FlaskRack:
* “Chime” talks to the Arduino via an XBee Explorer that is connected to a local serial port. I can publish to this module via a REST API to send melodies to the bells from a web browser.
* “Transcribe” has a catalog of carols/songs that can be requested by name – it talks to “Chime”. You can publish to this module to request songs by name.
* “Clock” chimes the quarter hours, like a Westminster-style grandfather clock – it talks to “Chime”.
* “PushBullet” subscribes to the PushBullet API/service, which works nicely with IFTTT, and enables me to create a wide variety of interesting triggers to ring the bells. For example, I can trigger melodies when my Nest Thermostat detects motion, or that the temperature has dropped. This module talks to both “Transcribe” and “Chime” depending on which kind of trigger is used.
I’ll be using the Chime and Transcribe APIs to control the bells from my cell phone.
For the record, I am a bit more than “slightly” bald, however I do indeed imagine myself as a little bird.
UPDATE Aug-21-2014: A few folks have asked for sample code. Here is a Python/PIL script, amalgamTest, that will average together a folder full of images, creating test images like frames in the movie above – I usually work with a folder of about 10,000 uncorrelated images, although the effect can be observed by combining as few as 25 of them. I usually work with the little 100×100 thumbnail images that Flickr provides. I’ve also include two other scripts in that archive. “getRandomPhotos” is a script you can use to retrieve lots of random Flickr thumbnails, and “getHighestFlickrID” searches for the highest flickr ID number, a number which you can plug into the getRandomPhotos script.
Finally, the Atlantic article omits an important step, which is described in my paper: To see the orange, you have to ‘normalize’ the average, which cranks up the contrast and the saturation. Otherwise, you tend to get a dirt-brown color — the hue is the same, but the saturation is low. My script does this normalization step by default, although it can be turned off via the -n option.
UPDATE Aug-22-2014: Here’s another article on the topic. This one on the Fast Company design website.
Whit McMahon, a puzzle constructor, wrote to me recently to share a new kind of puzzle he created last year called Balance Quest®.
In these numeric logic puzzles, you fill in blanks so that the sum of each box is made by adding the numbers in the adjoining half-height boxes. Note that some of these numbers are negative, and may produce negative sums. Eventually you reach the center, in which the final sum is zero, representing a kind of equilibrium — you have achieved your quest for balance.
Whit has kindly provided two sets of printable puzzles, small and large, which contain more detailed instructions, a fistful of puzzles, and their answers. Here are the two sample sets:
So, as I reported recently on my blog, I discovered recently that a maze that appeared on the back of packages of Kraft SpongeBob Macaroni & Cheese was based on one of my designs. When I notified @kraftfoods of this, via twitter, they put me in touch with Design Partners, an agency in Racine Wisconsin that was responsible for the packaging design. It is perhaps worth pointing out that Kraft (like most companies that outsource their design work) is indemnified against this kind of thing – any legal repercussions would fall on the agency responsible, not on Kraft.
Susan, the HR director at the agency contacted me with a very nice letter, apologizing sincerely for the mistake. She asked me how I would like to “resolve the matter”. I asked the agency to make cash donations to two food banks – $2,000 to their local food bank, the Racine County Food Bank, and $2,000 to my local food bank, the Los Angeles Food Bank. They were very happy to do so, and the donations were made Thursday morning.
I am personally very pleased with how this turned out. I’m aware that some of you (including one or two eager attorneys) were hoping I would try to get a substantially larger settlement. In my mind, this would not have been just. It would have been a reverse form of theft, taking advantage of one person’s mistake for my personal gain. While it’s tempting to blame the “big corporation” for this kind of thing, ultimately these kinds of mistakes are made by people who are prone to the same kinds of errors that you and I make every day. Also, my house is too cluttered with broken pencil sharpeners and cat toys, and I don’t know where I would fit a lifetime supply of mac & cheese.
So, I hope you like the way I resolved this. I feel I’ve turned lemons into actual lemonade. Or spilt milk into unspilt milk? I dunno, you figure it out.
If you are in the US, and you’d like to learn more about your local food bank, I suggest visiting the following directory:
While grocery shopping this evening, I happened to notice a box of Kraft Mac & Cheese that was turned around, with a familiar looking maze on the back.
While this maze may look generic to you, it looks quite recognizable to me, because I spent quite a bit of time writing software that produces mazes in this style. If you look closely, you may notice the vertices form a fibonacci spiral. It’s a pretty unique design, but, just to be sure, I bought a box, took it home, and started looking through the collection of mazes on my website. These mazes are free for you to download, but definitely not free for you to reuse, unless I grant you permission.
Looking at my website, I found the original pretty quickly. The artist took Maze #1 from Book #1 (published in 2010) of my Intermediate Mazes, and turned it 90 degrees clockwise, and altered it in a handful of spots. Despite the addition and removal of about 7 line segments, the majority of the puzzle is identical to the original. Alas, he or she forgot to ask permission to use my design! They also failed to notice my copyright notice. I can only assume that they figured I wasn’t a consumer of Kraft Macaroni & cheese, or that I would never touch the SpongeBob variety that this maze appeared on (true – I prefer the classic elbow variety, which is getting increasingly hard to find for some reason). I admit I’m not terribly proud of my biannual craving for classic Kraft Mac, but sometimes, I like to pretend I’m 8 years old again.
Here’s the two mazes side by side, just in case there was any doubt:
A helpful note to the good folks at Kraft Foods, or any other multinational conglomerates that wish to use my content without my permission: If you’re gonna steal a maze, you might want to try stealing from maze book #47, and do a horizontal swap on it before you rotate it 90 degrees. That’ll slow me down some…
For the past several days I’ve been enjoying solving successive levels of Euclid the Game, an online set of puzzles based on Euclid’s Elements.
You are initially given the equivalent of a stick, a straight edge and a compass (tools for drawing points, lines and circles), and are asked to construct an equilateral triangle. Once you’ve solved that, you now have a new tool that draws equilateral triangles, which you use to help solve the next problem. As you solve successive problems, you build up a collection of increasingly sophisticated tools, and solve increasingly difficult problems.
I’m currently on level 20. Not sure how far this goes, but let me know if you get stuck.
I occasionally get requests to add new puzzle varieties to the collection. I have to ignore a lot of these, because there are 24 hours in a day. However, the last request I received, for Masyu puzzles, was hard to ignore, since I’ve enjoyed solving these myself for the past few years, and I’d love to have access to a larger collection of them. So what the heck! I made a bunch.
Masyu puzzles are closely related to Slitherlink and other spatial reasoning puzzles. Like Slitherlink, the end result is a loop which is constructed from straight line segments.
Unlike Slitherlink, Masyu puzzles don’t use numbered clues. Instead, the clues are black and white circles, which I am told resemble pearls (although I think they resemble the stones in the board game Go). This gives the puzzles an elegant simplicity which is perhaps only rivaled by Galaxy puzzles, another great Nikoli-style puzzle.
Masyu puzzles use the following rules:
Black circles indicate corners.
White circles indicate straights.
Black circles must be turned upon, but the loop must travel straight through the next and previous cells in its path.
White circles must be traveled straight through, but the loop must turn in the previous and/or next cell in its path.
If you’d like to learn more about how to solve the puzzles, I’ve written a (hopefully) helpful tutorial, which you’ll find here. If you find the tutorial less-than-helpful, let me know, so I can work to improve it.