Stick Hero Game Automation
- Krishna Kant Singh
- Apr 1, 2018
- 2 min read
Objective: Our objective was to create a software program to play the game.
You can find the game in Play Store.
Take a glance at the screenshots of the game. In the game, the player has to hold the finger on the screen till the height of the stick becomes large enough to cover the distance between the two towers. Anything else or more results in termination of the game.
If the distance is such that the stick falls on the red region marked, the player gets a bonus for “perfect”.

We automated the game in MATLAB. So, you will require MATLAB (or any other software such as octave or OpenCv would do) for image processing.
You will also require adb tools to interact with your smartphone using laptop. Using this tool you can do many operations but we will mostly need to capture the screenshot, pull it on the system and simulate the touch for desired time.
Description
We will first capture the screenshot of the present state of the game, pull it on the system and then it is processed in MATLAB. The image is initially in RGB form, so it is first converted into binary image.

In the above binary image, the towers are represented by white and the rest by black. We know that, binary image is stored in the form of matrix having value 1 for white and 0 for black. First the distance between the first tower and the red mark is calculated using while loop traversing through whole array and counting for number of times 1 occurs. Then, this distance is multiplied with a suitable factor to compensate the time for processing.

The above image shows the highest score, scored by the soft-bot. You can try out it yourself. Here is the source code of the soft-bot.