I really love game challenges and everytime I get a new game I think about how can I solve it via code or represent the game idea.

The Gridlock Game

The game is from Lorenzo, my 4 years old my son. I really love the simplicity of the game and I start thinking about representing the game in an algorithm.

Current implementation

My idea was code the board, but after code it, I tried to start building a solver for it. It was pretty hard for me. My current implementation was a “go horse” with no sense and no concerns. Just a implementation that:

So, it was an old version and as you see it does not accomplish the mission.

The current solver problems

So, Ruby is one of my favorite languages and I put it down in a little time but when I start coding the solver, I really understand how much functional paradigms is missing in my mind. And how my horse approach is broken.

It really does not work yet. It never finishes a board with success. Some little changes should be considered to start being more flexible:

The challenge

The challenge is to solve the board. Feel free to fork it and implement your own strategy!

I extended the challenge to Floripa On Rails meetup and we’ll join tomorrow to implement it together \o/

Feel free to join us and help us to implement a better solver ;)

First post in English

So, it was my first post in English \o/

I recently joined to the Toptal LLC core team.

Now I’m part of a global company! It’s time to be global and start blogging in English too :)

Share → Twitter Facebook Linkedin

Hello there, my name is Jônatas Davi Paganini and this is my personal blog.
I'm developer advocate at Timescale and I also have a few open source projects on github.

Check my talks or connect with me via linkedin / twitter / github / instagram / facebook / strava / meetup.