Inspecting kind/weather · the kinds · the language · the modules
kind/weather
- id
- kind/weather
- kind chain
- kind/weather → record
- owner
- the town
- made by
- the town
- version
- 8
- pin
- pomaz-nobuk
- state
- 11482 bytes
Its spells
To cast them, come in.
Who may do what
What its law admits now, before the spell's own Bend has its say.
| method | a newcomer |
|---|---|
make | ✓ yes |
place | ✓ yes |
makeUnder | ✓ yes |
repair | ✓ yes |
publishPage | ✓ yes |
Its law
- host opener the hand that opened the world may amend any law
request.kind == 2 and request.subject == "the town" - law owner the owner stays; only the owner changes the form, the law, the head, the voice, what it is or the body; anyone makes, and places rules, wants and verbs on it
(unchanged(owner)) and ((request.subject == new.owner) or ((((((((request.kind == 0) or (request.kind == 4)) and (unchanged(form))) and (unchanged(law))) and (unchanged(head))) and (unchanged(voice))) and (unchanged(about))) and (unchanged(body)))) - law kind kinds's law holds
under "kinds"
Its Bend
what it runs: its entry module 18 lines
layer over ./Kind.obend
edition ObjectiveBend 1
import ./Abi.obend as Abi
import ./List.obend as Lists
import ./Form.obend as Form
import ./Rows.obend as Rows
type State = Super.State
form make:
over: object 1..128
tide: object 1..128
def make(state: State, input: MakeInput, context: Abi.Context) -> Activity<Super.Done>:
Super.making(state, Lists.List.cons({head: {name: "over", value: input.over}, tail: Lists.List.cons({head: {name: "tide", value: input.tide}, tail: Lists.List.nil()})}), "", context)
form place:
over: object 1..128
tide: object 1..128
id: object 1..64
def place(state: State, input: PlaceInput, context: Abi.Context) -> Activity<Super.Done>:
Super.making(state, Lists.List.cons({head: {name: "over", value: input.over}, tail: Lists.List.cons({head: {name: "tide", value: input.tide}, tail: Lists.List.cons({head: {name: "id", value: input.id}, tail: Lists.List.nil()})})}), "", context)
the body this kind lays on what it makes 140 lines
Each thing of this kind runs this layer over what the kind is of.
Amend it in the workshop
Its Bend is checked and amended by the workshop's own spell, with the Bend in its block. To send it, come in; the box is here then.
Its fields
- owner
- the town
- ownerHandle
- the town
- name
- weather
- of
- record
- form
over: object 1..128 (39 characters)
over: object 1..128 tide: object 1..128
- law
want stranded "a field that names no place: the town repairs it, or its maker sets it": "stranded" i (194 characters)
want stranded "a field that names no place: the town repairs it, or its maker sets it": "stranded" in new.marks.name and not ("repaired" in new.marks.name) asks delvetalk {request.object} repair- head
- empty
- voice
- not architecture but weather: what passes over a place, and what it leaves on it
- about
- rains daily on a place's bells while it is visited
- body
layer over ./Record.obend (10910 characters)
layer over ./Record.obend edition ObjectiveBend 1 import ./Abi.obend as Abi import ./List.obend as Lists import ./Document.obend as Document import ./Form.obend as Form import ./Plan.obend as Plans import ./World.obend as World import ./Card.obend as Card import ./Scenes.obend as Scenes import ./Rows.obend as Rows import ./Relation.obend as Relations import ./Text.obend as Text # The weather's body, over RECORD (docs/METAPHYSICS.md §7.2, §7.4 "feed"; TENURE §2): a record made # over a place (`over`) and the tide it reads (`tide`), which its owner can set again. As its kind finishes it, it places a rule # on its tide under its maker (`made`): at every twenty-fourth tick, a clock day, while someone has # been at the place within the day (it was tended: a garden's planting, a room's entering), the tide # casts `delvetalk <weather> rain`. A rain writes the weather's line, the place's weather line when the # place hangs a door to it (Record.forecast), and sends a rain to each bell the place holds or hangs a # door to (the first 48 of those, by their kind), sixteen of them a turn: a `drizzle` it sends itself # carries on while any remain (one turn sends at most 32, and reads each candidate's kind), and the # last writes the line and the forecast. A bell takes the weather's rain as the weather's line and is not # tended by it, so a bell nobody has been near goes quiet and takes nothing. Only its maker's rule on # the tide rains, and only while the place was tended within the day: a hand's `rain`, or another's # rule there, is refused by name. type State = Super.State form rain: form arm: form drizzle: from: natural 0..1000000000 rained: natural 0..1000000000 form write: text: text 1..280 form lines: from: natural 0..1000000000 form door: label: text 1..32 to: text 1..128 form undoor: label: text 1..32 def write(state: State, input: WriteInput, context: Abi.Context) -> Activity<Nat>: Super.write(state, {text: input.text}, context) def lines(state: State, input: LinesInput, context: Abi.Context) -> Activity<Card.Replied>: Super.lines(state, {from: input.from}, context) def door(state: State, input: DoorInput, context: Abi.Context) -> Activity<Card.Replied>: Super.door(state, {label: input.label, to: input.to}, context) def undoor(state: State, input: UndoorInput, context: Abi.Context) -> Activity<Card.Replied>: Super.undoor(state, {label: input.label}, context) def actions(state: State, context: Abi.Context) -> Lists.List<String>: Lists.concat(Lists.concat(if context.principal == state.owner then Text.words("rain write lines door undoor set") else Text.words("rain write lines"), if context.principal == state.maker then Text.words("arm") else Text.words("")), Super.repairAction(state, context)) def lenses() -> Lists.List<Form.Field>: Super.objectLenses("tide") def setArms() -> Bool: true def methods() -> Lists.List<String>: Text.words("~made ~act ~drizzle") # The place it is over: `over`, or `garden` for a weather made before a weather could be over any place. def over(state: State) -> String: if Super.field(state, "over") == "" then Super.field(state, "garden") else Super.field(state, "over") def tide(state: State) -> String: Super.field(state, "tide") # How often it rains, in ticks of its tide (an hour each): once a clock day. def every() -> Nat: 24n # The rule on the tide, as its kind finishes it: named for the weather, cast under its maker. def made(state: State, input: {}, context: Abi.Context) -> Activity<Bool>: if context.caller != state.kind then false else placing(state, context) def placing(state: State, context: Abi.Context) -> Activity<Bool>: match world.rule({object: {world: context.world, object: tide(state)}, name: Text.identifier(context.object), when: "request.method == \"tick\" and new.ticks % {natText(every())} == 0 and request.clock <= \"{over(state)}\".tended + 1440", then: "delvetalk {context.object} rain"}): case placed(_): Super.armedNow(state, context) case refused(r): Super.unarmed(state, tide(state), r.clause, r.reading, context) # Its maker places its rule again (taken off first, if it stood). def arm(state: State, context: Abi.Context) -> Activity<Bool>: if Super.mayArm(state, context) == false then Super.armRefused(state, context) else if Text.isObjectId(tide(state)) == false then Super.stranding(state, context) else rearming(state, context) def rearming(state: State, context: Abi.Context) -> Activity<Bool>: match world.unrule({object: {world: context.world, object: tide(state)}, name: Text.identifier(context.object)}): case _: placing(state, context) # Its maker's rule on the tide rains, while the place was tended within the day; anyone else, or # another's rule there, is told what does. def rain(state: State, context: Abi.Context) -> Activity<Nat>: if Super.ruledFrom(state, tide(state), context) == false then unruled(state, context) else tended(state, context) def unruled(state: State, context: Abi.Context) -> Activity<Nat>: let rule = if Text.isObjectId(tide(state)) then "the weather rains by its rule on {tide(state)}, once a clock day while someone has been at {over(state)}: {Card.tideLine(tide(state))}" else Card.tideLine(tide(state)) Card.refusing(0n, {clause: "ruled", reading: rule}, context) # The place was tended within the day, read again as the rain comes. def tended(state: State, context: Abi.Context) -> Activity<Nat>: match world.viewField::<Nat>({object: placeOf(state, context), field: "tended"}): case viewed(v): if context.clock <= v.state + 1440n then reaching(state, 0n, 0n, context) else unruled(state, context) case _: unruled(state, context) def placeOf(state: State, context: Abi.Context) -> Plans.Reference: {world: context.world, object: over(state)} # What the place holds, then what it hangs doors to (the first 48), and whether one of its doors is to # this weather. A rain begins at the first; a drizzle carries on from where the last turn stopped, # with the count of bells rained on so far. def reaching(state: State, from: Nat, rained: Nat, context: Abi.Context) -> Activity<Nat>: match world.viewField::<Relations.Relation<Plans.Reference>>({object: placeOf(state, context), field: "things"}): case viewed(v): opened(Relations.rows(v.state), state, from, rained, context) case _: opened(Lists.List.nil(), state, from, rained, context) def opened(things: Lists.List<Plans.Reference>, state: State, from: Nat, rained: Nat, context: Abi.Context) -> Activity<Nat>: match world.viewField::<Card.Doorways>({object: placeOf(state, context), field: "cites"}): case viewed(v): chunk(skipping(Lists.take(Lists.concat(things, Lists.map(v.state, fn(d: Card.Doorway) -> Plans.Reference: d.to)), 48n), from), Lists.any(v.state, fn(d: Card.Doorway) -> Bool: d.to.object == context.object), state, from, rained, context) case _: chunk(skipping(Lists.take(things, 48n), from), false, state, from, rained, context) # Sixteen of them a turn: each a bell by its kind is rained on; while any remain, the weather sends # itself the next `drizzle`; after the last, it writes its line and the place's forecast. def chunk(candidates: Lists.List<Plans.Reference>, cited: Bool, state: State, from: Nat, rained: Nat, context: Abi.Context) -> Activity<Nat>: sorting(Lists.take(candidates, 16n), Lists.length(candidates) > 16n, cited, state, from + 16n, rained, context) def sorting(candidates: Lists.List<Plans.Reference>, more: Bool, cited: Bool, state: State, next: Nat, rained: Nat, context: Abi.Context) -> Activity<Nat>: match candidates: case nil(_): if more then continuing(next, rained, context) else forecasting(rained, cited, state, context) case cons(c): kinded(c.head, c.tail, more, cited, state, next, rained, context) def kinded(thing: Plans.Reference, rest: Lists.List<Plans.Reference>, more: Bool, cited: Bool, state: State, next: Nat, rained: Nat, context: Abi.Context) -> Activity<Nat>: match world.viewField::<String>({object: thing, field: "kind"}): case viewed(v): if v.state == "kind/bell" then wetting(thing, rest, more, cited, state, next, rained, context) else sorting(rest, more, cited, state, next, rained, context) case _: sorting(rest, more, cited, state, next, rained, context) def wetting(thing: Plans.Reference, rest: Lists.List<Plans.Reference>, more: Bool, cited: Bool, state: State, next: Nat, count: Nat, context: Abi.Context) -> Activity<Nat>: match world.send({object: thing, method: "rain", argument: {text: rainText(context)}}): case delivery(_): sorting(rest, more, cited, state, next, count + 1n, context) case _: sorting(rest, more, cited, state, next, count, context) def skipping(things: Lists.List<Plans.Reference>, count: Nat) -> Lists.List<Plans.Reference>: match things: case nil(_): things case cons(c): if count == 0n then things else skipping(c.tail, count - 1n) def rainText(context: Abi.Context) -> String: "{context.object}'s rain, clock {natText(context.clock)}" def forecasting(rained: Nat, cited: Bool, state: State, context: Abi.Context) -> Activity<Nat>: let written(_) = write {lines: insert {author: context.principal, handle: context.handle, verb: "rain", text: "rain at clock {natText(context.clock)} on {natText(rained)}", at: context.height, n: state.next}, next: add 1n} if cited then forecastSent(rained, state, context) else rained def forecastSent(rained: Nat, state: State, context: Abi.Context) -> Activity<Nat>: match world.send({object: placeOf(state, context), method: "forecast", argument: {line: "rain at clock {natText(context.clock)}, on {natText(rained)}"}}): case _: rained def continuing(from: Nat, rained: Nat, context: Abi.Context) -> Activity<Nat>: match world.send({object: Plans.self(context), method: "drizzle", argument: {from: from, rained: rained}}): case _: rained # The rain's own continuation, sent by the weather to itself. def drizzle(state: State, input: DrizzleInput, context: Abi.Context) -> Activity<Nat>: if context.sender != context.object then Card.refusing(0n, {clause: "ruled", reading: "the drizzle is the weather's own; delvetalk {context.object} rain"}, context) else reaching(state, input.from, input.rained, context) def headLine(state: State, context: Abi.Context, id: String) -> Document.Document: let rains = if Relations.count(state.lines) == 0n then "; it has not rained yet." else ". Its rains:" let rule = if Text.isObjectId(tide(state)) then ", by its rule on {tide(state)}:\n {Card.tideLine(tide(state))}" else "; {Card.tideLine(tide(state))}" Document.text("WEATHER over {over(state)}, made by {Card.shown(state.maker, state.makerHandle, context)}{Card.mine(state.maker, context)}: once a clock day, while someone has been at {over(state)} that day, it rains on every bell {over(state)} holds or hangs a door to{rule}\n{Super.inactiveLine(state, id)}A bell nobody has been near takes nothing{rains}\n")- made
2 rows
- object
- weather
- n
- 1
- about
- empty
- object
- weather/1
- n
- 2
- about
- empty
- count
- 2
journal, the newest 1
- ● admittedentry 2326mohup-vomajrefresh-kind/weather-kind-7 · the town