tide
The water of Yowe Fen, as a model. It knows how long the run has been going, how much extra water a wrong answer has cost, and therefore where the surface is this frame. It knows nothing about phases, gates or herons.
run.tide
The water of Yowe Fen, as a model. It knows how long the run has been going, how much extra water a wrong answer has cost, and therefore where the surface is this frame. It knows nothing about phases, gates or herons.
local Tide = require("run.tide")
local t = Tide.new()
t.running = true
t:advance(dt) -- how many notches the water crossed this frame
t:penalise(24) -- a wrong answer, same return
t:t() -- 0..1, how far to the crest
t:y() -- the water's world Y
t:overDeck() -- is the causeway under water yet?
t:crested() -- is the run out of water to give?
t:secondsLeft()
t:reset()
Two constants worth reading rather than deriving:
Tide.SUBMERGE_T— the point of the run at which the water closes over the causeway deck. Past this the fen is one sheet of water with a route somewhere under it.Tide.DROWN_T— the point at which the water is deep enough over the deck to take a yowe.
Both are found by bisecting Rules.tideY, so retuning the easing in
game.rules moves them without an edit here. Tide.NOTCHES is how many
notches the water crosses over a whole run — ten, close enough together to
feel like pressure and far enough apart that a crossing is an event.
Scoped to this part · feeds back into the world's score.