import sys sys.modules[__name__].__dict__.update(dict([(chr(x), []) for x in range(ord('A'), ord('z') + 1)])) #プレイヤー 記号 # 1P = 11 2P = 22 1P and 2P =33 global A1,B1,x A1=0 B1=0 x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] import random #A1用 配列 l へ def Sample01(xx): return l.append(random.randint(1,6)) #B1用 配列 r へ def Sample02(xx): return r.append(random.randint(1,6)) # 今回は使わない方法 直接代入 def Sample03(): global A1,B1 A1+=random.randint(1,6) print() #test for i in range(10): Sample01(A1),Sample02(B1) print(l,r) if sum(l)<=20: x[sum(l)-1]+=11 elif sum(l)>=20: sum(l)-l[-1] if sum(l)==20: print('A1,Y,end') break if sum(r)<=20: x[sum(r)-1]+=22 elif sum(r)>=20: sum(r)-r[-1] if sum(r)==20: print('B1,Y,end') break print(x) print(x)
Standard input is empty
[6] [2] [0, 22, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [6, 6] [2, 5] [0, 22, 0, 0, 0, 11, 22, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0] [6, 6, 2] [2, 5, 3] [0, 22, 0, 0, 0, 11, 22, 0, 0, 22, 0, 11, 0, 11, 0, 0, 0, 0, 0, 0] [6, 6, 2, 5] [2, 5, 3, 3] [0, 22, 0, 0, 0, 11, 22, 0, 0, 22, 0, 11, 22, 11, 0, 0, 0, 0, 11, 0] [6, 6, 2, 5, 1] [2, 5, 3, 3, 4] A1,Y,end [0, 22, 0, 0, 0, 11, 22, 0, 0, 22, 0, 11, 22, 11, 0, 0, 0, 0, 11, 11]