TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Ecosim – A cellular ecosystem simulator toy for Linux written in C

150 pointsby connor-brooksabout 5 years ago

14 comments

apiabout 5 years ago
Reminds me of something I wrote years ago:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;adamierymenko&#x2F;nanopond" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;adamierymenko&#x2F;nanopond</a><p>Ecosim has prettier graphics and seems more high level and concerned with ecology, while nanopond is more about just open ended program evolution (including the rise of self-replicators ex nihilo... it starts by just generating totally random programs).
评论 #22438667 未加载
eigenvalueabout 5 years ago
This seems very cool. I would recommend including an animated gif or link to a YouTube video showing the results of the simulation under a variety of settings&#x2F;parameters. Also, this would probably get a lot more traction if it used web technologies WASM and webgl. Would be cool to combine this with an evolutionary algorithm similar to the Scriptbots project by Karpathy.
评论 #22438361 未加载
sandovabout 5 years ago
For some reason it complained about GLFW_TRUE not being declared, but I just replaced it in the source code with a literal 1 and then it worked.
rvzabout 5 years ago
Very cool! However, I don&#x27;t see why this has to be so specific for Linux from when by judging from the libraries used it can be also compiled for MingW, macOS, Free&#x2F;Open&#x2F;NetBSD, QNX and even surprising Haiku.<p>But a very interesting project nevertheless.
评论 #22438369 未加载
_slyoabout 5 years ago
Very cool. I have dreamed of building something similar. I would be interested in these modifications:<p>1. Change living&#x2F;non-living distinction of food to two different dimensions, shared by living and non living food alike: * Composition - arbitrary bits to match against a consuming organism&#x27;s diet * Defense - arbitrary bits to match against consuming organism&#x27;s capabilities, might be a function of energy level for living food<p>2. Organisms leave behind waste as part of eating and&#x2F;or moving. Waste left behind is food for other organisms<p>This might allow for the rise of symbiosis and multicellular organisms
评论 #22442886 未加载
RawChickenabout 5 years ago
Anyone interested on this might also be interested in an mobile app called &quot;Cell Lab: Evolution Sandbox&quot; [1], which does a good take on a cell simulation &quot;game&quot;.<p>[1] <a href="https:&#x2F;&#x2F;www.cell-lab.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.cell-lab.net&#x2F;</a>
diathabout 5 years ago
It looks pretty interesting but unfortunately I&#x27;m unable to run the demo, getting a crash in glDrawElements which is sort of outside of my scope to address. As a side note the debug symbols flag doesn&#x27;t get passed to individual C files so the binary ends up without debugging symbols (as a workaround I moved the -g3 flag to CC variable instead).
评论 #22437893 未加载
评论 #22438402 未加载
Icathianabout 5 years ago
Seems like a really cool project.<p>If you&#x27;re at all concerned with keeping it reasonably easy to find, you may want to know that the name Ecosim is in use by software for simulation modeling of trophic energy flows in ecosystems.<p><a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;EcoSim" rel="nofollow">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;EcoSim</a>
评论 #22438379 未加载
airstrikeabout 5 years ago
Very cool! I wonder if anyone has done something similar but for people and companies in an economy... it&#x27;s my dream pet project, but I&#x27;ve never even gotten around to researching where to begin.
bchabout 5 years ago
How would you like to license this code?
kazinatorabout 5 years ago
Very decent, readable coding style.
DonHopkinsabout 5 years ago
Here&#x27;s another ecology oriented cellular automata rule called ECOLIBRA, a cross between LIFE, BRAIN (and optionally ANNEAL on the bit plane that determines water&#x2F;land), from John Walker&#x27;s and Rudy Rucker&#x27;s classic CelLab (which Autodesk originally published as a PC application, but John Walker has ported to JavaScript):<p><a href="https:&#x2F;&#x2F;www.fourmilab.ch&#x2F;cellab&#x2F;manual&#x2F;rules.html#EcoLiBra" rel="nofollow">https:&#x2F;&#x2F;www.fourmilab.ch&#x2F;cellab&#x2F;manual&#x2F;rules.html#EcoLiBra</a><p>&gt;ECOLIBRA<p>&gt;This rule is a cross between Life and Brain. The basic idea is that the cells are divided between dark “sea” cells and light “land” cells. We run Brain in the sea, and on land we run not Life but AntiLife. All the land cells are normally firing cells, and the presence of an active AntiLife cell is signaled by having a land cell which is not firing. Full details on EcoLiBra are in the Cellular Automata Theory chapter.<p>&gt;The name EcoLiBra suggests 1) an ecology of Life and Brain, 2) a balanced situation (equilibrium), and 3) the human intestinal bacteria Escherichia coli, known as E. coli for short. The third connection is perhaps a bit unsavory, but remember that E. coli cells are in fact the favorite “guinea pigs” for present day gene splicing experiments. As one of the goals of CelLab is to promote the development of artificial life, the designer gene connection is entirely appropriate. I&#x27;ve given EcoLiBra a nice, symmetric start pattern, but it also does fine if you use the Bit Plane Editor to randomize all bit planes.<p><a href="https:&#x2F;&#x2F;www.fourmilab.ch&#x2F;cellab&#x2F;manual&#x2F;chap4.html#EcoLiBra" rel="nofollow">https:&#x2F;&#x2F;www.fourmilab.ch&#x2F;cellab&#x2F;manual&#x2F;chap4.html#EcoLiBra</a><p>&gt;The EcoLiBra rule, consisting of Brain and AntiLife, each turned on by the red&#x2F;black boundary.<p>&gt;But when the sea runs Brain and the land runs Life, the situation is no longer symmetrical. The pervasive presence of Brain&#x27;s refractory state makes it less likely for a sea cell to have seven firing neighbors and be turned into a land cell. Unless we change the transition rules, the land will always melt away. So to give land a fighting chance, I now say that a sea cell becomes land if it has seven or six firing neighbors. Also I use better colors: Black, blue, and green for Brain; red and yellow for AntiLife.<p>Here is a variant I call &quot;ECO&quot; that runs &quot;ANNEAL&quot; on the water&#x2F;land plane, and (for giggles) a heat diffusion in the upper left-over planes.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;SimHacker&#x2F;CAM6&#x2F;blob&#x2F;master&#x2F;javascript&#x2F;CAM6.js#L3331" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;SimHacker&#x2F;CAM6&#x2F;blob&#x2F;master&#x2F;javascript&#x2F;CAM...</a><p>Here are the guts of the rule (omitting the heat diffusion layer calculation):<p><pre><code> var cell = 0; var sum9Anneal = ((nw &amp; 0x04) + (n &amp; 0x04) + (ne &amp; 0x04) + (w &amp; 0x04) + (c &amp; 0x04) + (e &amp; 0x04) + (sw &amp; 0x04) + (s &amp; 0x04) + (se &amp; 0x04)) &gt;&gt; 2; var anneal = ((sum9Anneal &gt; 5) || (sum9Anneal == 4)) ? 4 : 0; cell |= anneal; var sum8 = (nw &amp; 1) + (n &amp; 1) + (ne &amp; 1) + (w &amp; 1) + (e &amp; 1) + (sw &amp; 1) + (s &amp; 1) + (se &amp; 1); if (anneal) { &#x2F;&#x2F; Anti-Life cell |= ((c &amp; 1) &lt;&lt; 1); if (c &amp; 1) { if (sum8 != 5) { cell |= 0x01; } } else { if ((sum8 != 5) &amp;&amp; (sum8 != 6)) { cell |= 0x01; } } } else { &#x2F;&#x2F; Brain cell |= (c &lt;&lt; 1) &amp; 2; if ((c &amp; 3) == 0) { if (sum8 == 2) { cell |= 1; } } } </code></pre> The CelLab user&#x27;s guide and Rudy Rucker&#x27;s recounting of the origins of CelLab and his experience with Margolus and Toffoli&#x27;s CAM6 is especially delightful.<p><a href="https:&#x2F;&#x2F;www.fourmilab.ch&#x2F;cellab&#x2F;manual&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.fourmilab.ch&#x2F;cellab&#x2F;manual&#x2F;</a><p><a href="https:&#x2F;&#x2F;www.fourmilab.ch&#x2F;cellab&#x2F;manual&#x2F;chap5.html" rel="nofollow">https:&#x2F;&#x2F;www.fourmilab.ch&#x2F;cellab&#x2F;manual&#x2F;chap5.html</a><p>Bennett shows me another pattern, one that looks like boiling red cottage cheese, and then he takes me across the Charles River to the MIT Laboratory of Computer Science. In the basement is an exuberant French scientist named Gérard Vichniac. He and an associate are watching a small rectangular dot-pattern in the center of their terminal&#x27;s screen. The pattern is mostly white, with a small amount of red in it. The edges keep folding in on each other as the pattern evolves according to some simple rule which Vichniac made up. He calls it an “Ising Model,” but it looks like an electronic kaleidoscope. “This pattern started as a red square,” Vichniac tells me. “The rule is reversible, so we know that eventually the red square must come back. We&#x27;ve been watching it for eighty thousand steps now”.<p>Upstairs from Vichniac are two equally cheerful cellular automata specialists, Norman Margolus and Tommaso Toffoli. There&#x27;s another journalist there, a guy from Rolling Stone.[Footnote] Cellular automata are hot. I introduce myself and sit down to watch the demonstration. Right now there&#x27;s a central cloud of dots, with square little patterns flying out of it. On the sides of each of the square patterns are individual pixels that pump up and down.<p>“Look at the critters, Tom,” says Margolus. “They look like rowers, don&#x27;t they?”[Footnote]<p>“Show him the square rock,” says Toffoli.<p>Margolus clears the screen and keys a big red square into the center. The square expands out to the edges of the screen and bounces back. As the bouncing continues, the patterns interfere and form complex checkerboard patterns, enough patterns in thirty seconds to have made a respectable one-man Op-Art show in the 1960s.<p>Toffoli pries Margolus away from the controls and takes over. “Now we do the square rock in the toroidal pond again, but this time we add a heat-bath, a cloud of random gas in the background.”<p>The background fills with darting dots, and Toffoli keys another big red square into the center. This time the waves are smooth and roughly circular, much like real waves in a real pond. We try it with two squares and get interference patterns. Toffoli is pleased. He says that this shows how simple physics really is.<p>[...]<p>After watching the CAM in operation at Margolus&#x27;s office, I am sure the thing will be a hit. Just as the Moog synthesizer changed the sound of music, cellular automata will change the look of video.<p>I tell this to Toffoli and Margolus, and they look unconcerned. What they care most deeply about is science, about Edward Fredkin&#x27;s vision of explaining the world in terms of cellular automata and information mechanics. Margolus talks about computer hackers, and how a successful program is called “a good hack.” As the unbelievably bizarre cellular automata images flash by on his screen, Margolus leans back in his chair and smiles slyly. And then he tells me his conception of the world we live in.<p>“The universe is a good hack.”<p>[...]<p>Margolus and Toffoli&#x27;s CAM-6 board was finally coming into production around then, and I got the Department to order one. The company making the boards was Systems Concepts of San Francisco; I think they cost $1500. We put our order in, and I started phoning Systems Concepts up and asking them when I was going to get my board. By then I&#x27;d gotten a copy of Margolus and Toffoli&#x27;s book, Cellular Automata Machines, and I was itching to start playing with the board. And still it didn&#x27;t come. Finally I told System Concepts that SJSU was going to have to cancel the purchase order. The next week they sent the board. By now it was August, 1987.<p>The packaging of the board was kind of incredible. It came naked, all by itself, in a plastic bag in a small box of styrofoam peanuts. No cables, no software, no documentation. Just a three inch by twelve inch rectangle of plastic—actually two rectangles one on top of the other—completely covered with computer chips. There were two sockets at one end. I called Systems Concepts again, and they sent me a few pages of documentation. You were supposed to put a cable running your graphics card&#x27;s output into the CAM-6 board, and then plug your monitor cable into the CAM-6&#x27;s other socket. No, Systems Concepts didn&#x27;t have any cables, they were waiting for a special kind of cable from Asia. So Steve Ware, one of the SJSU Math&amp;CS Department techs, made me a cable. All I needed then was the software to drive the board, and as soon as I phoned Toffoli he sent me a copy.<p>Starting to write programs for the CAM-6 took a little bit of time because the language it uses is Forth. This is an offbeat computer language that uses reverse Polish notation. Once you get used to it, Forth is very clean and nice, but it makes you worry about things you shouldn&#x27;t really have to worry about. But, hey, if I needed to know Forth to see cellular automata, then by God I&#x27;d know Forth. I picked it up fast and spent the next four or five months hacking the CAM-6.
rogerclarkabout 5 years ago
ultra sick project dude!
评论 #22437698 未加载
anthkabout 5 years ago
Does it run under OpenGL 2.1? My laptop is a bit... obsolete.