feat(base): 0.R4 - a queue keeps its own count, so every package verb takes only its own state; ludic migrate state --prune
ludic.base's Queue<T> carries a QueueTag (its name and pending count): queue_new(name), q_push(q, v), q_drain(q), q_clear(q) take no BaseState, and core_undrained(tags) names the given queues still holding facts. A reducer on a package's state can now call that package's verbs (wallet_earn(wallet_st, n)). ludic migrate state --prune (ludicc --migrate-prune) takes out each state parameter a function no longer uses, nor anything it calls, and the argument that fills it - including an argument for a parameter the callee has dropped, which is taken out before the call is checked, so a generic's T is told by the argument that says it. A reducer keeps its state. --dry-run now counts the edits it would make. Every package was moved with it: 608 base_st parameters and their arguments, 1889 edits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8cf4b3fed6
commit
71735b10a2
151 changed files with 58668 additions and 54719 deletions
|
|
@ -3,43 +3,43 @@
|
|||
export function hints_card(hints_st: HintsState) -> int { return hints_st.hn_card }
|
||||
|
||||
# the key: the picked card opened, or the open one put down
|
||||
export function hints_key(base_st: mut BaseState, hints_st: mut HintsState) -> void {
|
||||
export function hints_key(hints_st: mut HintsState) -> void {
|
||||
if hints_st.hn_card >= 0 {
|
||||
hints_close(base_st, hints_st)
|
||||
hints_close(hints_st)
|
||||
return
|
||||
}
|
||||
hints_open(base_st, hints_st, hints_st.hn_pick)
|
||||
hints_open(hints_st, hints_st.hn_pick)
|
||||
}
|
||||
|
||||
# the k-th chip on the rail opened as a card
|
||||
export function hints_open(base_st: mut BaseState, hints_st: mut HintsState, k: int) -> void {
|
||||
export function hints_open(hints_st: mut HintsState, k: int) -> void {
|
||||
if k < 0 or k >= hints_st.hn_n { return }
|
||||
hints_st.hn_pick = k
|
||||
hints_st.hn_card = hints_st.hn_top[k]
|
||||
hn_fact(base_st, hints_st, HINTS_F_OPENED, hints_st.hn_card)
|
||||
hn_fact(hints_st, HINTS_F_OPENED, hints_st.hn_card)
|
||||
}
|
||||
|
||||
export function hints_close(base_st: mut BaseState, hints_st: mut HintsState) -> void {
|
||||
export function hints_close(hints_st: mut HintsState) -> void {
|
||||
if hints_st.hn_card < 0 { return }
|
||||
let c = hints_st.hn_card
|
||||
hints_st.hn_card = -1
|
||||
hn_fact(base_st, hints_st, HINTS_F_CLOSED, c)
|
||||
hn_fact(hints_st, HINTS_F_CLOSED, c)
|
||||
}
|
||||
|
||||
# the arrows, with a card up: the next chip along (d = 1) or the one before, round the ends
|
||||
export function hints_move(base_st: mut BaseState, hints_st: mut HintsState, d: int) -> void {
|
||||
export function hints_move(hints_st: mut HintsState, d: int) -> void {
|
||||
if hints_st.hn_card < 0 or hints_st.hn_n <= 1 { return }
|
||||
hints_open(base_st, hints_st, (hints_st.hn_pick + hints_st.hn_n + d) % hints_st.hn_n)
|
||||
hints_open(hints_st, (hints_st.hn_pick + hints_st.hn_n + d) % hints_st.hn_n)
|
||||
}
|
||||
|
||||
# "I know this - do not show it again": the card off the rail until the mutes are given back
|
||||
export function hints_mute_card(base_st: mut BaseState, hints_st: mut HintsState) -> void {
|
||||
export function hints_mute_card(hints_st: mut HintsState) -> void {
|
||||
if hints_st.hn_card < 0 { return }
|
||||
let c = hints_st.hn_card
|
||||
hints_mute(hints_st, c, true)
|
||||
hints_st.hn_card = -1
|
||||
hints_st.hn_t = 0.0
|
||||
hn_fact(base_st, hints_st, HINTS_F_MUTED, c)
|
||||
hn_fact(hints_st, HINTS_F_MUTED, c)
|
||||
}
|
||||
|
||||
# a step's words and its picture (n 1..3): the glyph's name, or the item (-1 when it is a glyph)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue