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.

Comments

  1. MrX says:

    “regular expressions”

    I don’t think that means what you think it means.

    • Thopter says:

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

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

  2. Guy says:

    @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.

  3. uC says:

    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.

    • Thopter says:

      Just take the groupings that the program puts out, and arrange them vertically before you cut the stencil.

      • uC says:

        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

    • Thopter says:

      “[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)”

  4. Thopter says:

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

  5. ellindsey says:

    “Fourthy”? Neat idea, but I think something was lost in translation.

    • Ivan says:

      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

  6. Chris says:
  7. th3BadWolf says:

    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.. =/

  8. Andrew says:

    4:05 is never “four five”, it’s “four oh-five”. If you’re an English speaker, that is.

  9. Thopter says:

    Has anyone else been able to get his java code to run? I’ve had no luck at all so far.

  10. gizmoguyar says:

    This type of clock appears to be quite popular so it’s cool to see a different spin on it. I have to say that all of the pictures I see online are rather ugly though. I just finished mine, and I have to boast that it’s definitely the coolest.

    http://www.augsoddsandends.com/Augs_Odds_And_Ends/Word_Clock.html

  11. Alessio says:

    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….

    • Thopter says:

      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?

      • Alessio says:

        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.

      • Thopter says:

        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”.

      • Alessio says:

        I put the code up on github, so check it out

Speak Your Mind

*

Related Hacks in Software Development

  • Fuzzy time used to keep the kids in bed
  • Light programming for a clock
  • Wristwatch measures your perception of time; also tells time
  • Six-digit VFD alarm clock
  • LED clock lights up a dead Mac Mini