# 新手用python写三个骰子玩法

print '-------------你有1000本金---------------'
s=1000 #初始金额
while s>0:
print '------------投骰子游戏开始------------ '
import random
import time
point=[]
for i in range(3):
a=random.randint(1,6)
point.append(a)
i=raw_input('请下注大或者小：')
choices=['大','小']
while i not in choices:
print '输入格式错误,请重新输入'
i=raw_input('请下注大或者小：')
j=int(input('下注金额:'))
while j<=0 or j>s:
print '输入金额有误,请重新输入'
j=int(input('下注金额:'))
if 0<j<=s and i in choices:
if 11<=sum(point)<=18:
time.sleep(1)
print '三个骰子数是',point
time.sleep(2)
print '骰子点数：',sum(point)
time.sleep(1)
print '骰子点数是大'
else:
time.sleep(1)
print '三个骰子数是',point
time.sleep(1)
print '骰子点数：',sum(point)
time.sleep(1)
print '骰子点数是小'

if i=='大' and 11<=sum(point)<=18 or (i=='小' and 3<=sum(point)<=10):
time.sleep(2)
print '你选择的是'+ i +',恭喜你赢了%d元'%j
time.sleep(2)
print '你现在有%d元'%(s+j)
s=s+j
else:
time.sleep(2)
print '你选择的是'+ i +'，哈哈你输了%d元'%j
time.sleep(2)
print '你现在有%d元'%(s-j)
s=s-j
if s==0:
print '游戏结束'
else:
print '输入格式错误'
print '输入金额有误'

©️2019 CSDN 皮肤主题: 终极编程指南 设计师: CSDN官方博客