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.

21 thoughts on “Building a word clock with genetic algorithms

    1. Take a look at his site. He does use regex:

      1:00 : (.*?)(one)(.+?)(o)(.+?)(clock)(.*)
      1:05 : (.*?)(one)(.+?)(five)(.*)
      1:05 : (.*?)(five)(.+?)(past)(.+?)(one)(.*)

  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. I intended to say it would be interesting if it could arrange them BOTH horizontally and vertically.

        like so:

        t
        w
        one

        still, tis cool

    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)(.*).

    1. I don’t know where that sample came from. But I’m glad I’m not the only one that fell for it. Try looking for “three” ;-)

      I guess it’s just a picture. Hehehe

  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.

      2. Yeah, I made changes in that file too. I didn’t see how to get the :05 though, without also getting “o five past three”.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s