A script that helps you with the game Animal Restaurant.
- Android Phone
- Enter Developer Mode
- Connect the phone with the computer
- Enter USB Debugging Mode
- Take
Mi 8
as an example, you need to click theMIUI version
for seven times to activate the Developer Mode. Besides, you need to turn on the USB Debugging Mode and the secure debugging mode as well.
- python
- pip
- adb
- Download from here
- remember to configure the environment path
- Alternative
- A brief introduction[CN]
- Platform: WeChat APP
For android devices, you can use the function display phone coordinates in Developer Mode to obtain the coordinates directly.
-
adb shell
to open adb in cmd -
getevent -l
to monitor events -
input tap x y
to simulate clicking (x,y) -
input swipe x1 y1 x2 y2
to simuate swiping from (x1,y1) to (x2,y2) -
call adb
import os os.popen(f'{self.hander} {cmd}').read()
Load the operation from file.
-
open
adb shell
in cmd. -
use
getevent -l
to monitor the event. Use the finger to click the target points on the phone, and record the name of the event (eventX) -
record the data file to recordtap:
adb shell dd if=/dev/input/event3 of=/sdcard/recordtap
(or similar code)
-
then click the target points. After finishing that process, send
Ctrl+C
to cmd. -
read the data file (for testing):
adb shell dd if=/sdcard/recordtap of=/dev/input/event3
-
loop
adb shell for i in `seq 1 100`; do dd if=/sdcard/recordtap of=/dev/input/event3;sleep 0.1; done
(or similar code)
-
sleep
-
Random set of actions
-
Random delay after each operation
-
Random times of clicking
-
Random location of hit simulation
Looking forward to better solutions!
XYstudy / code structure 1 / code structure2 / opt 1 / opt 2