This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
"use strict"; | |
var t = { | |
79: (t, e) => { | |
const n = ["#docs-editor-container"], | |
o = ["#docs-editor", ...n], | |
r = ["iframe.docs-texteventtarget-iframe", ".docs-texteventtarget-iframe"], | |
i = [".kix-page", ".docs-page"], | |
s = [".kix-lineview", ".kix-paragraphrenderer"], | |
c = [".kix-lineview-text-block"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def negamax( | |
board: chess.Board, | |
depth: int, | |
player: int, | |
null_move: bool, | |
alpha: float = float("-inf"), | |
beta: float = float("inf")) -> Tuple[Union[int, chess.Move]]: | |
""" | |
This functions receives a board, depth and a player; and it returns | |
the best move for the current board based on how many depths we're looking ahead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def organize_moves(board: chess.Board): | |
""" | |
This function receives a board and it returns a list of all the | |
possible moves for the current player, sorted by importance. | |
Right now we are only sending the moves that are capturing pieces | |
at the starting positions in our array (so we can prune more and earlier). | |
Arguments: | |
- board: chess board state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def negamax( | |
board: chess.Board, | |
depth: int, | |
player: int, | |
alpha: float = float("-inf"), | |
beta: float = float("inf")) -> Tuple[Union[int, chess.Move]]: | |
""" | |
This functions receives a board, depth and a player; and it returns | |
the best move for the current board based on how many depths we're looking ahead | |
and which player is playing. Alpha and beta are used to prune the search tree. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def board_value(board: chess.Board) -> float: | |
""" | |
This functions receives a board and assigns a value to it, it acts as | |
an evaluation function of the current state for this game. It returns | |
Arguments: | |
- board: current board state. | |
Returns: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def minimax( | |
board: chess.Board, | |
depth: int, | |
player: int) -> Tuple[Union[int, chess.Move]]: | |
""" | |
This functions receives a board, depth and a player; and it returns | |
the best move for the current board based on how many depths we're looking ahead | |
and which player is playing. For every move we will do the recursion until | |
leaf nodes and evaluate all leaf lodes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def negamax( | |
board: chess.Board, | |
depth: int, | |
player: int) -> Tuple[Union[int, chess.Move]]: | |
""" | |
This functions receives a board, depth and a player; and it returns | |
the best move for the current board based on how many depths we're looking ahead | |
and which player is playing. For every move we will do the recursion until | |
leaf nodes and evaluate all leaf lodes. | |
OBS: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kafka.admin import KafkaAdminClient, NewTopic | |
admin_client = KafkaAdminClient( | |
bootstrap_servers="localhost:9093", | |
client_id='test' | |
) | |
admin_client.delete_topics(['topic_name']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kafka.admin import KafkaAdminClient, NewTopic | |
admin_client = KafkaAdminClient( | |
bootstrap_servers="localhost:9093", | |
client_id='test' | |
) | |
topic_list = [] | |
topic_list.append(NewTopic(name="il181-topic", num_partitions=3, replication_factor=1)) | |
admin_client.create_topics(new_topics=topic_list, validate_only=False) |
NewerOlder