fork download
  1. import sys
  2. sys.modules[__name__].__dict__.update(dict([(chr(x), []) for x in range(ord('A'), ord('z') + 1)]))
  3.  
  4.  
  5. #プレイヤー 記号
  6. # 1P = 11 2P = 22 1P and 2P =33
  7.  
  8.  
  9. global A1,B1,x
  10. A1=0
  11. B1=0
  12.  
  13. x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
  14.  
  15.  
  16. import random
  17. #A1用 配列 l へ
  18. def Sample01(xx):
  19. return l.append(random.randint(1,6))
  20. #B1用 配列 r へ
  21. def Sample02(xx):
  22. return r.append(random.randint(1,6))
  23.  
  24. # 今回は使わない方法 直接代入
  25. def Sample03():
  26. global A1,B1
  27. A1+=random.randint(1,6)
  28.  
  29. print()
  30.  
  31.  
  32. #test
  33. for i in range(10):
  34. Sample01(A1),Sample02(B1)
  35. print(l,r)
  36.  
  37.  
  38. if sum(l)<=20:
  39. x[sum(l)-1]+=11
  40. elif sum(l)>=20:
  41. sum(l)-l[-1]
  42.  
  43. if sum(l)==20:
  44. print('A1,Y,end')
  45. break
  46.  
  47. if sum(r)<=20:
  48. x[sum(r)-1]+=22
  49. elif sum(r)>=20:
  50. sum(r)-r[-1]
  51.  
  52. if sum(r)==20:
  53. print('B1,Y,end')
  54. break
  55.  
  56. print(x)
  57.  
  58. print(x)
Success #stdin #stdout 0.04s 11880KB
stdin
Standard input is empty
stdout
[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]