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 :)

lego-plays-ruzzle

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:

https://github.com/albertosarullo/ruzzle-mindstorm-nxc-nodejs-solver

More photos are on Flickr:

http://www.flickr.com/photos/silvana_g/8459161766/in/set-72157632723812787/

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 !

 

 

 

This entry was posted in Android, Javascript, Uncategorized. Bookmark the permalink.

27 Responses to Lego plays Ruzzle: nxt & nodejs powered robot

  1. Pingback: Lego plays Ruzzle: retroscena della nascita di un robot - Lega Nerd

  2. Lorenzo says:

    this is great stuff!! Congrats! Amazing job!

  3. Paolo says:

    How did you solve the ruzzle? Do you use some search algorithm or is a simple greedy search on all the dictionary?

    • Alberto says:

      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 4×4 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).

  4. Nicola G says:

    Vienici a trovare sul gruppo di NodeJs Italy ;)
    https://www.facebook.com/groups/nodejsitaly/

  5. Daniele says:

    Great job! A very cool mashup of technologies!

  6. Fabio says:

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

  7. Pingback: LEGO stylus solves Ruzzle tablet game

  8. Pingback: rndm(mod) » LEGO stylus solves Ruzzle tablet game

  9. Pingback: LEGO stylus solves Ruzzle tablet game | Daily IT News on it news..it news..

  10. francesco says:

    Grandissimo progetto,idea veramente geniale!!poi il video fighissimo. ti stimo!!!!!

  11. Gabriele says:

    Idolo.

  12. E says:

    Very cool project! I liked the video and the music!

  13. Shawn says:

    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?

  14. Alberto says:

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

  15. Dan says:

    Hi, great project – any chance you might post the plans to build the robot? Would be really great for various applications in software QA, if it could be integrated with for example the Sikuli environment.. http://www.sikuli.org/

    • Alberto says:

      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.

  16. 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 :-D

    Fantastic job. Thanks!

    Giacecco

    • Alberto says:

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

  17. Giulia says:

    Complimentoni!! Seguirò il tuo talk al Codemotion!!! :)

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>