loading

For those who don't know, paper toss is a game in which you have to toss the ball into the basket. The game play video has been attached on the top.

In this instructable, I'm going to teach you how to automate that process.

The things you will need are:

  1. Android device with USB debugging enabled
  2. PC runnning MATLAB (we need the image processing toolbox)
  3. USB cable to connect PC and laptop

Step 1: Enabling Developer Options and Installing Drivers

Go to Settings->About phone. Scroll down to Build number and tap it 5-6 times until it says developer options are enabled. Now download the ADB device drivers for your device. You can get these drivers from Universal drivers or developer.android.com. If these don’t work then you can google the term “ADB drivers for ________” and download the drivers suitable for your device from XDA developers forum. Check in Device Manager if the installation was successful. You will notice Android ADB device when connected. Now download the zip file containing the adb file and Matlab scripts from here.

Note: This check is not required if you are confident that the drivers are installed properly. Open command prompt and navigate to the directory of the extracted game folder containing adb.exe file. The command is “cd dir_name” to change folders in Windows and Linux. “ls” to view contents of current directory. From this directory type “adb devices”. Your device name must be displayed else drivers are not installed properly if so reinstall from a different source. If installed properly depending on the Android version running a prompt may pop up on the device containing RSA fingerprint key. Check the option “Always allow” and confirm.

Step 2: Setting Up Matlab

Make sure Matlab being installed has Image Processing Toolbox. This post might help. Open Matlab and set its current working directory to the game folder extracted.

Step 3: Running the Script

The code is available here.

Run the script with name pt.m. It should start playing the game for you. The m-file is well commented, which will hopefully help you understand the code. Note that the swiping parameters have been optimized to work Paper Toss 2 (Boss Mode). You can change the parameters to fit into any other situation.

All the best! Happy building. :)

About This Instructable

630views

1favorite

License:

More by psurya1994:Breaking World Record High Score in Paper Toss Arduino Plays Stick Hero Arduino Plays Piano Tiles 
Add instructable to: