wip(0.S3): packages and examples migrated in one run - ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d490d4f9f1
commit
3eda72e8c2
172 changed files with 3094 additions and 2966 deletions
|
|
@ -4,17 +4,19 @@ property Catch {
|
|||
fish: int = 0
|
||||
}
|
||||
event Landed { fish: int }
|
||||
var landed: int = 0
|
||||
var last: Catch = null
|
||||
@On(Landed) handler Count { landed += fish }
|
||||
export state FishingState {
|
||||
landed: int = 0
|
||||
last: Catch = null
|
||||
}
|
||||
@On(Landed) handler Count(fishing_st: mut FishingState) { fishing_st.landed += fish }
|
||||
function catch_new(n: int) -> Catch {
|
||||
let c = new Catch
|
||||
c.fish = n
|
||||
return c
|
||||
}
|
||||
export function fishing_day() -> int {
|
||||
last = catch_new(3)
|
||||
emit Landed(fish: last.fish)
|
||||
export function fishing_day(fishing_st: mut FishingState) -> int {
|
||||
fishing_st.last = catch_new(3)
|
||||
emit Landed(fish: fishing_st.last.fish)
|
||||
emit Landed(fish: 4)
|
||||
return landed
|
||||
return fishing_st.landed
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@ property Catch {
|
|||
weight: float = 0.0
|
||||
}
|
||||
event Landed { name: string }
|
||||
var heard: string = ""
|
||||
@On(Landed) handler Hear { heard = heard + name }
|
||||
export function hunting_day() -> string {
|
||||
export state HuntingState {
|
||||
heard: string = ""
|
||||
}
|
||||
@On(Landed) handler Hear(hunting_st: mut HuntingState) { hunting_st.heard = hunting_st.heard + name }
|
||||
export function hunting_day(hunting_st: HuntingState) -> string {
|
||||
let c = new Catch
|
||||
c.name = "hare"
|
||||
emit Landed(name: c.name)
|
||||
return heard
|
||||
return hunting_st.heard
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue