Advertisement
Andrexxelles

Untitled

Aug 15th, 2019
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. import random
  2. import time
  3. object = ["○","✘"]
  4.  
  5. game_stat = {
  6. "a" : "◻",
  7. "b" : "◻",
  8. "c": "◻",
  9. "a1": "◻",
  10. "b1": "◻",
  11. "c1": "◻",
  12. "a2": "◻",
  13. "b2": "◻",
  14. "c2": "◻"
  15. }
  16.  
  17. poll = ["1a","2a","3a","1b","2b","3b","1c","2c","3c"]
  18.  
  19. def play(a=game_stat["a"],b=game_stat["b"],c=game_stat["c"],a1=game_stat["a1"],b1=game_stat["b1"],c1=game_stat["c1"],a2=game_stat["a2"],b2=game_stat["b2"],c2=game_stat["c2"]):
  20. table1 = (" a b c")
  21. table1 +=("\n1|"+a+"|"+b+"|"+c+"|")
  22. table1 +=("\n2|"+a1+"|"+b1+"|"+c1+"|")
  23. table1 +=("\n3|"+a2+"|"+b2+"|"+c2+"|")
  24. print (table1)
  25. print(game_stat)
  26.  
  27. print ("Приветствую в моей игре крестики нолики!!...")
  28. time.sleep(0)
  29. print ("Выберите кем будете ходить, ○ - это 1,✘ - это 2.")
  30. answer = ""
  31.  
  32. while answer != "1" and answer != "2":
  33. answer = input()
  34. if answer == "1":
  35. print ("Вы выбрали : "+object[0]+".")
  36. elif answer == "2":
  37. print ("Вы выбрали : "+object[1]+".")
  38. else:
  39. print ("Неккоректное значение,выберите 1 или 2!")
  40.  
  41. _object = ""
  42.  
  43. if answer == "1":
  44. _object = object[0]
  45. if answer == "2":
  46. _object = object[1]
  47.  
  48. def command():
  49. while True:
  50. voll = input()
  51. if voll in poll:
  52. break
  53. if voll == "1a":
  54. play(a=_object)
  55. del game_stat["a"]
  56. game_stat["a"] =_object
  57. print (game_stat)
  58. if voll == "2a":
  59. play(a1=_object)
  60. game_stat["a1"] = _object
  61. if voll == "3a":
  62. play(a2=_object)
  63. game_stat["a2"] = _object
  64. if voll == "1b":
  65. play(b=_object)
  66. game_stat["b"] = _object
  67. if voll == "2b":
  68. play(b1=_object)
  69. game_stat["b1"] = _object
  70. if voll == "3b":
  71. play(b2=_object)
  72. game_stat["b2"] = _object
  73. if voll == "1c":
  74. play(c=_object)
  75. game_stat["c"] = _object
  76. if voll == "2c":
  77. play(c1=_object)
  78. game_stat["c1"] = _object
  79. if voll == "3c":
  80. play(c2=_object)
  81. game_stat["c2"] = _object
  82.  
  83.  
  84. def start():
  85. q1 = random.randint(1,2)
  86. print ("Вы будете ходить "+str(q1)+"-ым.")
  87. if q1 == 1:
  88. play()
  89. print ("Выберите куда будете ходить")
  90. print ("Сначала цифра а потом буква,пример : 1b.")
  91. voll = ""
  92. command()
  93. start()
  94.  
  95. play()
  96. print (game_stat)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement