コード例 #1
0
    def play(self):
        if self._current_pos < len(moves) - 1:
            self._current_pos += 1
        else:
            self._current_pos = 0

        return list(moves.values())[self._current_pos]
コード例 #2
0
    def play(self):
        accepted_input = False
        print("(1) : Rock")
        print("(2) : Paper")
        print("(3) : Scissors")
        print("(4) : Lizard")
        print("(5) : Spock")
        while not(accepted_input):
            choice = eval(input("Enter your move: "))
            if choice <= 0 or choice >= 6:
                print("Invalid move. Please try again.")
            else:
                accepted_input = True

        return list(moves.values())[choice - 1]
コード例 #3
0
 def getRandMove(self):
     return list(moves.values())[random.randint(0, 4)]