ludic/packages/ludic.steps/each.ludic
Orkuncakilkaya 31e6740033 feat(ludic.steps): chapters of steps, their kinds, progress and a party's pooled shares
A step is (kind, param, need) and a question about state: a kind has a
shape (yes, a count, a mask counted, every bit of a mask) and a pool
(world, any, sum, or, max, each), handed in by the game as StepsKind
records. An arc is chapters of up to STEPS_PER_CHAPTER steps; steps_check
sticks each met step of the current chapter (STEPS_MET) and opens the
next when all are (STEPS_CHAPTER), so a step met before its chapter
ticks at once. With company each seat's shares are held per chapter,
pooled as the kind says (steps_met, steps_party_got), counted for an
EACH step (steps_each, steps_lacking), and a leaver takes theirs along.

Port: StepsWorld { value(kind, param, player) (required), party,
present }. The package knows no kind's meaning and no chapter's words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 06:02:39 +03:00

27 lines
817 B
Text

# each.ludic - a step every player must meet in their own pack: how many seats are taken, how
# many of them carry it, and which do not
export function steps_players() -> int {
var n = 0
for p in 0 .. steps__players { if StepsWorld.present(p) { n += 1 } }
return n
}
# how many seats taken have step i's thing (seat 0 counted live)
export function steps_each(i: int) -> int {
steps__cols()
var n = 0
for p in 0 .. steps__players {
if StepsWorld.present(p) and steps__col[p * STEPS_PER_CHAPTER + i] != 0 { n += 1 }
}
return n
}
# the seats that do not have it yet
export function steps_lacking(i: int) -> []int {
steps__cols()
let out = new []int
for p in 0 .. steps__players {
if StepsWorld.present(p) and steps__col[p * STEPS_PER_CHAPTER + i] == 0 { push(out, p) }
}
return out
}