-
Notifications
You must be signed in to change notification settings - Fork 53
๐ช Reinforce strategies
Crabada can be played in different ways, especially when it comes to reinforcing.
Choose the strategy to use with the USER_X_TEAM_Y_REINFORCE_STRATEGY parameter in .env:
| Name | Description | Notes | Credits |
|---|---|---|---|
NoReinforce |
Do not reinforce | Useful to spare gas | |
HighestBp |
Highest-BP low-cost crab | Good for looting on a budget | |
HighestMp |
Highest-MP low-cost crab | Good for mining on a budget | |
HighestBpHighCost |
Highest-BP crab | Use with high max price | @coinmasterlisting |
HighestMpHighCost |
Highest-MP crab | Use with high max price | @coinmasterlisting |
CheapestCrab |
Cheapest crab | Get a chance at mining revenge | |
HighestBpFromInventory |
Highest-BP from the inventory | Use with a fallback strat | @yigitest |
HighestMpFromInventory |
Highest-MP from the inventory | Use with a fallback strat | @yigitest |
FirstFromInventory |
First available crab in the inventory | Use with a fallback strat | @yigitest |
Sometimes a strategy will not be able to find a suitable crab. For example, a high-cost strategy might return a crab that is too expensive for the user, or an inventory strategy might fail because thereย are no free crabs in the user's inventory.
To account for these cases, you can specify multiple strategies as comma-separated values. For example, if you specify:
USER_X_TEAM_Y_REINFORCE_STRATEGY="HighestBpFromInventory, HighestBpHighCost, HighestBp"Then, the bot will:
- Attempt to self-reinforce with a high-BP crab from the user's inventory.
- If there are no free crabs in the inventory, attempt to borrow the highest-BP crab in the tavern.
- If the highest-BP crab is too expensive, attempt to borrow the highest-BP among the cheapest crabs in the tavern.
The Highest non-inventory strategies support the optional parameter REINFORCEMENT_TO_PICK. Set it to 2, 3, 4 to pick the 2nd, 3rd, 4th-best crab, and so on. Since most bots will compete for the first crab, setting this parameter to a higher-than-1 value can reduce the risk of a reverted transaction. Use this strategy if you constantly fail to get the first crab.
Important: No matter which strategy you choose, the bot will never borrow a crab that is more expensive than REINFORCEMENT_MAX_PRICE.
Creating a strategy is very simple:
- Duplicate a strategy you like and pick a class name.
- Customize the three methods in the class:
query(),process()andpick(). - Make sure your strategy never borrows crabs more expensive than
USER_X_REINFORCEMENT_MAX_PRICE. - Add the strategy name to the list in the file ReinforceStrategyFactory.py
- Configure .env to use your new strategy via the
USER_X_TEAM_Y_REINFORCE_STRATEGYparameter.
To test the strategy withouth sending transactions, use the testMakeReinforceStrategy.py script.