wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run
ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic 1804 vars into 126 states, 64 into lets; 23498 edits in 460 files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5ffe50ed02
commit
19fcf60599
459 changed files with 17862 additions and 17603 deletions
|
|
@ -1,37 +1,39 @@
|
|||
# fake.ludic - a toy valley for the tests: flat ground at 10 m with a lake west of x = -300 (its
|
||||
# surface at 10.5), forest north of z = 400, up to two players, and a table of things set out
|
||||
var fk_px: []float = null
|
||||
var fk_pz: []float = null
|
||||
var fk_on: []bool = null
|
||||
var fk_noise: float = 0.0
|
||||
var fk_scent: float = 0.0
|
||||
var fk_still: int = 0
|
||||
var fk_hidden: bool = false
|
||||
var fk_blocked: bool = false
|
||||
var fk_wind: float = 0.0
|
||||
var fk_wind_dir: float = 0.0
|
||||
var fk_winter: float = 0.0
|
||||
var fk_about: int = 0
|
||||
var fk_born: int = 0
|
||||
var fk_lures: []WildLure = null
|
||||
var fk_gone: int = 0 # a uid the port says is no longer there
|
||||
export state WildlifeTestsFakeState {
|
||||
fk_px: []float = null
|
||||
fk_pz: []float = null
|
||||
fk_on: []bool = null
|
||||
fk_noise: float = 0.0
|
||||
fk_scent: float = 0.0
|
||||
fk_still: int = 0
|
||||
fk_hidden: bool = false
|
||||
fk_blocked: bool = false
|
||||
fk_wind: float = 0.0
|
||||
fk_wind_dir: float = 0.0
|
||||
fk_winter: float = 0.0
|
||||
fk_about: int = 0
|
||||
fk_born: int = 0
|
||||
fk_lures: []WildLure = null
|
||||
fk_gone: int = 0 # a uid the port says is no longer there
|
||||
}
|
||||
|
||||
function fk_setup() -> void {
|
||||
fk_px = floats(2)
|
||||
fk_pz = floats(2)
|
||||
fk_on = new []bool
|
||||
push(fk_on, true)
|
||||
push(fk_on, false)
|
||||
fk_px[0] = 5000.0
|
||||
fk_pz[0] = 5000.0
|
||||
fk_lures = new []WildLure
|
||||
wildlife_clear()
|
||||
wildlife_species_clear()
|
||||
fk_species()
|
||||
function fk_setup(wildlife_st: mut WildlifeState, wildlife_tests_fake_st: mut WildlifeTestsFakeState) -> void {
|
||||
wildlife_tests_fake_st.fk_px = floats(2)
|
||||
wildlife_tests_fake_st.fk_pz = floats(2)
|
||||
wildlife_tests_fake_st.fk_on = new []bool
|
||||
push(wildlife_tests_fake_st.fk_on, true)
|
||||
push(wildlife_tests_fake_st.fk_on, false)
|
||||
wildlife_tests_fake_st.fk_px[0] = 5000.0
|
||||
wildlife_tests_fake_st.fk_pz[0] = 5000.0
|
||||
wildlife_tests_fake_st.fk_lures = new []WildLure
|
||||
wildlife_clear(wildlife_st)
|
||||
wildlife_species_clear(wildlife_st)
|
||||
fk_species(wildlife_st)
|
||||
}
|
||||
|
||||
# 0 deer (meadow, tracks, medium), 1 bear (forest, charges), 2 hare (small), 3 jay (flies)
|
||||
function fk_species() -> void {
|
||||
function fk_species(wildlife_st: mut WildlifeState) -> void {
|
||||
let d = new WildSpecies
|
||||
d.key = "deer"
|
||||
d.walk = 1.1
|
||||
|
|
@ -41,7 +43,7 @@ function fk_species() -> void {
|
|||
d.size = 1
|
||||
d.range = 150.0
|
||||
d.keep_away = 120.0
|
||||
wildlife_species_add(d)
|
||||
wildlife_species_add(wildlife_st, d)
|
||||
let b = new WildSpecies
|
||||
b.key = "bear"
|
||||
b.habitat = WILD_FOREST
|
||||
|
|
@ -50,10 +52,10 @@ function fk_species() -> void {
|
|||
b.diet = WILD_FISH
|
||||
b.forget = 1.6
|
||||
b.run = 6.0
|
||||
wildlife_species_add(b)
|
||||
wildlife_species_add(wildlife_st, b)
|
||||
let h = new WildSpecies
|
||||
h.key = "hare"
|
||||
wildlife_species_add(h)
|
||||
wildlife_species_add(wildlife_st, h)
|
||||
let j = new WildSpecies
|
||||
j.key = "jay"
|
||||
j.flies = true
|
||||
|
|
@ -61,7 +63,7 @@ function fk_species() -> void {
|
|||
j.flee = 8.0
|
||||
j.land_shy = 0.0
|
||||
j.land_chance = 1.0
|
||||
wildlife_species_add(j)
|
||||
wildlife_species_add(wildlife_st, j)
|
||||
}
|
||||
|
||||
function fk_ground(x: float, z: float) -> float { return 10.0 }
|
||||
|
|
@ -70,24 +72,24 @@ function fk_water(x: float, z: float) -> float {
|
|||
return 0.0
|
||||
}
|
||||
function fk_forest(x: float, z: float) -> bool { return z > 400.0 }
|
||||
function fk_sight(ax: float, ay: float, az: float, bx: float, by: float, bz: float) -> bool { return not fk_blocked }
|
||||
function fk_sight(wildlife_tests_fake_st: WildlifeTestsFakeState, ax: float, ay: float, az: float, bx: float, by: float, bz: float) -> bool { return not wildlife_tests_fake_st.fk_blocked }
|
||||
function fk_players() -> int { return 2 }
|
||||
function fk_player_on(p: int) -> bool { return fk_on[p] }
|
||||
function fk_x(p: int) -> float { return fk_px[p] }
|
||||
function fk_player_on(wildlife_tests_fake_st: WildlifeTestsFakeState, p: int) -> bool { return wildlife_tests_fake_st.fk_on[p] }
|
||||
function fk_x(wildlife_tests_fake_st: WildlifeTestsFakeState, p: int) -> float { return wildlife_tests_fake_st.fk_px[p] }
|
||||
function fk_y(p: int) -> float { return 10.0 }
|
||||
function fk_z(p: int) -> float { return fk_pz[p] }
|
||||
function fk_is_hidden(p: int) -> bool { return fk_hidden }
|
||||
function fk_noise_of(p: int) -> float { return fk_noise }
|
||||
function fk_scent_of(p: int) -> float { return fk_scent }
|
||||
function fk_still_of(p: int) -> int { return fk_still }
|
||||
function fk_wind_of() -> float { return fk_wind }
|
||||
function fk_wind_to() -> float { return fk_wind_dir }
|
||||
function fk_winter_of() -> float { return fk_winter }
|
||||
function fk_about_of(a: WildAnimal) -> int { return fk_about }
|
||||
function fk_z(wildlife_tests_fake_st: WildlifeTestsFakeState, p: int) -> float { return wildlife_tests_fake_st.fk_pz[p] }
|
||||
function fk_is_hidden(wildlife_tests_fake_st: WildlifeTestsFakeState, p: int) -> bool { return wildlife_tests_fake_st.fk_hidden }
|
||||
function fk_noise_of(wildlife_tests_fake_st: WildlifeTestsFakeState, p: int) -> float { return wildlife_tests_fake_st.fk_noise }
|
||||
function fk_scent_of(wildlife_tests_fake_st: WildlifeTestsFakeState, p: int) -> float { return wildlife_tests_fake_st.fk_scent }
|
||||
function fk_still_of(wildlife_tests_fake_st: WildlifeTestsFakeState, p: int) -> int { return wildlife_tests_fake_st.fk_still }
|
||||
function fk_wind_of(wildlife_tests_fake_st: WildlifeTestsFakeState) -> float { return wildlife_tests_fake_st.fk_wind }
|
||||
function fk_wind_to(wildlife_tests_fake_st: WildlifeTestsFakeState) -> float { return wildlife_tests_fake_st.fk_wind_dir }
|
||||
function fk_winter_of(wildlife_tests_fake_st: WildlifeTestsFakeState) -> float { return wildlife_tests_fake_st.fk_winter }
|
||||
function fk_about_of(wildlife_tests_fake_st: WildlifeTestsFakeState, a: WildAnimal) -> int { return wildlife_tests_fake_st.fk_about }
|
||||
function fk_one(sp: int) -> int { return 1 }
|
||||
function fk_count() -> int { return len(fk_lures) }
|
||||
function fk_lure(i: int, l: WildLure) -> bool {
|
||||
let f = fk_lures[i]
|
||||
function fk_count(wildlife_tests_fake_st: WildlifeTestsFakeState) -> int { return len(wildlife_tests_fake_st.fk_lures) }
|
||||
function fk_lure(wildlife_tests_fake_st: WildlifeTestsFakeState, i: int, l: WildLure) -> bool {
|
||||
let f = wildlife_tests_fake_st.fk_lures[i]
|
||||
l.uid = f.uid
|
||||
l.kind = f.kind
|
||||
l.diet = f.diet
|
||||
|
|
@ -95,10 +97,10 @@ function fk_lure(i: int, l: WildLure) -> bool {
|
|||
l.x = f.x
|
||||
l.z = f.z
|
||||
l.owner = f.owner
|
||||
return f.uid != fk_gone
|
||||
return f.uid != wildlife_tests_fake_st.fk_gone
|
||||
}
|
||||
function fk_present(uid: int) -> bool { return uid != fk_gone }
|
||||
function fk_on_born(a: WildAnimal) -> void { fk_born += 1 }
|
||||
function fk_present(wildlife_tests_fake_st: WildlifeTestsFakeState, uid: int) -> bool { return uid != wildlife_tests_fake_st.fk_gone }
|
||||
function fk_on_born(wildlife_tests_fake_st: mut WildlifeTestsFakeState, a: WildAnimal) -> void { wildlife_tests_fake_st.fk_born += 1 }
|
||||
function fk_spot(a: WildAnimal, water: bool, s: WildSpot) -> bool {
|
||||
s.uid = 900
|
||||
s.x = a.x + 30.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue