python简易博彩游戏程序

        这是一个模仿摇骰子游戏,猜大小,三个骰子,随机出现三个数1~6,每个骰子正面朝上的点数相加,3-10为小,11-18为大,赌徒的初始赌金为1000,赌注可以由自己决定。猜中了,就会在原来的基础上获得赌注的金钱,猜错了,就在原来的金额上减去赌注。如果各位发现这些程序有什么bug,欢迎给我留言。

# import random

# def roll_dice(number = 3,points = None):
#     print('<<<<<<<  ROLL THE DICE!  >>>>>>')
#     if points is None:
#         points = []
#     while number>0:
#         point = random.randrange(1,7)
#         points.append(point)
#         number = number-1
#     return points
# def roll_result(total):
#     isBig = 11<= total <= 18
#     isSmall = 3<= total <=10
#     if isBig:
#         return 'Big'
#     elif isSmall:
#         return 'Small'
# def start_game(balance=1000):
#     print('<<<<<<<<   GAME  START!   >>>>>')
#     choices = ['Big','Small']
#     bet_on = input('please enter bet_on,and < '+str(balance) +':')
#     bet_on = int(bet_on)
#     if balance > 0:
#         if bet_on < balance:
#             your_choice = input("Big or Small:")
#             if your_choice in choices:
#                 points = roll_dice()
#                 total = sum(points)
#                 youWin = your_choice == roll_result(total)
#                 if youWin:
#                     balance = balance + bet_on
#                     print('The points are',points,'You Win ! and you balance is '+ str(balance) +'!')

#                 else:
#                     balance = balance - bet_on
#                     print('The points are',points,'You Lose ! and you balance is '+ str(balance) + '!')
#             else:
#                 print('Invalid Words')
#                 start_game()
#         else:
#             print('sorry!you bet_on > '+ str(balance) + '!')
#     else:
#         print('you balance is lestest')
#         print('begin again!')
#         start_game()
# start_game()

 

你可能感兴趣的:(python)