Skip to content

Instantly share code, notes, and snippets.

View luccabb's full-sized avatar

luccabb luccabb

View GitHub Profile
@luccabb
luccabb / search.sh
Created May 29, 2025 02:36
search prefixes on files
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -lt 3 ]]; then
echo "Usage: $0 prefix1 [prefix2 …] -- file1 [file2 …]" >&2
exit 1
fi
# collect prefixes until “--”
prefixes=()
FROM ubuntu:20.04
ENV TZ=America/Pacific
RUN apt-get update && apt-get install -y tzdata && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y \
build-essential \
git \
(() => {
"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.