Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/adriagual/marvel-snap-bot

A computer vision bot made with OpenCV and ADB.
https://github.com/adriagual/marvel-snap-bot

adb android automation opencv python3

Last synced: about 22 hours ago
JSON representation

A computer vision bot made with OpenCV and ADB.

Awesome Lists containing this project

README

        




Markdownify


Marvel Snap Bot


A computer vision bot made with OpenCV and ADB.



Python











Key Features
How To Use
Improvements

![Animation](https://user-images.githubusercontent.com/25803231/210187037-1d01c383-95ff-481a-99e3-566fe0e93715.gif)

![Capture](https://user-images.githubusercontent.com/25803231/210183326-e543da5a-ef14-44e5-8cd5-770eec453c02.PNG)

## Key Features

- Card detection
- Detect player cards on live time
- Automate the decision making
- Mana consumption tracked
- Fields with different priorities and constraints
- ADB Support (Bluestacks, any version)
- Global utils to apply for other computer vision bots
- Calculate the power of the cards
- Farm missions
- Farm season pass
- Play kazoo decks with applied logic
- Quick usage

## How To Use

To clone and run this application, you'll need [Git](https://git-scm.com), [OpenCV](https://opencv.org/), [Bluestacks](https://www.bluestacks.com/es/index.html) and [Python 3](https://www.python.org/).
From your command line:

```bash
# Clone this repository
$ git clone https://github.com/AdriaGual/marvel-snap-bot

# Go into the repository
$ cd marvel-snap-bot

# Install dependencies
$ pip install -r requirements.txt

# Edit the config.py file
adb_path: Absolute path to where you can execute ADB
project_path: Absolute path to the project
images_folder: Absolute path to the images folder
fields_folder: Absolute path to the fields images folder
mana_folder: Absolute path to the mana images folder
turns_folder: Absolute path to the turns folder
data_folder: Absolute path to the card images folder
tmp_path: Absolute path to a tmp folder

# Make sure that Bluestacks has the ADB enabled
Settings -> Advanced -> Android Debug Bridge (ADB)

# Check if you have the correct resolution
The script is made to work on 1600x900 resolution
```
## Add the images to the each folder
You can grab them from the emulator, there is an option on the script to get the info in real time. Just change the False parameter from the functions get_my_hands_cards and get_fields.
![image](https://user-images.githubusercontent.com/25803231/211024589-c4545e4b-523c-40f0-b1c1-3302bf1ed83b.png)

## Card images structure folder
Remember that this cards need its values entered manually on the cp_list.py file

![image](https://user-images.githubusercontent.com/25803231/211023744-f587976f-be89-41a8-a798-619c8209d29e.png)

## Images structure folder
![image](https://user-images.githubusercontent.com/25803231/211023945-26312bae-9ac6-437e-82f8-18c1d9140d94.png)

```bash
# Run the bot
$ python start.py
```

> **Note**
> In order to see the bot start, you must install the game (Marvel Snap Bot) on Bluestacks and start it.

## Improvements

There are plenty of improvements still, here's a bunch of:

- Fields should be detected automatically
- The points of each field is not tracked, it can be done with pytesseract
- The cards on the player field don't show the power
- Detect the enemy cards on the field
- Keep track of the winrate of a session

## License

MIT

---