Skip to content

Instantly share code, notes, and snippets.

View wolf81's full-sized avatar
🎯
Focusing

Wolfgang Schreurs wolf81

🎯
Focusing
View GitHub Profile
@wolf81
wolf81 / circular_buffer.lua
Created October 19, 2024 14:25 — forked from johndgiese/circular_buffer.lua
Circular Buffer in Lua
-- circular buffer factory for lua
local function rotate_indice(i, n)
return ((i - 1) % n) + 1
end
local circular_buffer = {}
local function circular_buffer:filled()
@wolf81
wolf81 / shadowcasting.js
Created January 16, 2022 16:01 — forked from 370417/shadowcasting.js
Symmetric recursive shadowcasting
/**
* Recursive shadowcasting algorithm.
* This algorithm creates a field of view centered around (x, y).
* Opaque tiles are treated as if they have beveled edges.
* Transparent tiles are visible only if their center is visible, so the
* algorithm is symmetric.
* @param cx - x coordinate of center
* @param cy - y coordinate of center
* @param transparent - function that takes (x, y) as arguments and returns the transparency of that tile
* @param reveal - callback function that reveals the tile at (x, y)
@wolf81
wolf81 / script-template.sh
Created December 15, 2020 13:02 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1
trap cleanup SIGINT SIGTERM ERR EXIT
usage() {
cat <<EOF