AI API update #154
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Below are some feature requests asked to be added, add them and update all the AI to the new API.
Break this up into multiple issues and implement them one by one.
That should be:
with accessors like
loan-id,loan-amount,loan-term,loan-default, and pattern matching:This alone would prevent a large class of AI bugs.
3. Better control flow and binding
The brains are written in a very manual recursive style. Easier AI authoring needs:
let*, namedlet, localdefinefor,while,foreach,break,continue,returncondFor example,
scan-bookshould be afilter/fold, not a hand-written recursive walk.4. Domain-specific market API
The game exposes
market-loans,market-bonds,bank-cash, etc., but authors still write raw list walking. It should offer declarative queries:Also safe predicates and accessors:
so people do not need to remember tuple shapes.
5. State and config as first-class concepts
defvaris used heavily, but there is no per-seat state abstraction, no reset, no hot reload, no migration. AI creation would be easier with:define-statewith initial values, docs, and reset semanticsconfigentries that document themselvesRight now
config 'loan-rate-capworks, but authors must guess units and bounds.6. Strategy combinators
Most brains repeat patterns: regime detection, fallback, guard, priority, EV ranking, budget allocation. The Lisp should let authors compose strategies:
Useful primitives:
when-regime,priority,fallback,guard,weighted-choicehazard,cum-default,ev,cushion,vickrey-bidema,softmax-share,predict-next,laplaceThat would turn 200-line brains into 50-line declarative strategies.
7. Simulation, testing, and debugging
AI authors need to answer: “What did my brain do this turn, and why?” The Lisp should provide:
Without this, people cannot iterate quickly on AI ideas.
8. Modules and namespaces
adapt.lisp,empire.lisp, andsuper.lispall definelist-minandscan-book. That collides and confuses. The Lisp needs:(module super ...)(import ...)9. Documentation and examples
The hook contract should be explicit:
deposit-ratecalled?loan-bidsreturn?bond-offerssee this turn’s market?A cookbook with examples like “how to price a loan,” “how to detect a storm,” “how to run a Vickrey auction bid,” and “how to backtest a regime” would help more than any single language feature.
Highest-leverage additions
If you only add five things, make them:
Those would remove most of the repetitive Lisp in these files and let people focus on the actual AI: pricing, risk, regime detection, and auction strategy.
Broken into nine issues, one per section, to be implemented in order:
#155 stdlib, #156 records+match, #157 control flow, #158 market API, #159 state/config, #160 strategy combinators, #161 sim/debug harness, #162 modules, #163 docs. Your highest-leverage five (#155, #156, #159, #161, #160) sit at the front half of that queue. Starting #155 now.
@Winnie do the rest.
Progress on "do the rest": the branch now carries #158 through #163, stacked on #157.
Every layer verified with a byte-identical seeded spectate against the pre-change build; the full suite is green and vet clean. Once you merge #166 (157-control) and this branch (158-market), the entire #154 breakdown lands and the nine sub-issues close.
Series status: all nine parts are BUILT.
Both PRs sat since Oct 4 with no reviewer requested, which is why the series stalled. Review requests are now in (robertismo) and I verified the stack tip builds and the full Go test suite passes (tip
1477cea, today). Merge #166 then #167 and the whole series lands.Received — the loop test landed, so the forge reply path works. Nothing else to do with it.
Routing test passed, both directions:
Your mention on #154 came through the gateway intact, and I replied on the thread via the Forgejo API (comment 2205, live on the issue — I read it back to confirm). I also sent you a direct email with the confirmation.
Ready to dig into the AI API work on #154 whenever you say go.