Automate the Tableturf game helping you reach Level 999 and get all sleeves. The script is based on image recognition and bluetooth emulator to auto play Tableturf.
- Simple web portal.
- AI that can beat Level 3 NPC.
- Complete flow control. Once win a NPC 30 times, auto switch to the next one.
prerequisite:
- Python >= 3.9.0
- Bluetooth adapter. Tested on
- Windows Subsystem for Linux with a motherboard built-in bluetooth device.
- Raspberry 4B.
- Capture card. Tested on Razer Ripsaw HD.
Note: all parameters about image recognition are based on Razer Ripsaw HD. It may need to finetune for other devices.
Install the requirements:
sudo pip3 install -r requirement.txt
Setup and run the virtual controller server on the device which has Bluetooth adapter. Please refer to: https://github.com/fga401/AutoTableTurf/tree/master/controller/nxbt_server
Run the web portal:
export FLASK_APP=portal
sudo python3 -m flask run --host=0.0.0.0
On the web portal:
- enter the virtual controller server endpoint and click
Connect
. If successful, you can control your Switch by keyboard. - Choose the correct webcam whose source is Switch.
- Write the profile on the right side.
- Go to the NPC selection page.
- [Optional] Set the timer to auto stop. Also, you can check the checkbox
Turn off Switch after stop
. - Click 'Run'.
Profile example:
[
{
"current_level": 1,
"current_win": 2,
"target_level": 3,
"target_win": 30,
"deck": 0
},
{
"current_level": 3,
"current_win": 12,
"target_level": 3,
"target_win": 30,
"deck": 1
}
]
Each block represents the configuration of an NPC. The above profile performs the following actions:
- Use Deck 0 to play against the first NPC Level 1 until one win.
- Use Deck 0 to play against the first NPC Level 2 until three wins.
- Use Deck 0 to play against the first NPC Level 3 until thirty wins.
- Use Deck 1 to play against the second NPC Level 3 until eighteen wins.
- Virtual controller API
- Screen capturing
- Screen recognition & Game flow testing
- Smarter AI
- User-friendly interface
- don't use Deck 11, which is prone to crash. #4
Many thanks to all below repositories:
- https://github.com/Brikwerk/nxbt for implementing a Python API of Switch controller.