Lego plays Ruzzle: nxt & nodejs powered robot

Today I have uploaded a video ‘Lego plays Ruzzle‘ on Youtube, to show how my creation works.

I like to mix different technologies to create something innovative.

I love Lego, and recently discovered Ruzzle, a popular mobile game. So, I decided to mix Lego, Ruzzle, Javascript, bash and other pieces to create a super robot 🙂


In this project I used:

  • Tablet with Ruzzle
  • Bash script for:
    • Bash script for download screenshot of device
    • Process image with Imagemagick
    • Recognize character from image with Tesseract
  • NodeJS for:
    • Solving Ruzzle
    • Optimizing the plan
    • Send via bluetooth to Lego Mindstorm
  • Nxc program to receive plan via bluetooth
  • Absolute Position Regulator library for precise control of lego motors

Ruzzle solver scheme (3)

The project is open source, and the code is on Github:

More photos are on Flickr:

Other article on Lego Ruzzle Solver:

In march 23 I talked about history of my robots @ Codemotion Rome. Below you can finde the slides of my talk:


Any feedback / request is appreciated !




31 Replies to “Lego plays Ruzzle: nxt & nodejs powered robot”

    1. Greedy search is so fast (< 100ms) that i not implemented particular optimization. The only pre-optimization is filter world, removing those not contains letters out of the 4x4 grid. This avoid unnecessary research. The entire code is on github, and the search algorithm has a length of ~100 line of code (search, searchWord and searchNeighboard methods).

  1. E che ti devo dire? come ho già condiviso su G+ …sono rimasto senza parole 😉
    Bravo bravo!
    Solo che ora mio figlio mi ha sfidato: “…perché non lo costruisci anche te?”

  2. Awesome project! I was curious – how much time does your software need to take a photo, analyze it, find words, and get the Mindstorms to start playing the game?

  3. Thank you Shawn!
    The more time consuming process is make the screenshot, download it, and process image via tesseract (4-7s).
    The search in the dictionary is fast, very fast. For example, limiting the dictionary to 5000 words, the search process require 52ms to find words and order them.
    Another point where to improve the performance is the sending over bluetooth: actually the robot wait until the entire plan is received (2-3s).

    1. Hi Dan!
      I don’t know Sikuli environment, but i love the automation (i hate any repetitive task), and in future week i publish some detailed photos on how build the robot.
      The structure behind the motors responsible of movement along x and y axis are modular, and is easy to change the gear to obtain different velociy/acceleration and tune the robot.
      If I generalize the nxt program to receive coordinate in cm or pixel, instead of coordinates in 4×4 grid, the robot can be used to make real test of any tablet application.

  4. Awesome! You make me wonder why I am wasting time in an office rather than spending my days building stuff like this.

    Please share a video that is a bit more technical, showing the components and real-time video of a typical Ruzzle match, start to finish.

    Something that is not clear from your description is which component is responsible for “reading” the Ruzzle board, or, in other words, where the bash script runs and what it does exactly (unless you want us to reverse engineer what you published on GitHub of course). At the moment I am guessing that you manually import a screenshot on some conventional computer that is not shown in the video, which then sends instructions to the Mindstorms controller. In an ideal geeky world, this part of the process may run on a Raspberry Pi 😀

    Fantastic job. Thanks!


    1. Hi Gianfranco!

      I spend my days in the office like you: the robot is made in the kitchen of my apartment (with the permission of my girlfriend), in many nights and some weekend of hard work.

      In the next week I post more videos and photos of the robot. I confirm that i use my computer to download the screen. I own a Raspberry board (great!) with node.js installed, but I wan to send the plan via bluetooth to the mindstorm nxt, and (I not own a bluetooh dongle connected to the Raspberry).

  5. Hi!
    Really cool project! I wonder which tablet do you have? Is it running Vanilla Android or is it rooted? I’m interested to know how to run bash script on my Nexus 7.

Leave a Reply

Your email address will not be published. Required fields are marked *