Example #1
0
    def _mock_input(self, *args, **kwargs):
        prompt = args[0]
        if prompt.startswith("Wanna play?"):
            # self.old_print(prompt, 'y')
            return "y"
        elif prompt.startswith("Enter dice to keep (no spaces), or (q)uit:"):
            scorers = GameLogic.get_scorers(self.roll)
            keepers = "".join([str(ch) for ch in scorers])
            # self.old_print(prompt, keepers)
            return keepers
        elif prompt.startswith("(r)oll again, (b)ank your points or (q)uit "):
            # _________________________________________________________
            # our average score 9175
            x = GameLogic.get_scorers(self.roll)
            y = GameLogic.calculate_score(x)
            # print(type(x))
            # print("x"*50)
            # print(x)
            # print("x"*50)
            if y < 200:
                # scorers = GameLogic.get_scorers(self.roll)
                # if  keepers < 200:
                return ("r")
            else:
                return "b"


# _________________________________________________________
# return "b"
        else:
            raise ValueError(f"Unrecognized prompt {prompt}")
    def _mock_input(self, *args, **kwargs):
        prompt = args[0]
        if prompt.startswith("Wanna play?"):
            # self.old_print(prompt, 'y')
            return "y"
        elif prompt.startswith("Enter dice to keep (no spaces), or (q)uit:"):
            scorers = GameLogic.get_scorers(self.roll)
            keepers = "".join([str(ch) for ch in scorers])

            if 5 in self.roll or 1 in self.roll:
                """
                The kept dices will only works if the self.roll has 5(s) or 1(s)
                """
                keepers = "".join([str(ch) for ch in scorers])
            # self.old_print(prompt, keepers)
            # self.old_print(keepers)

            return keepers
        elif prompt.startswith("(r)oll again, (b)ank your points or (q)uit "):
            # scorers = GameLogic.get_scorers(self.roll)
            # keepers = "".join([str(ch) for ch in scorers])
            self.old_print(prompt, 'b')
            if 5 in self.roll:
                return ("b")
            else:
                return "r"
        else:
            raise ValueError(f"Unrecognized prompt {prompt}")
 def _mock_input(self, *args):
     prompt = args[0]
     if prompt.startswith("Wanna play?"):
         return "y"
     elif prompt.startswith("Enter dice to keep (no spaces), or (q)uit:"):
         scorers = GameLogic.get_scorers(self.roll)
         keepers = "".join([str(ch) for ch in scorers])
         return keepers
     elif prompt.startswith("(r)oll again, (b)ank your points or (q)uit "):
         return "b"
     else:
         raise ValueError(f"Unrecognized prompt {prompt}")
Example #4
0
 def keep_scorers(self, roll):
     return GameLogic.get_scorers(roll)