import numpy as np
a=[0,1,1,1,1]
m=[0,1500,1500,1500,1500]
price=[0,0,60,0,60,0,200,100,0,100,120,0,140,150,140,160,200,180,0,180,200,0,220,0,220,240,200,260,260,150,280,0,300,300,0,320,200,0,350,0,400,0]
rent=[0]
for i in range(40):
rent.append(0)
rent[2]=2
rent[4]=4
rent[7]=6
rent[9]=6
rent[10]=8
rent[12]=10
rent[14]=10
rent[15]=12
rent[17]=14
rent[19]=14
rent[20]=16
rent[22]=18
rent[24]=18
rent[25]=20
rent[27]=22
rent[28]=22
rent[30]=24
rent[32]=26
rent[33]=26
rent[35]=28
rent[38]=35
rent[40]=50
x=[0]
for i in range(40):
x.append(0)
def dice():
don=[1,2,3,4,5,6]
d1=np.random.choice(don)
d2=np.random.choice(don)
return d1+d2
mode=4
delta=0
while delta<40:
mode=mode+1
if mode>4:
mode=1
a[mode]=a[mode]+dice()
if a[mode]>40:
a[mode]=a[mode]-40
m[mode]=m[mode]+200
a1=a[mode]
h=0
if x[a1]==0:
h=h+1
if price[a1]>0:
h=h+1
if h==2:
m[mode]=m[mode]-price[a1]
x[a1]=mode
h=0
m1=x[a1]
if x[a1]>0:
h=100
if m1==mode:
h=0
if h>50:
m[mode]=m[mode]-rent[a1]
m[m1]=m[m1]+rent[a1]
for i in range(1,5):
if m[i]<0:
delta=100
print(m)
最終更新:2018年01月03日 01:08