Building A Word Clock With Genetic Algorithms

Maybe it was a language barrier he ran into, or possibly an inclination to do things the hard and smart way, but we really like [Alessio]’s take on building the display for his word clock. Instead of relying on a pre-designed word layout, he made his own word pattern with a genetic algorithm.

While looking at other word clock builds on the Internet, [Alessio] noticed all the DIY copies used the same pattern of letters as the original QLOCKTWO word clock. There are obvious reasons for this, laziness chief among them, but [Alessio] decided to do one better. Armed with JGAP, he made a 10×10 German language word clock and a 11×11 English language word clock.

[Alessio]’s algorithm takes a list of regular expressions – ‘five past four’ and ‘four five’ are both valid expressions for 4:05 – and combines solutions together for a hopefully optimal solution. One added bonus of [Alessio]’s method is the ability to generate non-square word clocks. On his project page, [Alessio] put up examples for round, triangular, and diamond-shaped word clocks.

[Alessio] ended up building a 10×10 square German language word clock with an Arduino Nano, DS1307 real-time clock, RGB LEDs, and a few shift registers. Very nice work for a custom-designed word clock.

22 thoughts on “Building A Word Clock With Genetic Algorithms

  1. @MrX: The linked article gets it correct. That’s the issue you take away from this though? Not how cool the actual hack is? Give me a break.

    Anyways, to Alessio: This is awesome! Great practical use of GA.

  2. Looks clever. I’ve been looking to put one of these together based on a recent kickstarter project ClockTHREE.

    Alessio has definately made this much more interesting. Very clever use of the regexp to solve potential matches. I wonder if it could be used to find Vertical as well as horizontal matches.

    1. “[Alessio] decided to do one better. Armed with JGAP, he made a 10×10 German language word clock”

      He did not use JGAP.

      “I just wanted to really understand the GAs and decided to program it *completely by myself*. For a real problem you would of course use one of the many GA frameworks (JGAP for example)”

  3. I have been unable to leave a comment on his site, so I’ll post it here.

    “Fourthy” and “fourty” should be changed to “forty”.

    Also, I’d change the :05 times to (.+?)(o)(.+?)(five)(.*).

  4. After reading through,I had to come back here and say:

    I freakin love GA,ever since the mona lisa I’ve been craving for more.Also got a 2D vehicule GA trying to climb a hill.I still have em somewhere on my computer if you want em,they are offline now.. =/

  5. Thanks everybody, I corrected the “fourty” typo and changed the :05 times as suggested by Thopter and Andrew.

    Whats the problem with the code? I just imported it in Eclipse and it runs without any problems….

    1. I figured out how to run the code. It was my fault, my first time compiling and running java code on my computer.

      I redownloaded the zipped code, but it’s the same as before. What changes did you make?

      1. I didn’t really change the Zip file, I’ll do that if I don’t forget it..
        The only changes where in the “TimeNamesEnglish.java” where the strings for the times are generated – just have a look at it, it’s rather short.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.