Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.28 KB | None | 0 0
  1. black = "\033[30m"
  2. green = "\033[32m"
  3. yellow = "\033[33m"
  4. red = "\033[31m"
  5. blue = "\033[34m"
  6. reset = "\033[0m"
  7.  
  8. p1 = f"{red}◉ {reset}"
  9. p2 = f"{blue}◉ {reset}"
  10.  
  11. # Default board reference
  12. d_board = ["0", "1", "2", "3", "4", "5", "6", "7",
  13. "8", "9", "10", "11", "12", "13", "14", "15",
  14. "16", "17", "18", "19", "20", "21", "22", "23",
  15. "24", "25", "26", "27", "28", "29", "30", "31",
  16. "32", "33", "34", "35", "36", "37", "38", "39",
  17. "40", "41", "42", "43", "44", "45", "46", "47",
  18. "48", "49", "50", "51", "52", "53", "54", "55",
  19. "56", "57", "58", "59", "60", "61", "62", "63"]
  20.  
  21.  
  22. available_spots = ["1", "3", "5", "7",
  23. "8", "10", "12", "14",
  24. "17", "19", "21", "23",
  25. "25", "27", "29", "31",
  26. "32", "34", "36", "38",
  27. "41", "43", "45", "47",
  28. "48", "50", "52", "54",
  29. "57", "59", "61", "63"]
  30.  
  31. # Realtime board and reset
  32. board = ["00", p2, "02", p2, "04", p2, "06", p2,
  33. p2, "09", p2, "11", p2, "13", p2, "15",
  34. "16", p2, "18", p2, "20", p2, "22", p2,
  35. "24", "25", "26", "27", "28", "29", "30", "31",
  36. "32", "33", "34", "35", "36", "37", "38", "39",
  37. "40", p1, "42", p1, "44", p1, "46", p1,
  38. p1, "49", p1, "51", p1, "53", p1, "55",
  39. "56", p1, "58", p1, "60", p1, "62", p1]
  40.  
  41. def display_board():
  42. print(f"""■■■■■■■■■■■■■■■■■■■■■■■■■■■
  43. █ {board[0]} {board[1]} {board[2]} {board[3]} {board[4]} {board[5]} {board[6]} {board[7]} █
  44. █ {board[8]} {board[9]} {board[10]} {board[11]} {board[12]} {board[13]} {board[14]} {board[15]} █
  45. █ {board[16]} {board[17]} {board[18]} {board[19]} {board[20]} {board[21]} {board[22]} {board[23]} █
  46. █ {board[24]} {board[25]} {board[26]} {board[27]} {board[28]} {board[29]} {board[30]} {board[31]} █
  47. █ {board[32]} {board[33]} {board[34]} {board[35]} {board[36]} {board[37]} {board[38]} {board[39]} █
  48. █ {board[40]} {board[41]} {board[42]} {board[43]} {board[44]} {board[45]} {board[46]} {board[47]} █
  49. █ {board[48]} {board[49]} {board[50]} {board[51]} {board[52]} {board[53]} {board[54]} {board[55]} █
  50. █ {board[56]} {board[57]} {board[58]} {board[59]} {board[60]} {board[61]} {board[62]} {board[63]} █
  51. ■■■■■■■■■■■■■■■■■■■■■■■■■■■""")
  52.  
  53.  
  54. def check_for_win():
  55. return
  56.  
  57.  
  58. def switch_player():
  59. global current_player
  60. if current_player == p1:
  61. current_player = p2
  62. else:
  63. current_player = p1
  64.  
  65.  
  66. def check_for_win():
  67. return
  68.  
  69.  
  70. def input_turn():
  71. return
  72.  
  73.  
  74. def select_pawn():
  75. selection = input(f"{current_player}'s turn. Select a pawn: ")
  76. while True:
  77. if selection not in available_spots:
  78. selection = input(f"Invalid input. Choose between 1-63: ")
  79. continue
  80. elif board[int(selection)] != current_player:
  81. selection = input(f"choose a player")
  82. continue
  83. elif current_player == p1:
  84. if board[int(selection) - 7] in available_spots and board[int(selection) - 7] is p1 and board[int(selection) - 9] in available_spots and board[int(selection) - 9] is p1:
  85. selection = input(f"Your characters are infront of that pawn. Again: ")
  86. continue
  87. if board[int(selection) - 7] not in available_spots and board[int(selection) - 14] not in available_spots and board[int(selection) - 9] not in available_spots and board[int(selection) - 18] not in available_spots:
  88. selection = input(f"That pawn can't move. Try again: ")
  89. continue
  90. elif current_player == p2:
  91. if board[int(selection) + 7] not in available_spots and board[int(selection) + 14] not in available_spots and board[int(selection) + 9] not in available_spots and board[int(selection) + 18] not in available_spots:
  92. selection = input(f"That pawn can't move. Try again: ")
  93. continue
  94. else:
  95. break
  96.  
  97.  
  98. game_is_active = True
  99. current_player = p1
  100. display_board()
  101.  
  102. while game_is_active:
  103. select_pawn()
  104. input_turn()
  105. display_board()
  106. check_for_win()
  107. switch_player()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement