TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Building an economy simulator from scratch

480 点作者 Ruddle超过 1 年前

46 条评论

bagpuss超过 1 年前
The MONIAC built in the 1950s by Bill Phillips (of Phillips curve fame) attempted to model economic processes with coloured water (fluidic logic)<p><a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;MONIAC" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;MONIAC</a>
评论 #37532227 未加载
评论 #37531995 未加载
评论 #37547113 未加载
评论 #37532512 未加载
zwieback超过 1 年前
This is so cute, love the animation and idea behind it.<p>Just yesterday I listened to Planet Money talk about how Bill Phillips got a position at the London School of Economics on the strength of his hydraulic computer simulating the economy: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;MONIAC" rel="nofollow noreferrer">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;MONIAC</a>
评论 #37529894 未加载
neilwilson超过 1 年前
&quot; tax works by pooling a percent of sellers revenue.&quot;<p>What the public servant actually does is impose a tribute on the workers <i>in a denomination the public servant determines</i>. If you don&#x27;t provide the denomination then the public servant confiscates your assets by force.<p>The population then offers their goods and services in return for the denomination the public servant <i>issues</i>. The public servant then determines the level of the tribute required by how much of its own denomination it gives in exchange for the tribute.<p>That&#x27;s the source of money, and the source of the price level.<p>There is no &#x27;universal exchange commodity&#x27;. Money is really just promises between people.<p>Fred would say to Jim: &quot;here&#x27;s a pig, owe me one&quot;. Fred now has Jim&#x27;s IOU as an asset which he could give to Bob in exchange for something Bob made so Bob can claim a pig from Jim.
评论 #37532350 未加载
评论 #37532677 未加载
motohagiography超过 1 年前
The game &quot;Captain of Industry&quot; might be a more complete simulation: <a href="https:&#x2F;&#x2F;store.steampowered.com&#x2F;app&#x2F;1594320&#x2F;Captain_of_Industry&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;store.steampowered.com&#x2F;app&#x2F;1594320&#x2F;Captain_of_Indust...</a><p>Big thread on it from last year here: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31586833">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31586833</a>
评论 #37531711 未加载
denton-scratch超过 1 年前
In the late 80s, I typed in a BASIC economy simulator I found in some computer magazine. It ran to two or three closely-typed pages (sides).<p>As Chancellor of the Exchequer, you set the tax-rate, interest rate, level of public spending and so on; then you ran a cycle. I can&#x27;t remember whether a cycle was a month or a year. After about three years, the workers would be on strike and there would be rioting in the streets. Every time.<p>I wasn&#x27;t particularly interested in macroeconomics at the time; I certainly had no idea how to run an economy. I have no idea how realistic the economic model was. I assume it was just a bit of fun.<p>But I&#x27;d like to tinker with a realistic economic model that is flexible enough to, for example, model Modern Monetary Theory.
评论 #37533398 未加载
评论 #37533992 未加载
评论 #37536652 未加载
评论 #37538735 未加载
Workaccount2超过 1 年前
I&#x27;ve long had the fantasy of an economics simulator given dwarf fortress levels of dedication and attention to detail. This might not be it, but it does warm my soul a bit.
评论 #37531734 未加载
评论 #37529907 未加载
评论 #37530164 未加载
评论 #37535741 未加载
评论 #37531172 未加载
评论 #37529309 未加载
评论 #37531604 未加载
评论 #37529529 未加载
Nezteb超过 1 年前
Is the source code for this simulator available anywhere? The post&#x27;s code itself is minimized&#x2F;obfuscated: <a href="https:&#x2F;&#x2F;thomassimon.dev&#x2F;assets&#x2F;cashloss.1fca21f6.js" rel="nofollow noreferrer">https:&#x2F;&#x2F;thomassimon.dev&#x2F;assets&#x2F;cashloss.1fca21f6.js</a><p>I couldn&#x27;t find anything on the author&#x27;s GitHub. I&#x27;m mostly just curious how it&#x27;s built.
评论 #37529119 未加载
评论 #37551324 未加载
评论 #37568001 未加载
0xADADA超过 1 年前
dont&#x27; mistake a beautiful map for the territory, you&#x27;ll find yourself lost amongst lines that aren&#x27;t a real place.
评论 #37529703 未加载
评论 #37529874 未加载
评论 #37529906 未加载
WalterBright超过 1 年前
May I present HAMURABI:<p><a href="https:&#x2F;&#x2F;www.atariarchives.org&#x2F;basicgames&#x2F;showpage.php?page=78" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.atariarchives.org&#x2F;basicgames&#x2F;showpage.php?page=7...</a><p>I had a lot of fun playing and modifying that game. Learned a lot about programming with it.
评论 #37531922 未加载
js8超过 1 年前
First, I really appreciate author trying to understand economy better in this way, even though this simulation is quite naive. I think everybody should do that.<p>But as others have noted, it has no concept of capital, private property, and labor market. Therefore, it&#x27;s not capitalism. It&#x27;s not anarchism or communism either - it lacks flexibility of workers to do something else, or state planning telling workers to do something else. At best, it could be a model of a feudal society (where the &quot;state servants&quot; are the landed nobility).<p>Furthermore, it has no concept of natural resources, energy, labor and goods. That has to be there before we even get to things like money.<p>Also, the money definition is problematic. Money is essentially a contract, and can be created even between three private parties as resoldable bonds. This isn&#x27;t there.<p>I would also suggest, if the author (or anybody else) is interested, look at Steve Keen&#x27;s work in economic simulation and his Minsky program. This guy is far ahead of everybody else in actually trying to understand how real economies work.<p>To people who wonder why don&#x27;t we have good economy simulators that would reflect a real world. Well, I think the answer is pretty simple - rich people don&#x27;t want that. They don&#x27;t want plebes to understand what it means to be rich, most rich people know they wealth is undeserved, and don&#x27;t want other people to see it flaunted openly. So they prefer hegemony (in Gramsci terms) of neoliberal economics, which is misleading about what is happening in reality.
评论 #37531068 未加载
评论 #37531064 未加载
评论 #37531473 未加载
评论 #37532135 未加载
评论 #37532869 未加载
gsuuon超过 1 年前
That&#x27;s one of the most entertaining posts I&#x27;ve seen in a while. Would very much like to see a part 2. Also, as an aside, wow are those some tasteful gradients on the recent post links.
blamestross超过 1 年前
Beware optimizing for &quot;average&quot; quality of life, we did that and it worked. Turns out it is more efficient to have a super-minority with a very high QoL. Median is a better target.
teo_zero超过 1 年前
Am I the only one to find the simulation deviate from the description starting from Simulation 8?<p>For example, I see a farmer with 7 food, 7 water and 7 wood, buying water. According to the description, their QoL would be 7 both before and after the transaction, so they are not supposed to buy because there wouldn&#x27;t be an increase of their QoL:<p>&gt; People are potential buyers of the resources that increase their quality of life<p>Additionally the average QoL indicator seems wrong. This is what I see at step 72:<p><pre><code> Farmer 1: 50$ 6 6 5 =&gt; QoL 5 Farmer 2: 90$ 4 4 5 =&gt; 4 Farmer 3: 10$ 7 7 7 =&gt; 7 Avg QoL 3.0 </code></pre> How can 3.0 be the average?
评论 #37534029 未加载
SpaceManNabs超过 1 年前
This website is really cool (not just the post). Thomas must have put a decent amount of work. How to find the secrets?
logicallee超过 1 年前
Great set of simulations!<p>Can someone explain why in Simulation 16, 4 producing workers can support 3 non-producing workers consuming just as much as them with just 10% taxation and yet they have similar QOL? It doesn&#x27;t make sense to me intuitively.<p>If we ignore money and just look at goods this implies 3 people can do &quot;nothing&quot; (the government workers don&#x27;t buy from anyone in this simulation) and yet consume as much as 4 people who do produce, and the 4 taxed people only have to pay 10% taxes while everyone enjoys similar quality of life as 60% taxation.<p>It would be like imagine you have four cartons of ten eggs and you tax 10% of each one. How can you end up with 3 whole cartons just from that taxes, it would only be four eggs, less than half of one carton rather than three extra cartons of the same size as the new reduced carton size of 9.
评论 #37530888 未加载
orangepurple超过 1 年前
Great start! Some things to consider for future versions: more sophisticated tax code, financial regulations, monopsonies, monopolies, collusion, corruption, oligarchies, demand elasticity, cascading effects from supply chain disruptions, central bank quantitative easing.
评论 #37528778 未加载
评论 #37528641 未加载
keskival超过 1 年前
The simulation only has workers&#x2F;producers and it has a free market – it is missing capitalism. To make it realistic you need a subset of people owning the labor output of others, taking out all the surplus, using it to buy stakes of more economic activity, diverting profits to themselves, thus creating the loop of concentration of wealth which removes the surplus wealth from the producers and assigns it to ever decreasing number of ever wealthier individuals.
评论 #37530103 未加载
评论 #37535761 未加载
stephen_g超过 1 年前
If you <i>actually</i> want to simulate an economy, the answer is complex dynamic systems. Traditional static equilibrium models (like Computational General Equilibrium (CGE) or the not actually very dynamic Dynamic Stochastic General Equlibrium (DSGE) models) are pretty useless (they have all these &#x27;nudging&#x27; variables to try and push things towards reality but the actual underlying methodology is bunk).<p>Even weather forecasting moved to dynamical systems models decades ago, economics still hasn&#x27;t caught up.
dools超过 1 年前
This adds money in before it adds the state, or taxation. Money is created through taxation by the state to provision resources away from the private sector to the public purpose.
keithalewis超过 1 年前
<a href="https:&#x2F;&#x2F;www.nobelprize.org&#x2F;prizes&#x2F;economic-sciences&#x2F;1973&#x2F;leontief&#x2F;biographical&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.nobelprize.org&#x2F;prizes&#x2F;economic-sciences&#x2F;1973&#x2F;leo...</a> His ideas might finally become practical to implement. Then again, von Neumann thought weather prediction would be solved in short order after the invention of the computer.
Supply5411超过 1 年前
Simulation 16 is hilarious. By the state dynamically scaling how much they print money in order to support government workers, government workers accumulate more wealth than the producers of goods.
评论 #37529312 未加载
评论 #37529037 未加载
评论 #37529331 未加载
Nezteb超过 1 年前
I&#x27;m a few days late but I just remembered about a tool called Machinations that can be used to design&#x2F;simulate game economies: <a href="https:&#x2F;&#x2F;machinations.io" rel="nofollow noreferrer">https:&#x2F;&#x2F;machinations.io</a>
jfantl超过 1 年前
I did something similar, but started somewhere different: The individuals personal value of a good. You might find it interesting as a different approach to a similar project. <a href="https:&#x2F;&#x2F;jasonfantl.com&#x2F;posts&#x2F;Simulated-Economy-(1)&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;jasonfantl.com&#x2F;posts&#x2F;Simulated-Economy-(1)&#x2F;</a>
评论 #37538062 未加载
nayuki超过 1 年前
The dynamic price simulation reminds me of Primer ( <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;@PrimerBlobs&#x2F;videos">https:&#x2F;&#x2F;www.youtube.com&#x2F;@PrimerBlobs&#x2F;videos</a> ), specifically: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=PNtKXWNKGN8">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=PNtKXWNKGN8</a>
JoshMBN超过 1 年前
I&#x27;m currently in my second year of my Bach degree for Information Technology and I have had this exact same idea but never really knew how to go about it. But I think I might attempt it next year during my A.I. and Data Science paper. Just as proof of concept for neural network practice and learning.
nologic01超过 1 年前
Beautifully made and illustrative of a currently non-existing branch of economic education, if not economic theory itself.<p>While people get to be force-fed all sorts of complex subjects at school, economics does not feature prominently.<p>The result of this widespread economic illiteracy is easily seen at the quality of political discourse.
neilwilson超过 1 年前
I’d love to work on this more. Definitely would like to see it on GitHub.<p>If we’re talking about money printing then we need to talk about money shredding as well.<p>If government prints money to buy thing then taxation feeds old money into the shredder.<p>Print is always matched with a shred.<p>Even bank loans are paid off (shredded)
littlestymaar超过 1 年前
This is fun, but it is as much of an “economy simulator” as Factorio is “logistics simulator”. It&#x27;s not just that it is a simplification, it&#x27;s just completely made up stuff that just looks like “popular understanding of economics”.
fmiras超过 1 年前
I think it’d be very cool if you build a “controls” page where people can configure different variables such as inflation, taxes or market supply of something and you could share your version of simulated economy
dave333超过 1 年前
Prof Steve Keen has developed a free tool called Minsky for economic modeling as well as many models: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;@ProfSteveKeen">https:&#x2F;&#x2F;www.youtube.com&#x2F;@ProfSteveKeen</a>
kamel3d超过 1 年前
In this day and age of AI, I think it&#x27;s worth trying to build a better economy simulator without having any existing economic models in mind. Addressing this from a programming point of view could lead to interesting results.
评论 #37531133 未加载
评论 #37531269 未加载
Calamitous超过 1 年前
I did not expect to read through and run every simulation. But I did.
评论 #37531223 未加载
rsrsrs86超过 1 年前
One way to make this realistic is to add game theory to the simulation. Otherwise, the most important assumption in economics will be left out: rationality in decision making.
评论 #37531129 未加载
throwaway290超过 1 年前
To simulate economy, you need to simulate individuals with their wants and needs and relationships and the environment, as simple (complex) as that.
NoMoreNicksLeft超过 1 年前
This is interesting, in that I&#x27;ve tried to come up with simple simulations like this for strategy games before. But I was a little &quot;eww&quot; when he kicked the number of government workers up to 40% of the workforce. Looks like it goes all the way up to 50%.<p>On simulation #13, where tax is fixed at 10%, the government workers all eventually starve. Surprisingly, the libertarians are correct because at this point the quality of life index abruptly rockets up to twice what it used to be. But there&#x27;s some sort of robotic overlord AI going on, it still collects the tax.<p>But then in simulation #18, things become a little insane. I call this one the Massachusetts simulation... only 3 workers, but 9 government employees. For a 3:1 ratio. The simulation suggests that some sort of economic meltdown occurs and they all starve, but I suspect that things were a little more violent than that.<p>After, the developer then introduces ration tickets. This is simulation #20, and I&#x27;m pretty sure it&#x27;s Zimbabwe. But it&#x27;s not the real world Zimbabwe, it somehow works. That is, if you&#x27;re ok printing trillion dollar bills.<p>Simulation #21 takes a new direction entirely. FDR has been elected, and tries to stamp out competition... but he is too late, evil capitalist farmers have grown too many apples, which perversely leads to starvation. Careful apple quotas are needed. The government has disappeared though, probably because late stage capitalism destroyed it. Only the corporations survive.<p>Surprisingly, no farm subsidies yet. I predict the introduction of a new private sector worker, the ConAgra lobbyist. We&#x27;ll see if he shows up in a later simulation. That is, assuming another government is elected.<p>In simulation #25, one of the warlords has settled down and become a government again. But this is the last of the simulations. No lobbyists, though the central bank has returned. This might be because Andrew Jackson has died. I did not like the man, he will not be missed. But quite clearly the inflation is through the roof again, and 30% taxes are here to stay.<p>What I&#x27;ve learned from these is that history is a lie. Rhodesia probably never existed, and Zimbabwe happened before the US civil war.
评论 #37529187 未加载
评论 #37529927 未加载
bwestergard超过 1 年前
This is super cool, but it models a non-capitalist economy, akin to the Rawlsian &quot;property owning democracy&quot;.<p>There is no accounting for capital goods. Interest in terms of numeraire is modeled in an internally coherent way, but this is not reflective of how distributional struggles between owners of means of production and workers play out (or, to be precise, among agents whose property ownership levels are not unimodal, which is the inevitable result of capitalist social relations).<p>The distinctive characteristic of a capitalist economy is that the direct producers are separated from their means of production, such that they must sell their ability to work to those who own said means. Throughout the modern period, there has been a strong desire to have a market economy without this separation into classes.<p>Without capital and wage labor, the author&#x27;s assumption that terms of exchange are determined by producer&#x2F;consumer preferences (their &quot;quality of life&quot; function). But in reality world capitalist economies, the capital relation instead constrains behavior to ensure the endless expansion of capital (the so-called &quot;valorization imperative&quot;).<p>It is important to note that a society with produced means of production, which are commonly referred to as &quot;capital goods&quot; or &quot;producer goods&quot;, need not be a capitalist society in principle.<p>On a completely different note, at first glance it seems that this model could be expressed as a convex program, possibly even a linear program?
imathew超过 1 年前
&quot;If you wish to build an economy simulator from scratch, you must first invent the universe.&quot;
lainga超过 1 年前
Consider examining different utility functions and substitutable goods
评论 #37531067 未加载
Draiken超过 1 年前
&gt; even though we made public servants numerous and quite rich in the process. This is a communist dream.<p>Aside from this nonsense remark, it was an entertaining post.<p>We should have one that&#x27;s more based on incentives instead. Separate people from companies, create labor and make companies only care about profits at all cost.<p>Finally, add a finite amount of resources and let&#x27;s play it out.
gorenb超过 1 年前
This is amazing.
rsrsrs86超过 1 年前
This is cute but very different from what an economist would consider interesting.
JoeyBananas超过 1 年前
I have also implemented greedy algorithms.
econperplexed超过 1 年前
OT: I see economists of various ideological tilts constantly arguing about how macroeconomic variables will respond to specific government policies. You know: &quot;this new tax will increase inflation; no it will not, it will increase unemployment&quot;.<p>What I don&#x27;t get is why there are no readily available online macroeconomic simulators with real world data that make these sort of predictions. For a lot of countries, up-to-date macroeconomic and demographic is readily available.<p>Surely, economists of every ideological tilt have their own standard model of macroeconomics [1] which they use to make rough predictions? If not, how complicated is it really?<p>[1] Much like the standard model of particle physics or of cosmology. Fairly dirty and complicated models with lots of tunable parameters.
评论 #37529035 未加载
评论 #37529396 未加载
评论 #37530312 未加载
评论 #37529064 未加载
评论 #37529018 未加载
评论 #37531131 未加载
评论 #37529783 未加载
评论 #37529764 未加载
评论 #37528962 未加载
评论 #37529234 未加载
Supply5411超过 1 年前
Where are the bad actors who exploit the system to steal from everyone? No economic simulator is complete without this.<p>Edit&gt;&gt; It appears to be the state.
评论 #37529271 未加载
jampekka超过 1 年前
No banks, no capital, no capitalists living off the workers&#x27; labour. This is not even close how the economy works.
评论 #37529805 未加载
评论 #37529276 未加载
amelius超过 1 年前
Sounds like something an LLM could help with. You could write rules in natural language, and the system would automatically convert it into simple code.
评论 #37541112 未加载