Skip to content

Commit

Permalink
Merge pull request #454 from honomoa/feature/strategy_number
Browse files Browse the repository at this point in the history
Add strategy NUMBER_X
  • Loading branch information
rdavydov authored Feb 29, 2024
2 parents 06c6555 + a353c0c commit 28d881a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,14 @@ Allowed values for `chat` are:
- **PERCENTAGE**: Select the option with the highest percentage based on odds (It's the same that show Twitch) - Should be the same as select LOWEST_ODDS
- **SMART_MONEY**: Select the option with the highest points placed. [#331](https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2/issues/331)
- **SMART**: If the majority in percent chose an option, then follow the other users, otherwise select the option with the highest odds
- **NUMBER_1**: Always select the 1st option, BLUE side if there are only two options
- **NUMBER_2**: Always select the 2nd option, PINK side if there are only two options
- **NUMBER_3**: Always select the 3rd option.
- **NUMBER_4**: Always select the 4th option.
- **NUMBER_5**: Always select the 5th option.
- **NUMBER_6**: Always select the 6th option.
- **NUMBER_7**: Always select the 7th option.
- **NUMBER_8**: Always select the 8th option.

![Screenshot](https://raw.githubusercontent.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2/master/assets/prediction.png)

Expand Down
30 changes: 30 additions & 0 deletions TwitchChannelPointsMiner/classes/entities/Bet.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ class Strategy(Enum):
PERCENTAGE = auto()
SMART_MONEY = auto()
SMART = auto()
NUMBER_1 = auto()
NUMBER_2 = auto()
NUMBER_3 = auto()
NUMBER_4 = auto()
NUMBER_5 = auto()
NUMBER_6 = auto()
NUMBER_7 = auto()
NUMBER_8 = auto()

def __str__(self):
return self.name
Expand Down Expand Up @@ -235,6 +243,12 @@ def __return_choice(self, key) -> int:
largest = index
return largest

def __return_number_choice(self, number) -> int:
if (len(self.outcomes) > number):
return number
else:
return 0

def skip(self) -> bool:
if self.settings.filter_condition is not None:
# key == by , condition == where
Expand Down Expand Up @@ -283,6 +297,22 @@ def calculate(self, balance: int) -> dict:
self.decision["choice"] = self.__return_choice(OutcomeKeys.ODDS_PERCENTAGE)
elif self.settings.strategy == Strategy.SMART_MONEY:
self.decision["choice"] = self.__return_choice(OutcomeKeys.TOP_POINTS)
elif self.settings.strategy == Strategy.NUMBER_1:
self.decision["choice"] = self.__return_number_choice(0)
elif self.settings.strategy == Strategy.NUMBER_2:
self.decision["choice"] = self.__return_number_choice(1)
elif self.settings.strategy == Strategy.NUMBER_3:
self.decision["choice"] = self.__return_number_choice(2)
elif self.settings.strategy == Strategy.NUMBER_4:
self.decision["choice"] = self.__return_number_choice(3)
elif self.settings.strategy == Strategy.NUMBER_5:
self.decision["choice"] = self.__return_number_choice(4)
elif self.settings.strategy == Strategy.NUMBER_6:
self.decision["choice"] = self.__return_number_choice(5)
elif self.settings.strategy == Strategy.NUMBER_7:
self.decision["choice"] = self.__return_number_choice(6)
elif self.settings.strategy == Strategy.NUMBER_8:
self.decision["choice"] = self.__return_number_choice(7)
elif self.settings.strategy == Strategy.SMART:
difference = abs(
self.outcomes[0][OutcomeKeys.PERCENTAGE_USERS]
Expand Down

0 comments on commit 28d881a

Please sign in to comment.