Advertisement
Placido_GDD

Bot_Responses

Jul 23rd, 2022
1,100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.59 KB | None | 0 0
  1. from datetime import datetime
  2.  
  3. import DiceRoller
  4. import DiceRoller as Droller
  5. import random
  6.  
  7.  
  8. def sample_responses(input_text):
  9.     user_message = str(input_text).lower()
  10.  
  11.     # if user_message:
  12.     # return user_message + '!'
  13.     if user_message in "points":
  14.         return "current credit:"
  15.     if user_message.startswith("play"):
  16.         # return user_message + '!'
  17.         input_strings = user_message.split(' ')
  18.         game_type = input_strings[1]
  19.         point_value = int(input_strings[2])
  20.         rand_num = random.randint(2, 12)
  21.         print(rand_num)
  22.         if game_type == 'small':
  23.             if 2 <= rand_num <= 6:
  24.                 return "you win"
  25.             else:
  26.                 return "you lose"
  27.  
  28.         if game_type == 'big':
  29.             if 2 >= rand_num >= 6:
  30.                 return "you win"
  31.             else:
  32.                 return "you lose"
  33.  
  34.         if game_type == 'odd':
  35.             if rand_num % 2 == 0:
  36.  
  37.                 return "you lose"
  38.             else:
  39.  
  40.                 return "you win"
  41.  
  42.         if game_type == 'even':
  43.             if rand_num % 2 == 0:
  44.  
  45.                 return "you win"
  46.             else:
  47.  
  48.                 return "you lose"
  49.  
  50.         values = range(2, 13)
  51.         # print(values)
  52.         strings = ["{:d}".format(x) for x in values]
  53.         # print(strings)
  54.  
  55.         if game_type in strings:
  56.             if game_type == str(rand_num):
  57.  
  58.                 return "you win"
  59.             else:
  60.  
  61.                 return "you lose"
  62.         # return "play " + game_type + "_" + str(point_value)
  63.  
  64.     return "I don't understand"
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement