Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if "7Q/8/8/5k2/8/8/8/K7 w - -" in AR:
- print(f"{AR['7Q/8/8/5k2/8/8/8/K7 w - -']}")
- if "" in AR:
- print("G2")
- if "" in AR:
- print("G3")
- if "" in AR:
- print("G4")
- if "" in AR:
- print("G5")
- if "" in AR:
- print("G6")
- current_fen = start_fen
- simplified_current_fen = simplify_fen(current_fen)
- simplified_current_fen1 = simplified_current_fen
- optimal_moves = [start_fen]
- while True:
- board = CustomBoard(current_fen)
- if board.is_checkmate():
- print("Mat detekován!2")
- break
- # Opravená část
- half_move_clock = current_fen.split()[-2]
- if board.is_insufficient_material() or (half_move_clock != '-' and int(half_move_clock) >= 100):
- if board.is_insufficient_material():
- print("Nedostatečný materiál detekován!")
- else:
- print("Remíza pravidlem 50 tahů detekována!")
- AR[simplified_current_fen] = (0, 'drawing') # Aktualizujeme AR pro tuto pozici
- break
- if simplified_current_fen not in AR:
- print(f"Pozice {simplified_current_fen} není v AR.")
- break
- current_value = AR[simplified_current_fen][0]
- if current_value == 0:
- print("Remíza dosažena!")
- break
- hod = -2000 if current_value > 0 else 2000
- best_fen = None
- for move in board.legal_moves:
- board.push(move)
- POZ2 = board.fen()
- simplified_POZ2 = simplify_fen(POZ2)
- if simplified_POZ2 in AR:
- hod2 = -AR[simplified_POZ2][0]
- if current_value > 0: # Silnější hráč
- if hod2 > hod:
- hod = hod2
- best_fen = simplified_POZ2
- else: # Slabší hráč
- if hod2 < hod:
- hod = hod2
- best_fen = simplified_POZ2
- board.pop()
- if best_fen is None:
- print("Žádný další tah nebyl nalezen.")
- break
- optimal_moves.append(best_fen)
- current_fen = best_fen
- simplified_current_fen = simplify_fen(current_fen)
- print("\nOptimální tahy1:")
- for fen in reversed(optimal_moves):
- print_board(fen)
- hodnota, typ_pozice = AR[simplify_fen(fen)]
- print(f"Hodnota: {hodnota}, Typ: {typ_pozice}")
- print(fen)
- print("\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement