python快三游戏_利用Python分析快三骰子游戏

#-*- coding: utf-8 -*-

"""Created on Tue Jan 24 13:07:01 2017

@author: Wayne"""

importrandomimportpandas as pdimportmatplotlib.pylab as pl

list1=[]

list2=[]

m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17= 0,0,0,0,0,0,0,0,0,0,0,0,0,0 #和值遗漏

same1,same2,same3,same4,same5,same6,same = 0,0,0,0,0,0,0 #豹子遗漏

i=0while(i<5000):

a= random.randint(1,6)

b= random.randint(1,6)

c= random.randint(1,6)

list1.append(a)

list1.append(b)

list1.append(c)

list1.append(a+b+c)if a+b+c == 4:

m4=0else:

m4+= 1list1.append(m4)if a+b+c == 5:

m5=0else:

m5+= 1list1.append(m5)if a+b+c == 6:

m6=0else:

m6+= 1list1.append(m6)if a+b+c == 7:

m7=0else:

m7+= 1list1.append(m7)if a+b+c == 8:

m8=0else:

m8+= 1list1.append(m8)if a+b+c == 9:

m9=0else:

m9+= 1list1.append(m9)if a+b+c == 10:

m10=0else:

m10+= 1list1.append(m10)if a+b+c == 11:

m11=0else:

m11+= 1list1.append(m11)if a+b+c == 12:

m12=0else:

m12+= 1list1.append(m12)if a+b+c == 13:

m13=0else:

m13+= 1list1.append(m13)if a+b+c == 14:

m14=0else:

m14+= 1list1.append(m14)if a+b+c == 15:

m15=0else:

m15+= 1list1.append(m15)if a+b+c == 16:

m16=0else:

m16+= 1list1.append(m16)if a+b+c == 17:

m17=0else:

m17+= 1list1.append(m17)if a==b==c==1:

same1=0else:

same1+= 1list1.append(same1)if a==b==c==2:

same2=0else:

same2+= 1list1.append(same2)if a==b==c==3:

same3=0else:

same3+= 1list1.append(same3)if a==b==c==4:

same4=0else:

same4+= 1list1.append(same4)if a==b==c==5:

same5=0else:

same5+= 1list1.append(same5)if a==b==c==6:

same6=0else:

same6+= 1list1.append(same6)if a==b==c:

same=0else:

same+= 1list1.append(same)

list2.append(list1)

list1=[]

i+=1fields= ['a','b','c','sum3','m4','m5','m6','m7','m8','m9','m10','m11','m12','m13','m14','m15','m16','m17','same1','same2','same3','same4','same5','same6','same']

dicedf= pd.DataFrame(list2,columns=fields)

pm1= pl.subplot(221)

pm2= pl.subplot(222)

pm3= pl.subplot(223)

pm4= pl.subplot(224)

pm1.plot(dicedf.index,dicedf.m4,label='m4')

pm2.plot(dicedf.index,dicedf.m5,label='m5')

pm3.plot(dicedf.index,dicedf.m16,label='m16')

pm4.plot(dicedf.index,dicedf.m17,label='m17')

pm1.legend(loc='upper left')

pm2.legend(loc='upper left')

pm3.legend(loc='upper left')

pm4.legend(loc='upper left')'''p1 = pl.subplot(331)

p2 = pl.subplot(332)

p3 = pl.subplot(333)

p4 = pl.subplot(334)

p5 = pl.subplot(335)

p6 = pl.subplot(336)

p7 = pl.subplot(337)

p1.plot(dicedf.index,dicedf.same1,label='same1')

p2.plot(dicedf.index,dicedf.same2,label='same2')

p3.plot(dicedf.index,dicedf.same3,label='same3')

p4.plot(dicedf.index,dicedf.same4,label='same4')

p5.plot(dicedf.index,dicedf.same5,label='same5')

p6.plot(dicedf.index,dicedf.same6,label='same6')

p7.plot(dicedf.index,dicedf.same,label='same')

p1.legend(loc='upper left')

p2.legend(loc='upper left')

p3.legend(loc='upper left')

p4.legend(loc='upper left')

p5.legend(loc='upper left')

p6.legend(loc='upper left')

p7.legend(loc='upper left')'''

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值