absurdor

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 94b3efa2d69f47586ade6cefb2d2e13088b1a131
parent ab9dab81d9aef2ae4e2f583348d91bfd60245b87
Author: Juan F. Meleiro <juan@juanmeleiro.mat.br>
Date:   Mon, 22 Jul 2024 11:31:15 -0300

Implement Veblen transfer

Diffstat:
Mabsurdor | 45+++++++++++++++++++++++++++++++++------------
Mrule.txt | 25+++++++++++++++++++++++++
2 files changed, 58 insertions(+), 12 deletions(-)

diff --git a/absurdor b/absurdor @@ -121,19 +121,35 @@ function week2sec(w) return w*24*60*60*7 end +function is_duplicate(ts, log) + for _,e in ipairs(log) do + if e.when == ts then + return true + end + end + return false +end + local parser = argparse("absurdor", "Manage Absurdor duties") :command_target("command") +local commands = {} + parser:command("report", "Generate and send absurdor report") :flag("-p") -local cmd_record = parser:command("record", "Record events") +commands.record = parser:command("record", "Record events") :command_target("what") -local cmd_press = cmd_record:command("push", "A push of The Boulder") -cmd_press:argument("who", "Name of the player") -cmd_press:argument("when", "Timestamp of boulder push") +local commands.push = commands.record:command("push", "A push of The Boulder") +commands.push:argument("who", "Name of the player") +commands.push:argument("when", "Timestamp of boulder push") :convert(maildate) -cmd_press:option("-m", "Message ID where push happened") - :target("where") -parser:command("log", "Display log") +commands.push:option("-m", "Message ID where push happened"):target("where") +commands.log = parser:command("log", "Display log") + +commands.transfer = commands.record:command("transfer", "Transfer the Veblen") +commands.transfer:argument("who", "Name of the player") +commands.transfer:argument("when", "When the transfer took place") +commands.tranfser:argument("amount", "Amount spent on the transfer") +commands.push:option("-m", "Message ID where push happened"):target("where") local args = parser:parse() @@ -268,12 +284,8 @@ if args.command == "report" then end end elseif args.command == "record" then + die(is_duplicate(args.when), "There's already an event recorded at that time.") if args.what == "push" then - for _,e in ipairs(log) do - if e.when == args.when then - die("There's already an event recorded at that time.") - end - end io.write(string.format("%s pushed the boulder at %s\n", args.who, os.date("%Y-%m-%d %H:%M %z", args.when))) table.insert(log, { when = args.when, @@ -281,6 +293,15 @@ elseif args.command == "record" then who = args.who, where = args.where }) + elseif args.what == "transfer" then + io.write(string.format("%s transfered the Veblen to emself for %d spendies.\n", args.who, args.cost)) + table.insert(log, { + when = args.when, + what = "transfer", + who = args.who, + where = args.where, + cost = args.cost + }) end elseif args.command == "log" then for _,e in ipairs(log) do diff --git a/rule.txt b/rule.txt @@ -15,3 +15,28 @@ The Boulder report. ------------------------------------------------------------------------ + +------------------------------------------------------------------------ +The Veblen + + The Veblen is a unique indestructible fixed asset. + + Ownership of the Veblen is entirely restricted to Agora and + players. If the Veblen is owned by the Lost and Found Department + or in abeyance, it is immediately transferred to Agora. + + The Veblen Cost is a secured singleton switch with values of + positive integers and a default of 1. + + Any player CAN pay a fee of X Spendies to transfer the Veblen to + to emself, where X is a value greater than or equal to the + current Veblen Cost. Upon doing so, e gains ownership of the + Veblen, and the Veblen Cost is set to X+1. + + The Veblen Cost and the ownership of the Veblen are tracked by + the Absurdor. + + The owner of the Veblen SHOULD conspicuously show off eir + ownership of it from time to time. + +------------------------------------------------------------------------