commit 78f65426ef435c1714c1c90708ce480d2fd1a3dd
parent 8111ab7419543c5ab9fcd8dfc641c951b522d0c7
Author: Juan F. Meleiro <juan@juanmeleiro.mat.br>
Date: Mon, 13 Jan 2025 13:05:37 -0300
Add a news section to report
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/absurdor b/absurdor
@@ -108,6 +108,10 @@ if args.command == "report" then
die(e.value ~= math.ceil(veblen.cost/2), string.format("Recorded devalueing of the Veblen to an incorrect value (from %d to %d)", veblen.cost, e.value))
table.insert(veblen.history, {when = e.when, what = "devalue", value = e.value})
veblen.cost = e.value
+ local news = {}
+ for i,e in ipairs(log) do
+ if e.when > last then
+ table.insert(news, e)
end
end
@@ -150,6 +154,13 @@ if args.command == "report" then
f = io.open(tmpname, "a")
+ f:write("EVENTS SINCE LAST REPORT\n")
+ table.sort(news, function(e0, e1) return e0.when > e1.when end)
+ for i,e in ipairs(news) do
+ f:write(fmt_event(e) .. "\n")
+ end
+ f:write("\n")
+
-- Top pushers
f:write("TOP PUSHERS\n")
local scores = {}