ludic/packages/ludic.tracks/config.ludic
Orkuncakilkaya 63e29f024c refactor(packages): the mechanic packages use ludic_base only, and ask through ports
ludic.clock, .effects, .inventory, .wallet, .weather and .tracks say
'uses ludic_base' (ludic.base uses nothing). ClockWorld, PackRules,
WeatherWorld and TracksWorld are export ports whose defaults are the old
fallbacks; clock_bind, inv_bind, weather_bind and tracks_bind are gone,
and the tests bind their fakes. The base README's toy does the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 05:36:11 +03:00

34 lines
936 B
Text

# config.ludic - how many kinds of print, how many of each the ground remembers, how the reader
# reads, and the port's defaults
export function tracks_config(kinds: int, cap: int) -> void {
tk_kinds = kinds
tk_cap = cap
tk_ring = new []Track
tk_count = new []int
tk_next = new []int
for i in 0 .. kinds * cap { push(tk_ring, new Track) }
for k in 0 .. kinds {
push(tk_count, 0)
push(tk_next, 0)
}
}
# a reader at `name_at` or above can tell the animal; a print is fresh under `fresh` hours old,
# recent under `recent`, and old after
export function tracks_config_reading(name_at: int, fresh: float, recent: float) -> void {
tk_name_at = name_at
tk_fresh_h = fresh
tk_recent_h = recent
}
function tk_now() -> float {
return TracksWorld.now()
}
function tk_named() -> bool {
return TracksWorld.skill() >= tk_name_at
}
function tk_bearing(yaw: float) -> string {
return TracksWorld.bearing(yaw)
}