Burger Bot

Playing games with python


One day I was out and a little bored, so as you sometimes do I browsed the play store. I came across a little game called burger. It's a simple game where you control a pan and must flip incoming burgers onto a bun to get the tallest burger-tower possible. It's pretty fun, and I soon told people to get it and soon my high score got demolished. Then I came up with the idea of automating it.

I was looking for ways to do this, there were all sorts of macros and apps out there that claimed to automate mobile games. But I ended up using a tool that Google makes called monkey runner. It's a tool that comes with the Android SDK used for unit testing, but of course you can use it for game automation as well. It's really simple to use as everything is bundled into a simple python library, then is run through a batch file, through adb and onto your device.

After figuring out how to emulate touches I wrote a small script that relies on timings to:

  1. Tap to get the burger onto the pan
  2. Wait and let the burger slide down the pan into the optimal position
  3. Tap again to fling the burger

The script slowly increments the delay between 2 and 3 to try and get the burgers lined up good. Though it end up being a balancing that I don't think any set variables can fix. The highest the script got (in my short one night of testing) was 27, which was better than what I could do at the time but still didn't beat many of my friends' scores.

Maybe at some point I'll do something crazy and hook up machine learning to the script or something. Only getting feedback would be slow as reading data from the screen takes 2-3 seconds.

  • June 2015