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
-- 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() |
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
/** | |
* 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) |
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
#!/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 |