From a44d505bb8fb2bead844f13d27245fe1d1b44606 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 26 Jun 2020 03:27:53 +0100 Subject: [PATCH] Make CJ Sensei card picks appear more random --- houdini/handlers/games/ninja/card.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/houdini/handlers/games/ninja/card.py b/houdini/handlers/games/ninja/card.py index 86efe3c..32bb747 100644 --- a/houdini/handlers/games/ninja/card.py +++ b/houdini/handlers/games/ninja/card.py @@ -208,7 +208,14 @@ class SenseiLogic(CardJitsuLogic): def get_win_card(self, card): self.colors = [] if len(self.colors) >= 6 else self.colors - for card_check in self.penguins[0].server.cards.values(): + + cards_to_pick = self.penguins[0].server.cards + cards_iter = cards_to_pick.values() + cards_end_to_end = itertools.chain(cards_iter, cards_iter) + start_position = random.randint(0, len(cards_to_pick)) + cards_random_start = itertools.islice(cards_end_to_end, start_position, start_position+len(cards_to_pick)) + + for card_check in cards_random_start: if card_check.color not in self.colors and self.beats_card(card_check, card): self.colors.append(card_check.color) return card_check