wip(0.S2): migrate - a var nothing writes becomes a let; a state is keyed by its module, directory or program, so every program's plan agrees; paths normalized; program states named SceneDemoState / scene_demo_st; the LSP reads state, mut and entry/handler parameters
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3eda72e8c2
commit
5ffe50ed02
463 changed files with 72045 additions and 67421 deletions
|
|
@ -1,38 +1,38 @@
|
|||
# worth.ludic - what a buyer pays for a frame: the first frame of each subject and every legend,
|
||||
# on the grade's curve and the lens's worth; sold is sold
|
||||
export function photo_value(photo_st: PhotoState, i: int) -> int {
|
||||
if i < 0 or i >= photo_st.pht_n or photo_st.pht_sold[i] != 0 { return 0 }
|
||||
export function photo_value(i: int) -> int {
|
||||
if i < 0 or i >= pht_n or pht_sold[i] != 0 { return 0 }
|
||||
var v = 0
|
||||
for sp in 0 .. 32 {
|
||||
if (photo_st.pht_mask[i] & (1 << sp)) == 0 { continue }
|
||||
if (pht_mask[i] & (1 << sp)) == 0 { continue }
|
||||
var first = true
|
||||
for k in 0 .. photo_st.pht_n { if k != i and photo_st.pht_sold[k] != 0 and (photo_st.pht_mask[k] & (1 << sp)) != 0 { first = false } }
|
||||
for k in 0 .. pht_n { if k != i and pht_sold[k] != 0 and (pht_mask[k] & (1 << sp)) != 0 { first = false } }
|
||||
if first { v += PhotoRules.subject_value(sp) }
|
||||
if (photo_st.pht_legend[i] & (1 << sp)) != 0 { v += PhotoRules.legend_value(sp) }
|
||||
if (pht_legend[i] & (1 << sp)) != 0 { v += PhotoRules.legend_value(sp) }
|
||||
}
|
||||
if v > 0 { v = int(float(v) * (PhotoRules.mult() * photo_grade_mult(photo_st.pht_grade[i]))) }
|
||||
if v > 0 { v = int(float(v) * (PhotoRules.mult() * photo_grade_mult(pht_grade[i]))) }
|
||||
return v
|
||||
}
|
||||
|
||||
# every frame with a price, sold: the total, and a fact a frame
|
||||
export function photo_sell_all(base_st: mut BaseState, photo_st: mut PhotoState) -> int {
|
||||
export function photo_sell_all() -> int {
|
||||
var total = 0
|
||||
for i in 0 .. photo_st.pht_n {
|
||||
let v = photo_value(photo_st, i)
|
||||
for i in 0 .. pht_n {
|
||||
let v = photo_value(i)
|
||||
if v > 0 {
|
||||
total += v
|
||||
photo_st.pht_sold[i] = 1
|
||||
let f = pht_fact(base_st, photo_st, PHOTO_SOLD, i)
|
||||
pht_sold[i] = 1
|
||||
let f = pht_fact(PHOTO_SOLD, i)
|
||||
f.v = v
|
||||
f.mask = photo_st.pht_mask[i]
|
||||
f.mask = pht_mask[i]
|
||||
}
|
||||
}
|
||||
return total
|
||||
}
|
||||
|
||||
# what the roll would fetch now
|
||||
export function photo_worth(photo_st: PhotoState) -> int {
|
||||
export function photo_worth() -> int {
|
||||
var total = 0
|
||||
for i in 0 .. photo_st.pht_n { total += photo_value(photo_st, i) }
|
||||
for i in 0 .. pht_n { total += photo_value(i) }
|
||||
return total
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue