Skip to content

Instantly share code, notes, and snippets.

(() => {
"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"],
@luccabb
luccabb / null_move.py
Last active December 8, 2021 03:55
Null Move pruning
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
@luccabb
luccabb / move_ordering.py
Created December 8, 2021 03:11
Simple move ordering
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
@luccabb
luccabb / negamax_alpha_beta_pruning.py
Last active February 26, 2023 02:00
Negamax Alpha-Beta pruning
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.
@luccabb
luccabb / evaluation_function.py
Created December 7, 2021 05:58
Simple evaluation function
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:
@luccabb
luccabb / minimax.py
Last active December 7, 2021 04:43
python minimax function
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.
@luccabb
luccabb / negamax.py
Last active December 7, 2021 19:46
Negamax function in python
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.
from kafka.admin import KafkaAdminClient, NewTopic
admin_client = KafkaAdminClient(
bootstrap_servers="localhost:9093",
client_id='test'
)
admin_client.delete_topics(['topic_name'])
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)