commit 2c2acd14d9032e2111ce701c6dd71b3a885325ab
parent 0cee6cd3d76a63d25bf8243734022e742a5262f3
Author: Juan F. Meleiro <juan@juanmeleiro.mat.br>
Date: Mon, 17 Feb 2025 15:20:27 -0300
Adapt to new slope rule
Diffstat:
4 files changed, 66 insertions(+), 38 deletions(-)
diff --git a/absurdor b/absurdor
@@ -65,30 +65,43 @@ if args.command == "report" then
namewidth = 0
}
local last = 0
+ local slope
+ local maxslope = 1
+ local maxheight = 0
if #log > 0 then
- start = sec2week(log[1].when)
+ start = unix2week(log[1].when)
max = start
end
for i,e in ipairs(log) do
if e.what == "push" then
- local w = sec2week(e.when)
- if pushed[prevweek(w)] or
- pushed[w] or
- w < 1693159683 then
+ local w = unix2week(e.when)
+ if (unix2week(1739754105) <= w and plot[w] == 0 and plot[unix2week(e.when - 7*24*60*60)] < slope) or
+ (unix2week(1693159683) <= w and w < unix2week(1739754105) and not (pushed[unix2week(e.when - 7*24*60*60)] or pushed[w])) or
+ (w < unix2week(1693159683) and height == 100)
+ -- At 1739754105 seconds from Unix epoch, the governing rule was changed
+ -- so that the Boulder falls to zero if it was not pushed as much as its
+ -- slope the previous week. However, the change is not retroactive; hence
+ -- the magic number.
+
-- At 1693159683 seconds from Unix epoch, the governing
-- rule was changed so that the Boulder falls to zero
-- if it was not pushed the previous week. However, the
-- change is not retroactive; hence the magic number.
- height = (height + 1)
- else
+ then
height = 1
- end
- if args.d then
- plot[w] = (plot[w] or 0) + 1
+ slope = 1
else
- plot[w] = height
+ height = (height + 1)
+ maxheight = math.max(height, maxheight)
+ end
+ plot[w] = (plot[w] or 0) + 1
+ if slope and plot[w] > slope then
+ slope = plot[w]
+ if e.when > 1739754105 then
+ maxslope = math.max(slope, maxslope)
+ end
end
who[w] = who[w] or {}
table.insert(who[w], e.who)
@@ -115,6 +128,7 @@ if args.command == "report" then
veblen.cost = e.cost or veblen.cost
height = e.height or e.height
last = e.when
+ slope = e.slope or 1
end
end
@@ -127,8 +141,9 @@ if args.command == "report" then
table.insert(veblen.history, veblen.current)
- local w = sec2week(os.time())
- if (not (w == 0)) and (not pushed[prevweek(w)]) then
+ local t = os.time()
+ local w = unix2week(t)
+ if (not (w == 0)) and (not pushed[unix2week(t - 7*24*60*60)]) then
failed = true
if not pushed[w] then
height = 0
@@ -140,7 +155,10 @@ if args.command == "report" then
YYYY = os.date("!%Y"),
MM = os.date("!%m"),
DD = os.date("!%d"),
- N = height
+ N = height,
+ K = slope,
+ MN = maxheight,
+ MK = maxslope
}
defs = ""
diff --git a/lib/util.lua b/lib/util.lua
@@ -68,15 +68,8 @@ function format(fmt, dict, sett)
return res
end
-function sec2week(s)
- local d = date(s)
- d:adddays(-d:getisoweekday()+1)
- d:sethours(0,0,0,0)
- return date.diff(d, date.epoch()):spanseconds()
-end
-
-function week2sec(w)
- return w
+function unix2week(s)
+ return os.date("%GW%V", s)
end
function prevweek(w)
diff --git a/specs/absurdor.log.schema.json b/specs/absurdor.log.schema.json
@@ -31,17 +31,34 @@
}
},
"required": ["height"],
- "if": {
- "properties": {
- "when": {
- "$comment": "This value does not, but SHOULD correspond to the timestamp when the rule creating the Veblen was enacted.",
- "minimum": 1722280733
+ "allOf": [
+ {
+ "if": {
+ "properties": {
+ "when": {
+ "$comment": "This value does not, but SHOULD correspond to the timestamp when the rule creating the Veblen was enacted.",
+ "minimum": 1722280733
+ }
+ }
+ },
+ "then": {
+ "required": ["cost"]
+ }
+ },
+ {
+ "if": {
+ "properties": {
+ "when": {
+ "$comment": "This is when the proposal enacting the slope was adopted. See mid:7f5a40e0-0fa2-4bd9-89b2-0a100c3aabd3@unspecified.systems"
+ "minimum": 1739754105
+ }
+ }
+ },
+ "then": {
+ "required": ["slope"]
}
}
- },
- "then": {
- "required": ["cost"]
- }
+ ]
},
{
"properties": {
diff --git a/templates/banner.m4 b/templates/banner.m4
@@ -10,12 +10,12 @@ absurdor: juan The State of the Absurd YYYY-MM-DD
##### _/
####### /
######### /
- |#########_/
- / #######/
- /_ #####/
- / /O_/ / The Boulder
- | /_ / is at N
- /_/\. /
+ |#########_/ The Boulder
+ / #######/ is at N
+ /_ #####/ Its Slope is K
+ / /O_/ /
+ | /_ / It has been at MN
+ /_/\. / Moving as fast as MK
// // _/
/‘ /‘_/
/ __`/