ludic.jobs jobs_posted_count, ludic.steps steps_my_shares_into - a count and a kept list for what a party asks every tick

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 15:12:24 +03:00
parent fc0f3d3790
commit ae5df73e72
4 changed files with 21 additions and 0 deletions

View file

@ -33,6 +33,12 @@ function steps__share(steps_st: StepsState, p: int, i: int) -> int {
}
# this machine's shares for the current chapter, to send to whoever owns the story
# the same into a list the caller keeps (a guest checks its shares every tick)
export function steps_my_shares_into(steps_st: StepsState, out: []int) -> void {
List.clear(out)
for i in 0 .. STEPS_PER_CHAPTER { push(out, steps__share(steps_st, 0, i)) }
}
export function steps_my_shares(steps_st: StepsState) -> []int {
let out = new []int
for i in 0 .. STEPS_PER_CHAPTER { push(out, steps__share(steps_st, 0, i)) }

View file

@ -154,6 +154,12 @@ program StepsTest {
steps_share(steps_st, 1, 0, shares(2, 0))
expect(steps_met(steps_st, 0))
expect_eq(steps_party_got(steps_st, 0), 5)
let kept = new []int
steps_my_shares_into(steps_st, kept)
steps_my_shares_into(steps_st, kept)
let made = steps_my_shares(steps_st)
expect_eq(len(kept), len(made))
for i in 0 .. len(made) { expect_eq(kept[i], made[i]) }
steps_set_current(steps_st, 1)
steps_test_st.vals[K_SIGNS] = 1
steps_share(steps_st, 1, 1, shares(2, 0))