Wow, did not know there is actually a thing called DinoCoin. If you came here because of that then you will be disappointed. This project is not related to that.
:start rem set java_exe="c:\Program Files\Java\jdk1.7.0\bin\java.exe" rem set javaw_exe="c:\Program Files\Java\jdk1.7.0\bin\javaw.exe" rem set ANDROID_SWT=c:\work\android-sdk-windows\tools\lib\x86_64\ @echo "Start" @time /t call c:\work\android-sdk-windows\tools\monkeyrunner.bat %CD%\mr_touchpad.py @time /t timeout /t 150 goto start pauseAs you can see it wakes up every 150s and starts the script attached below.
There is a main pattern for changing the game area:
So it starts in the bottom right position - by game design - and moves one screen up until it reaches the top. Then it goes one screen to the right at starts swiping down, again, one screen at a time.
At the bottom, it starts the same pattern again.
The area (largeXIterations x largeYIterations) and swiping size (largeXStep and largeYStep) are hardcoded in the Python script. Currently this is a 5 x 3 grid.
On each screen, the automator clicks on all the points from a grid-like pattern, pictured below:
So each screen (~850x450px) gets ~100 clicks yielded by the formula: (maxX-minX)/smallXStep)*(maxY-minY)/smallYStep).
The click (tap) horizontal positions are slightly randomized, by ~4 pixels. Also, each click has a random chance of 33% of being performed.
This is done for multiple reasons:
- the ADB automation is slow to respond and doing the complete pattern wastes a lot of time
- the coins are not regenerated so often, it's ok if some are missed
- empirically, there's a higher chance for a higher return (yield) using a fast sparse game swipe than a slow complete swipe
# Imports the monkeyrunner modules used by this program from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice import time, math import java.util.Random; random=java.util.Random() # Constants duration = 1 steps = 30 print("Connecting...") # Connects to the current device, returning a MonkeyDevice object device = MonkeyRunner.waitForConnection() print("...done") # Installs the Android package. Notice that this method returns a boolean, so you can test # to see if the installation worked. # sets a variable with the package's internal name package = 'com.ludia.jurassicpark' # sets a variable with the name of an Activity in the package activity = 'com.ludia.gameengine.GameActivity' # sets the name of the component to start runComponent = package + '/' + activity # Kill Application device.shell("am force-stop " + package) time.sleep(1) # wake device device.wake() time.sleep(1) # Runs the activity device.startActivity(component=runComponent) # unlock device.drag((741, 374), (948, 374), duration, steps) # wait for start time.sleep(38) ''' # Close Ad time.sleep(10) device.touch(1165, 40, MonkeyDevice.DOWN_AND_UP) # Press Start time.sleep(10) device.touch(600, 400, MonkeyDevice.DOWN_AND_UP) # Select Chapter 1 time.sleep(2) device.touch(150, 280, MonkeyDevice.DOWN_AND_UP) # Select Puzzle 1 time.sleep(2) device.touch(110, 110, MonkeyDevice.DOWN_AND_UP) # Skip intro time.sleep(2) device.touch(1165, 680, MonkeyDevice.DOWN_AND_UP) time.sleep(2) device.touch(600, 400, MonkeyDevice.DOWN_AND_UP) # Drag time.sleep(6) device.drag((396,398), (170,484), 1.0, 10) # Takes a screenshot time.sleep(15) result = device.takeSnapshot() # Writes the screenshot to a file result.writeToFile('./testimage.png','png') ''' def devicetouch(x,y,s): device.touch(x, y, MonkeyDevice.DOWN) time.sleep(0.1) device.touch(x, y, MonkeyDevice.UP) time.sleep(0.1) def moveHorizontal(offset): device.drag((500, 380), (500-offset, 380), duration/1.5, steps) time.sleep(0.7) def moveVertical(offset2): device.drag((500, 155), (500, 155+offset2), duration/1.5, steps) time.sleep(0.7) def harvest(): for x in range(0, math.floor((maxX-minX)/smallXStep)): for y in range(0...Read more »