Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # TO-DO:
- # check for win, check for tie
- # kings
- # commands - reselect, undo move, reset board
- # random computer
- # force eat option
- black = "\033[30m"
- green = "\033[32m"
- yellow = "\033[33m"
- red = "\033[31m"
- blue = "\033[34m"
- reset = "\033[0m"
- p1 = f"{red}◉ {reset}"
- p2 = f"{blue}◉ {reset}"
- # Default board reference
- d_board = ["0", "1", "2", "3", "4", "5", "6", "7",
- "8", "9", "10", "11", "12", "13", "14", "15",
- "16", "17", "18", "19", "20", "21", "22", "23",
- "24", "25", "26", "27", "28", "29", "30", "31",
- "32", "33", "34", "35", "36", "37", "38", "39",
- "40", "41", "42", "43", "44", "45", "46", "47",
- "48", "49", "50", "51", "52", "53", "54", "55",
- "56", "57", "58", "59", "60", "61", "62", "63"]
- available_spots = ["1", "3", "5", "7",
- "8", "10", "12", "14",
- "17", "19", "21", "23",
- "24", "26", "28", "30",
- "33", "35", "37", "39",
- "40", "42", "44", "46",
- "49", "51", "53", "55",
- "56", "58", "60", "62"]
- # Realtime board and reset
- board = ["0", p2, "2", p2, "4", p2, "6", p2,
- p2, "9", p2, "11", p2, "13", p2, "15",
- "16", p2, "18", p2, "20", p2, "22", p2,
- "24", "25", "26", "27", "28", "29", "30", "31",
- "32", "33", "34", "35", "36", "37", "38", "39",
- p1, "41", p1, "43", p1, "45", p1, "47",
- "48", p1, "50", p1, "52", p1, "54", p1,
- p1, "57", p1, "59", p1, "61", p1, "63"]
- # TESTING BOARD
- boardr = ["0", "1", "2", "3", "4", "5", "6", "7",
- "8", "9", "10", "11", "12", "13", "14", "15",
- "16", "17", "18", p2, "20", p2, "22", "23",
- "24", "25", "26", "27", "28", "29", "30", "31",
- "32", p2, "34", p2, "36", p2, "38", "39",
- "40", "41", "42", "43", "44", "45", "46", "47",
- "48", p2, "50", p2, "52", "53", "54", "55",
- "56", "57", p1, "59", "60", "61", "62", "63"]
- def display_board():
- b1 = []
- for index, each in enumerate(board):
- if each.isdigit():
- if int(each) < 10:
- b1.append(f"0{each}")
- else:
- b1.append(each)
- else:
- b1.append(each)
- b2 = []
- for index, each in enumerate(board):
- if each.isdigit():
- if int(each) < 10:
- b2.append(f"0{each}")
- else:
- b2.append(each)
- if each == p1:
- if index < 10:
- b2.append(f"{red}0{index}{reset}")
- else:
- b2.append(f"{red}{index}{reset}")
- elif each == p2:
- if index < 10:
- b2.append(f"{blue}0{index}{reset}")
- else:
- b2.append(f"{blue}{index}{reset}")
- b3 = []
- for index, each in enumerate(board):
- if selection_process is True:
- if index in possible_pieces:
- if index < 10:
- b3.append(f"{green}0{index}{reset}")
- else:
- b3.append(f"{green}{index}{reset}")
- else:
- if each.isdigit():
- if int(each) < 10:
- b3.append(f"0{each}")
- else:
- b3.append(each)
- if each == p1:
- if index < 10:
- b3.append(f"{red}0{index}{reset}")
- else:
- b3.append(f"{red}{index}{reset}")
- elif each == p2:
- if index < 10:
- b3.append(f"{blue}0{index}{reset}")
- else:
- b3.append(f"{blue}{index}{reset}")
- elif cord_process is True:
- if index == int(selection):
- if index < 10:
- b3.append(f"{yellow}0{index}{reset}")
- else:
- b3.append(f"{yellow}{index}{reset}")
- elif index in fpvision:
- if index < 10:
- b3.append(f"{green}0{index}{reset}")
- else:
- b3.append(f"{green}{index}{reset}")
- else:
- if each.isdigit():
- if int(each) < 10:
- b3.append(f"0{each}")
- else:
- b3.append(each)
- if each == p1:
- if index < 10:
- b3.append(f"{red}0{index}{reset}")
- else:
- b3.append(f"{red}{index}{reset}")
- elif each == p2:
- if index < 10:
- b3.append(f"{blue}0{index}{reset}")
- else:
- b3.append(f"{blue}{index}{reset}")
- else:
- if each.isdigit():
- if int(each) < 10:
- b3.append(f"0{each}")
- else:
- b3.append(each)
- if each == p1:
- if index < 10:
- b3.append(f"{red}0{index}{reset}")
- else:
- b3.append(f"{red}{index}{reset}")
- elif each == p2:
- if index < 10:
- b3.append(f"{blue}0{index}{reset}")
- else:
- b3.append(f"{blue}{index}{reset}")
- print(f"""
- Realtime board Debug
- ■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■■■■■■■■■■■■
- █ {b1[0]} {b1[1]} {b1[2]} {b1[3]} {b1[4]} {b1[5]} {b1[6]} {b1[7]} █ █ {b3[0]} {b3[1]} {b3[2]} {b3[3]} {b3[4]} {b3[5]} {b3[6]} {b3[7]} █
- █ {b1[8]} {b1[9]} {b1[10]} {b1[11]} {b1[12]} {b1[13]} {b1[14]} {b1[15]} █ █ {b3[8]} {b3[9]} {b3[10]} {b3[11]} {b3[12]} {b3[13]} {b3[14]} {b3[15]} █
- █ {b1[16]} {b1[17]} {b1[18]} {b1[19]} {b1[20]} {b1[21]} {b1[22]} {b1[23]} █ █ {b3[16]} {b3[17]} {b3[18]} {b3[19]} {b3[20]} {b3[21]} {b3[22]} {b3[23]} █
- █ {b1[24]} {b1[25]} {b1[26]} {b1[27]} {b1[28]} {b1[29]} {b1[30]} {b1[31]} █ █ {b3[24]} {b3[25]} {b3[26]} {b3[27]} {b3[28]} {b3[29]} {b3[30]} {b3[31]} █
- █ {b1[32]} {b1[33]} {b1[34]} {b1[35]} {b1[36]} {b1[37]} {b1[38]} {b1[39]} █ █ {b3[32]} {b3[33]} {b3[34]} {b3[35]} {b3[36]} {b3[37]} {b3[38]} {b3[39]} █
- █ {b1[40]} {b1[41]} {b1[42]} {b1[43]} {b1[44]} {b1[45]} {b1[46]} {b1[47]} █ █ {b3[40]} {b3[41]} {b3[42]} {b3[43]} {b3[44]} {b3[45]} {b3[46]} {b3[47]} █
- █ {b1[48]} {b1[49]} {b1[50]} {b1[51]} {b1[52]} {b1[53]} {b1[54]} {b1[55]} █ █ {b3[48]} {b3[49]} {b3[50]} {b3[51]} {b3[52]} {b3[53]} {b3[54]} {b3[55]} █
- █ {b1[56]} {b1[57]} {b1[58]} {b1[59]} {b1[60]} {b1[61]} {b1[62]} {b1[63]} █ █ {b3[56]} {b3[57]} {b3[58]} {b3[59]} {b3[60]} {b3[61]} {b3[62]} {b3[63]} █
- ■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■■■■■■■■■■■■""")
- def check_for_win():
- return
- def switch_player():
- global current_player
- if current_player == p1:
- current_player = p2
- else:
- current_player = p1
- def input_turn():
- return
- def can_move(pawn):
- pawn = int(pawn)
- if d_board[pawn] not in available_spots:
- return False
- if current_player == p1:
- if pawn - 7 > 0:
- if board[pawn - 7] in available_spots or board[pawn - 9] in available_spots:
- return True
- if d_board[pawn - 7] not in available_spots or board[pawn - 7] == p1:
- if board[pawn - 9] == p2:
- if board[pawn - 18] in available_spots:
- return True
- else:
- return False
- else:
- return False
- elif board[pawn - 7] == p2:
- if board[pawn - 14] in available_spots:
- return True
- elif board[pawn - 9] == p2:
- if board[pawn - 18] in available_spots:
- return True
- else:
- return False
- else:
- return False
- return False
- if current_player == p2:
- if pawn + 7 < 63:
- if board[pawn + 7] in available_spots or board[pawn + 9] in available_spots:
- return True
- if d_board[pawn + 7] not in available_spots or board[pawn + 7] == p2:
- if board[pawn + 9] == p1:
- if board[pawn + 18] in available_spots:
- return True
- else:
- return False
- else:
- return False
- elif board[pawn + 7] == p1:
- if board[pawn + 14] in available_spots:
- return True
- elif board[pawn + 9] == p1:
- if board[pawn + 18] in available_spots:
- return True
- else:
- return False
- else:
- return False
- return False
- def can_eat(pos):
- if pos not in available_spots:
- return False
- pos = int(pos)
- if current_player == p1:
- if d_board[pos - 7] in available_spots and board[pos - 7] == p2:
- if board[pos - 14] in available_spots:
- return True
- if d_board[pos - 9] in available_spots and board[pos - 9] == p2:
- if board[pos - 18] in available_spots:
- return True
- return False
- if current_player == p2:
- if d_board[pos + 7] in available_spots and board[pos + 7] == p1:
- if board[pos + 14] in available_spots:
- return True
- if d_board[pos + 9] in available_spots and board[pos + 9] == p1:
- if board[pos + 18] in available_spots:
- return True
- return False
- selection = None
- selection_process = False
- cord_process = False
- pvision = []
- epvision = []
- fpvision = []
- possible_pieces = []
- def select_pawn():
- global board, selection_process, possible_pieces, selection, cord_process, pvision, epvision, fpvision
- # possible_pieces = []
- # for index, each in enumerate(board):
- # if each == current_player and can_move(index):
- # possible_pieces.append(index)
- # print(f"possible_pieces = {possible_pieces}")
- # simplified:
- possible_pieces = [index for index, each in enumerate(board) if each == current_player and can_move(index)]
- selection_process = True
- display_board()
- selection = input(f"{current_player}'s turn. Select a pawn: ")
- while True:
- if not selection.isdigit():
- selection = input(f"Invalid input. Possible options: {green}{possible_pieces}{reset} Try again: ")
- continue
- if int(selection) not in possible_pieces:
- selection = input(f"Invalid input. Possible options: {green}{possible_pieces}{reset} Try again: ")
- continue
- else:
- break
- selection.lstrip('0')
- selection_process = False
- # PVISION: peripheral vision possible moves including illegal jumps
- if current_player == p1:
- calclist = [f"{int(selection) - 7}", f"{int(selection) - 14}", f"{int(selection) - 28}",
- f"{int(selection) - 42}", f"{int(selection) - 9}", f"{int(selection) - 18}",
- f"{int(selection) - 36}", f"{int(selection) - 54}", f"{int(selection) - 32}",
- f"{int(selection) - 50}", f"{int(selection) - 46}"]
- elif current_player == p2:
- calclist = [f"{int(selection) + 7}", f"{int(selection) + 14}", f"{int(selection) + 28}",
- f"{int(selection) + 42}", f"{int(selection) + 9}", f"{int(selection) + 18}",
- f"{int(selection) + 36}", f"{int(selection) + 54}", f"{int(selection) + 32}",
- f"{int(selection) + 50}", f"{int(selection) + 46}"]
- else:
- calclist = ["error"]
- # pvision = []
- # for each in calclist:
- # if each in available_spots and board[int(each)] in available_spots:
- # pvision.append(int(each))
- # shortened:
- pvision = [int(each) for each in calclist if each in available_spots and board[int(each)] in available_spots]
- pvision.sort()
- # EPIVISION: editted pvision with can_eat
- epvision = []
- for each in pvision:
- if current_player == p1:
- if not can_eat(selection):
- if int(each) > (int(selection) - 10):
- epvision.append(each)
- else:
- epvision.append(each)
- elif current_player == p2:
- if not can_eat(selection):
- if int(each) < (int(selection) + 10):
- epvision.append(each)
- else:
- epvision.append(each)
- # FPVISION: final version of epvision, shows the only possible moves allowed by selected pawn.
- fpvision = []
- for each in epvision:
- if current_player == p1:
- if each == int(selection) - 7:
- fpvision.append(each)
- elif each == int(selection) - 14:
- if board[int(selection) - 7] == p2:
- fpvision.append(each)
- elif each == int(selection) - 28:
- if board[int(selection) - 21] == p2 and board[int(selection) - 7] == p2:
- fpvision.append(each)
- elif each == int(selection) - 42:
- if board[int(selection) - 35] == p2 and board[int(selection) - 21] == p2 and board[int(selection) - 7] == p2:
- fpvision.append(each)
- elif each == int(selection) - 9:
- fpvision.append(each)
- elif each == int(selection) - 18:
- if board[int(selection) - 9] == p2:
- fpvision.append(each)
- elif each == int(selection) - 36:
- if board[int(selection) - 27] == p2 and board[int(selection) - 9] == p2:
- fpvision.append(each)
- elif each == int(selection) - 54:
- if board[int(selection) - 45] == p2 and board[int(selection) - 27] == p2 and board[int(selection) - 9] == p2:
- fpvision.append(each)
- elif each == int(selection) - 32:
- if (int(selection) - 14 in epvision and board[int(selection) - 7] == p2 and board[
- int(selection) - 14 - 9] == p2) or (
- int(selection) - 18 in epvision and board[int(selection) - 9] == p2 and board[int(selection) - 18 - 7] == p2):
- fpvision.append(each)
- elif each == int(selection) - 50:
- # if (each - 32 available^ and board[int(selection) - 41] == p2) or (each - 36 available^ and board[int(selection) - 43] == p2):
- if (int(selection) - 14 in epvision and board[int(selection) - 7] == p2 and board[
- int(selection) - 14 - 9] == p2) or (
- int(selection) - 18 in epvision and board[int(selection) - 9] == p2 and board[int(selection) - 18 - 7] == p2):
- if board[int(selection) - 41] == p2:
- fpvision.append(each)
- if board[int(selection) - 27] == p2 and board[int(selection) - 9] == p2:
- if board[int(selection) - 43] == p2:
- fpvision.append(each)
- elif each == int(selection) - 46:
- # if (each - 32 available^ and board[int(selection) - 39] == p2) or (each - 28 available^ and board[int(selection) - 37] == p2):
- if (int(selection) - 14 in epvision and board[int(selection) - 7] == p2 and board[
- int(selection) - 14 - 9] == p2) or (
- int(selection) - 18 in epvision and board[int(selection) - 9] == p2 and board[int(selection) - 18 - 7] == p2):
- if board[int(selection) - 39] == p2:
- fpvision.append(each)
- if board[int(selection) - 21] == p2 and board[int(selection) - 7] == p2:
- if board[int(selection) - 37] == p2:
- fpvision.append(each)
- elif current_player == p2:
- if each == int(selection) + 7:
- fpvision.append(each)
- elif each == int(selection) + 14:
- if board[int(selection) + 7] == p1:
- fpvision.append(each)
- elif each == int(selection) + 28:
- if board[int(selection) + 21] == p1 and board[int(selection) + 7] == p1:
- fpvision.append(each)
- elif each == int(selection) + 42:
- if board[int(selection) + 35] == p1 and board[int(selection) + 21] == p1 and board[int(selection) + 7] == p1:
- fpvision.append(each)
- elif each == int(selection) + 9:
- fpvision.append(each)
- elif each == int(selection) + 18:
- if board[int(selection) + 9] == p1:
- fpvision.append(each)
- elif each == int(selection) + 36:
- if board[int(selection) + 27] == p1 and board[int(selection) + 9] == p1:
- fpvision.append(each)
- elif each == int(selection) + 54:
- if board[int(selection) + 45] == p1 and board[int(selection) + 27] == p1 and board[int(selection) + 9] == p1:
- fpvision.append(each)
- elif each == int(selection) + 32:
- if (int(selection) + 14 in epvision and board[int(selection) + 7] == p1 and board[
- int(selection) + 14 + 9] == p1) or (
- int(selection) + 18 in epvision and board[int(selection) + 9] == p1 and board[int(selection) + 18 + 7] == p1):
- fpvision.append(each)
- elif each == int(selection) + 50:
- # if (each + 32 available^ and board[int(selection) + 41] == p1) or (each + 36 available^ and board[int(selection) + 43] == p1):
- if (int(selection) + 14 in epvision and board[int(selection) + 7] == p1 and board[
- int(selection) + 14 + 9] == p1) or (
- int(selection) + 18 in epvision and board[int(selection) + 9] == p1 and board[int(selection) + 18 + 7] == p1):
- if board[int(selection) + 41] == p1:
- fpvision.append(each)
- if board[int(selection) + 27] == p1 and board[int(selection) + 9] == p1:
- if board[int(selection) + 43] == p1:
- fpvision.append(each)
- elif each == int(selection) + 46:
- # if (each + 32 available^ and board[int(selection) + 39] == p1) or (each + 28 available^ and board[int(selection) + 37] == p1):
- if (int(selection) + 14 in epvision and board[int(selection) + 7] == p1 and board[
- int(selection) + 14 + 9] == p1) or (
- int(selection) + 18 in epvision and board[int(selection) + 9] == p1 and board[int(selection) + 18 + 7] == p1):
- if board[int(selection) + 39] == p1:
- fpvision.append(each)
- if board[int(selection) + 21] == p1 and board[int(selection) + 7] == p1:
- if board[int(selection) + 37] == p1:
- fpvision.append(each)
- cord_process = True
- display_board()
- print(f"{current_player} selected pawn at {yellow}{selection}{reset}. Can eat: {can_eat(selection)}")
- print(f"P {pvision}")
- print(f"EP {epvision}")
- print(f"FV {fpvision}")
- cord = input(f"Select a coordinate: ")
- while True:
- if not cord.isdigit() or cord not in available_spots:
- cord = input(f"Cord not in {green}{fpvision}{reset}. Try again: ")
- continue
- elif int(cord) not in fpvision:
- cord = input(f"Cord not in {green}{fpvision}{reset}. Try again: ")
- continue
- else:
- break
- # eating process #####################################################################
- if current_player == p1:
- if int(cord) == int(selection) - 7:
- board[int(cord)] = current_player
- elif int(cord) == int(selection) - 14:
- board[int(selection) - 7] = d_board[int(selection) - 7]
- board[int(cord)] = current_player
- elif int(cord) == int(selection) - 28:
- board[int(selection) - 21] = d_board[int(selection) - 21]
- board[int(selection) - 7] = d_board[int(selection) - 7]
- board[int(cord)] = current_player
- elif int(cord) == int(selection) - 42:
- board[int(selection) - 35] = d_board[int(selection) - 35]
- board[int(selection) - 21] = d_board[int(selection) - 21]
- board[int(selection) - 7] = d_board[int(selection) - 7]
- #####
- elif int(cord) == int(selection) - 9:
- board[int(cord)] = current_player
- elif int(cord) == int(selection) - 18:
- board[int(selection) - 9] = d_board[int(selection) - 9]
- board[int(cord)] = current_player
- elif int(cord) == int(selection) - 36:
- board[int(selection) - 27] = d_board[int(selection) - 27]
- board[int(selection) - 9] = d_board[int(selection) - 9]
- board[int(cord)] = current_player
- elif int(cord) == int(selection) - 54:
- board[int(selection) - 45] = d_board[int(selection) - 45]
- board[int(selection) - 27] = d_board[int(selection) - 27]
- board[int(selection) - 9] = d_board[int(selection) - 9]
- # diamond
- elif int(cord) == int(selection) - 32:
- left_route = (int(selection) - 14) in fpvision and board[int(selection) - 23] == p2
- right_route = (int(selection) - 18) in fpvision and board[int(selection) - 25] == p2
- if left_route and right_route:
- choice = None
- while choice not in [f"{int(selection) - 14}", f"{int(selection) - 18}"]:
- choice = input(f"Choose between these routes: through {green}{int(selection) - 14}{reset} OR through {green}{int(selection) - 18}{reset}: ")
- if int(choice) == int(selection) - 14:
- right_route = False
- elif int(choice) == int(selection) - 18:
- left_route = False
- if left_route:
- board[int(selection) - 7] = d_board[int(selection) - 7]
- board[int(selection) - 23] = d_board[int(selection) - 23]
- board[int(cord)] = current_player
- elif right_route:
- board[int(selection) - 9] = d_board[int(selection) - 9]
- board[int(selection) - 25] = d_board[int(selection) - 25]
- board[int(cord)] = current_player
- # top left of heart
- elif int(cord) == int(selection) - 50:
- left_route = (int(selection) - 36) in fpvision and board[int(selection) - 43] == p2
- right_route = (int(selection) - 32) in fpvision and board[int(selection) - 41] == p2
- if left_route and right_route:
- choice = None
- while choice not in [f"{int(selection) - 36}", f"{int(selection) - 32}"]:
- choice = input(f"Choose between these routes: through {green}{int(selection) - 36}{reset} OR through {green}{int(selection) - 32}{reset}: ")
- if int(choice) == int(selection) - 36:
- right_route = False
- elif int(choice) == int(selection) - 32:
- left_route = False
- if left_route:
- board[int(selection) - 43] = d_board[int(selection) - 43]
- board[int(selection) - 27] = d_board[int(selection) - 27]
- board[int(selection) - 9] = d_board[int(selection) - 9]
- board[int(cord)] = current_player
- elif right_route:
- left_route = (int(selection) - 14) in fpvision and board[int(selection) - 23] == p2
- right_route = (int(selection) - 18) in fpvision and board[int(selection) - 25] == p2
- if left_route and right_route:
- choice = None
- while choice not in [f"{int(selection) - 14}", f"{int(selection) - 18}"]:
- choice = input(f"Choose between these routes: through {green}{int(selection) - 14}{reset} OR through {green}{int(selection) - 18}{reset}: ")
- if int(choice) == int(selection) - 14:
- right_route = False
- elif int(choice) == int(selection) - 18:
- left_route = False
- if left_route:
- board[int(selection) - 41] = d_board[int(selection) - 41]
- board[int(selection) - 7] = d_board[int(selection) - 7]
- board[int(selection) - 23] = d_board[int(selection) - 23]
- board[int(cord)] = current_player
- elif right_route:
- board[int(selection) - 41] = d_board[int(selection) - 41]
- board[int(selection) - 9] = d_board[int(selection) - 9]
- board[int(selection) - 25] = d_board[int(selection) - 25]
- board[int(cord)] = current_player
- # top right of heart
- elif int(cord) == int(selection) - 46:
- # long way to right
- right_route = (int(selection) - 28) in pvision and board[int(selection) - 37] == p2
- # diamond way
- left_route = (int(selection) - 32) in pvision and board[int(selection) - 39] == p2
- if left_route and right_route:
- choice = None
- while choice not in [f"{int(selection) - 28}", f"{int(selection) - 32}"]:
- choice = input(f"Choose between these routes: through {green}{int(selection) - 28}{reset} OR through {green}{int(selection) - 32}{reset}: ")
- if int(choice) == int(selection) - 28:
- left_route = False
- elif int(choice) == int(selection) - 32:
- right_route = False
- if right_route:
- board[int(selection) - 37] = d_board[int(selection) - 37]
- board[int(selection) - 21] = d_board[int(selection) - 21]
- board[int(selection) - 7] = d_board[int(selection) - 7]
- board[int(cord)] = current_player
- elif left_route:
- left_route = (int(selection) - 14) in fpvision and board[int(selection) - 23] == p2
- right_route = (int(selection) - 18) in fpvision and board[int(selection) - 25] == p2
- if left_route and right_route:
- choice = None
- while choice not in [f"{int(selection) - 14}", f"{int(selection) - 18}"]:
- choice = input(f"Choose between these routes: through {green}{int(selection) - 14}{reset} OR through {green}{int(selection) - 18}{reset}: ")
- if int(choice) == int(selection) - 14:
- right_route = False
- elif int(choice) == int(selection) - 18:
- left_route = False
- if left_route:
- board[int(selection) - 39] = d_board[int(selection) - 39]
- board[int(selection) - 7] = d_board[int(selection) - 7]
- board[int(selection) - 23] = d_board[int(selection) - 23]
- board[int(cord)] = current_player
- elif right_route:
- board[int(selection) - 39] = d_board[int(selection) - 39]
- board[int(selection) - 9] = d_board[int(selection) - 9]
- board[int(selection) - 25] = d_board[int(selection) - 25]
- board[int(cord)] = current_player
- else:
- board[int(cord)] = current_player
- print(f"{red} WARNING >> End of elif eating <<")
- #################################################################################### p2 eating process:
- elif current_player == p2:
- if int(cord) == int(selection) + 7:
- board[int(cord)] = current_player
- elif int(cord) == int(selection) + 14:
- board[int(selection) + 7] = d_board[int(selection) + 7]
- board[int(cord)] = current_player
- elif int(cord) == int(selection) + 28:
- board[int(selection) + 21] = d_board[int(selection) + 21]
- board[int(selection) + 7] = d_board[int(selection) + 7]
- board[int(cord)] = current_player
- elif int(cord) == int(selection) + 42:
- board[int(selection) + 35] = d_board[int(selection) + 35]
- board[int(selection) + 21] = d_board[int(selection) + 21]
- board[int(selection) + 7] = d_board[int(selection) + 7]
- #####
- elif int(cord) == int(selection) + 9:
- board[int(cord)] = current_player
- elif int(cord) == int(selection) + 18:
- board[int(selection) + 9] = d_board[int(selection) + 9]
- board[int(cord)] = current_player
- elif int(cord) == int(selection) + 36:
- board[int(selection) + 27] = d_board[int(selection) + 27]
- board[int(selection) + 9] = d_board[int(selection) + 9]
- board[int(cord)] = current_player
- elif int(cord) == int(selection) + 54:
- board[int(selection) + 45] = d_board[int(selection) + 45]
- board[int(selection) + 27] = d_board[int(selection) + 27]
- board[int(selection) + 9] = d_board[int(selection) + 9]
- # diamond
- elif int(cord) == int(selection) + 32:
- left_route = (int(selection) + 14) in fpvision and board[int(selection) + 23] == p1
- right_route = (int(selection) + 18) in fpvision and board[int(selection) + 25] == p1
- if left_route and right_route:
- choice = None
- while choice not in [f"{int(selection) + 14}", f"{int(selection) + 18}"]:
- choice = input(f"Choose between these routes: through {green}{int(selection) + 14}{reset} OR through {green}{int(selection) + 18}{reset}: ")
- if int(choice) == int(selection) + 14:
- right_route = False
- elif int(choice) == int(selection) + 18:
- left_route = False
- if left_route:
- board[int(selection) + 7] = d_board[int(selection) + 7]
- board[int(selection) + 23] = d_board[int(selection) + 23]
- board[int(cord)] = current_player
- elif right_route:
- board[int(selection) + 9] = d_board[int(selection) + 9]
- board[int(selection) + 25] = d_board[int(selection) + 25]
- board[int(cord)] = current_player
- # top left of heart
- elif int(cord) == int(selection) + 50:
- left_route = (int(selection) + 36) in fpvision and board[int(selection) + 43] == p1
- right_route = (int(selection) + 32) in fpvision and board[int(selection) + 41] == p1
- if left_route and right_route:
- choice = None
- while choice not in [f"{int(selection) + 36}", f"{int(selection) + 32}"]:
- choice = input(f"Choose between these routes: through {green}{int(selection) + 36}{reset} OR through {green}{int(selection) + 32}{reset}: ")
- if int(choice) == int(selection) + 36:
- right_route = False
- elif int(choice) == int(selection) + 32:
- left_route = False
- if left_route:
- board[int(selection) + 43] = d_board[int(selection) + 43]
- board[int(selection) + 27] = d_board[int(selection) + 27]
- board[int(selection) + 9] = d_board[int(selection) + 9]
- board[int(cord)] = current_player
- elif right_route:
- left_route = (int(selection) + 14) in fpvision and board[int(selection) + 23] == p1
- right_route = (int(selection) + 18) in fpvision and board[int(selection) + 25] == p1
- if left_route and right_route:
- choice = None
- while choice not in [f"{int(selection) + 14}", f"{int(selection) + 18}"]:
- choice = input(f"Choose between these routes: through {green}{int(selection) + 14}{reset} OR through {green}{int(selection) + 18}{reset}: ")
- if int(choice) == int(selection) + 14:
- right_route = False
- elif int(choice) == int(selection) + 18:
- left_route = False
- if left_route:
- board[int(selection) + 41] = d_board[int(selection) + 41]
- board[int(selection) + 7] = d_board[int(selection) + 7]
- board[int(selection) + 23] = d_board[int(selection) + 23]
- board[int(cord)] = current_player
- elif right_route:
- board[int(selection) + 41] = d_board[int(selection) + 41]
- board[int(selection) + 9] = d_board[int(selection) + 9]
- board[int(selection) + 25] = d_board[int(selection) + 25]
- board[int(cord)] = current_player
- # top right of heart
- elif int(cord) == int(selection) + 46:
- # long way to right
- right_route = (int(selection) + 28) in pvision and board[int(selection) + 37] == p1
- # diamond way
- left_route = (int(selection) + 32) in pvision and board[int(selection) + 39] == p1
- if left_route and right_route:
- choice = None
- while choice not in [f"{int(selection) + 28}", f"{int(selection) + 32}"]:
- choice = input(f"Choose between these routes: through {green}{int(selection) + 28}{reset} OR through {green}{int(selection) + 32}{reset}: ")
- if int(choice) == int(selection) + 28:
- left_route = False
- elif int(choice) == int(selection) + 32:
- right_route = False
- if right_route:
- board[int(selection) + 37] = d_board[int(selection) + 37]
- board[int(selection) + 21] = d_board[int(selection) + 21]
- board[int(selection) + 7] = d_board[int(selection) + 7]
- board[int(cord)] = current_player
- elif left_route:
- left_route = (int(selection) + 14) in fpvision and board[int(selection) + 23] == p1
- right_route = (int(selection) + 18) in fpvision and board[int(selection) + 25] == p1
- if left_route and right_route:
- choice = None
- while choice not in [f"{int(selection) + 14}", f"{int(selection) + 18}"]:
- choice = input(f"Choose between these routes: through {green}{int(selection) + 14}{reset} OR through {green}{int(selection) + 18}{reset}: ")
- if int(choice) == int(selection) + 14:
- right_route = False
- elif int(choice) == int(selection) + 18:
- left_route = False
- if left_route:
- board[int(selection) + 39] = d_board[int(selection) + 39]
- board[int(selection) + 7] = d_board[int(selection) + 7]
- board[int(selection) + 23] = d_board[int(selection) + 23]
- board[int(cord)] = current_player
- elif right_route:
- board[int(selection) + 39] = d_board[int(selection) + 39]
- board[int(selection) + 9] = d_board[int(selection) + 9]
- board[int(selection) + 25] = d_board[int(selection) + 25]
- board[int(cord)] = current_player
- else:
- board[int(cord)] = current_player
- print(f"{red} WARNING >> End of elif eating <<")
- board[int(selection)] = d_board[int(selection)]
- cord_process = False
- game_is_active = True
- current_player = p1
- while game_is_active:
- select_pawn()
- check_for_win()
- switch_player()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement