Cheating Telegram Lumberjack!

It is been a while that me and my co-workers at Atra Vision are competing on this "Lumberjack" game on telegram! For a long time, I had the best score until 2 geeks (Zohre and Niloufar) got some untouchable scores that took lots of effort for me to beat it (Currently I have the first rank with 413 scores!!).

Although I have the first position in the ranking now, but I still feel the risk that some day I wake up and see someone just took my place! So what to do? Play until death!? No, it's time to cheat! An open-source cheating for beating!

I decided to write a simple program capable of beating me and any other geek in the future! So just like the game bot idea of telegram, I developed a player bot called Lumberjack Racer!!

You can download the latest Lumber Racer version from here.

lumberracer2

Having no knowledge about computer vision algorithms, it took about 4 hours to write such program, plus 5 hours for refactoring and further optimizations! And now, it works like a charm! In case you are enthusiastic to see the source code, I've just put the source code on my GitHub. I'm pretty sure it is not a final and well-formed code, so I would be happy if you fork and improve it. It still needs lots of refactoring, but I just leave it in its current state.

I hope this piece of code wouldn't become a field of programming contest again, I wont participate in that a contest anymore!

BTW, I think the source code is a good starter kit my software architecture workshops. The interesting part of current design is this interface:

public interface ILumberjackWorld
{
    Image ViewCamera();
    void SendKeyboardCommand(KeyCommand command);
}

As you see, there is an abstraction defined to represent the world of Lumberjack game. For me, as a programmer, a Lumberjack game is nothing more than these:

  • ViewCamera() : To get some specific region of monitor that I should watch for the tree.
  • SendKeyboardCommand() : To send 2 keyboard commands to the game: Right Arrow and Left Arrow 

You can use this representation of the game to apply your own algorithms. A good practice to improve the architecture of this code is to use MEF for plugging new algorithms.

BTW, you can check the result on YouTube:


UPDATE:
If you have questions about the code, please ask in StackOverflow and then let me know.

About the author

Mehran Davoudi

A former technology geek! Currently a mentor and software architect, working as a consultant for companies with large scale software development.
Why dvd? Read about me (uɒɹɥəɯ)!

View all posts

81 Comments

Leave a Reply

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