HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
SimHacker
CAM6
JavaScript2014–2026
SimHacker / CAM6

CAM6

Cellular Automata Machine (CAM6) Simulator

2Distinct people
31Mentions
1Explicit recommenders
35GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Cellular Automata Machine (CAM6) Simulator

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

Wow! If you ever get tired of it I will buy it from you. It's impossible to find copies now, and they make great wedding or graduation presents. ;) Just joking, I know you…

DonHopkins used a recommendation phrase. 4 indexed comments match. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 9:02:44 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year31 dated mentions

Observed mentions: 2014-11-11 18:52:34 UTC to 2026-07-20 10:01:23 UTC.

02462014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 6 mentions; 0 submissions, 6 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC101
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC101
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC202
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC606
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC202
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC101
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC505
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC000
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC505
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC202
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC101
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC202
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC303

What Hacker News says

5 sources
That's one of my long time interests and hobbies, which I write about on HN and discuss with other people frequently. I'm supposed to be doing something else right now so I'll quickly drop a few disorganized quotes and links here. (Sorry I didn't have time to be more concise!) A few years ago I ran across Max Bittker's beautiful "Sandspiel", which is a delightful cellular automata toy that simulates sand and other rules: https://sandspiel.club/ A few days ago I saw him tweet some amazing stuff that resonated with me, which then led me to discover what he's been working with Lu Wilson (TodePond): Sandspiel Studio -- user definable rules using a block based visual programming language. https://twitter.com/maxbittker "working on goth fungus kidpix": https://twitter.com/maxbittker/status/1593868837111451649 Lu Wilson (TodePond): https://twitt
Read the rest
er.com/TodePond Sandspiel Studio: https://studio.sandspiel.club/ Sandspiel introduction: https://www.youtube.com/watch?v=ecCVor7mJ6o Sandspiel Studio in 60 seconds: https://www.youtube.com/watch?v=qOA-lR3Xc34 Rainbow Sand: https://www.youtube.com/watch?v=PGTsy79wx4U Huegene: https://www.youtube.com/watch?v=ltpkO7jcFOY Flower: https://www.youtube.com/watch?v=ifyYITDq1oo TodePond's Spellular Automata: https://www.youtube.com/watch?v=xvlsJ3FqNYU We had a great discussion on the Sandspiel Studio Discord server, where I posted some interesting links: Check out the Long Now Foundation talk by Brian Eno and Will Wright about Generative Systems: 10:39 minute excerpt of Will talking about cellular automata and demonstrating with Mirak's Cellebration: https://www.youtube.com/watch?v=UqzVSvqXJYg 6:48 minute excerpt of Will demonstrating Spore Metaverses: https://www.youtube.com/watch?v=7t0kuvz5x_4 6:29 minute excerpt of Will demonstrating Spore Creature Demo: https://www.youtube.com/watch?v=8PXiNNXUUF8 Entire 1:38:50 hour Long Now Foundation talk: Playing with Time | Brian Eno and Will Wright https://www.youtube.com/watch?v=Dfc-DQorohc Craig Reynolds said the name "Boids" was inspired by The Producers Concierge scene, so that's how you should pronounce it: Boids. Dirty, disgusting, filthy, lice ridden Boids. Boids. You get my drift? https://www.youtube.com/watch?v=aL6mTMShVyk The other really cool rabbit hole to explore for generating tiles and even arbitrary graph based content (I'm sold: hexagons are the bestagons!) is "Wave Function Collapse", which doesn't actually have anything to do with quantum mechanics (it just sounds cool), but is actually a kind of constraint solver related to sudoku solvers. https://escholarship.org/content/qt3rm1w0mn/qt3rm1w0mn_noSpl... Maxim Gumin's work: https://github.com/mxgmn/WaveFunctionCollapse Paul Merrell's work: https://paulmerrell.org/model-synthesis/ https://paulmerrell.org/research/ Oskar Stålberg's work: https://twitter.com/OskSta/status/784847588893814785 https://oskarstalberg.com/game/wave/wave.html There's a way to define cellular automata rules by giving examples of the before and after patterns, and WFC is kind of like a statistical constraint solving version of that. So it's really easy for artists to define rules just by drawing! Not even requiring any visual programming, but you can layer visual programming on top of it. That's something that Alexander Repenning's "AgentSheets" supported (among other stuff): you could define cellular automata rules by before-and-after examples, wildcards and variables, and attach additional conditions and actions with a visual programming language. AgentSheets and other cool systems are described in this classic paper: “A Taxonomy of Simulation Software: A work in progress” from Learning Technology Review by Kurt Schmucker at Apple. It covered many of my favorite systems. http://donhopkins.com/home/documents/taxonomy.pdf Chaim Gingold wrote a comprehensive "Gadget Background Survey" at HARC, which includes AgentSheets, Alan Kay's favorites: Rockey’s Boots and Robot Odyssey, and Chaim's amazing SimCity Reverse Diagrams and lots of great stuff I’d never seen before: http://chaim.io/download/Gingold%20(2017)%20Gadget%20(1)%20S... Chaim Gingold has analyzed the SimCity (classic) code and visually documented how it works, in his beautiful "SimCity Reverse Diagrams": >SimCity reverse diagrams: Chaim Gingold (2016). >These reverse diagrams map and translate the rules of a complex simulation program into a form that is more easily digested, embedded, disseminated, and and discussed (Latour 1986). >The technique is inspired by the game designer Stone Librande’s one page game design documents (Librande 2010). If we merge the reverse diagram with an interactive approach—e.g. Bret Victor’s Nile Visualization (Victor 2013), such diagrams could be used generatively, to describe programs, and interactively, to allow rich introspection and manipulation of software. >Latour, Bruno (1986). “Visualization and cognition”. In: Knowledge and Society 6 (1986), pp. 1– 40. Librande, Stone (2010). “One-Page Designs”. Game Developers Conference. 2010. Victor, Bret (2013). “Media for Thinking the Unthinkable”. MIT Media Lab, Apr. 4, 2013. https://lively-web.org/users/Dan/uploads/SimCityReverseDiagr... Agentsheets: Alexander Repenning (1993–) Interacting agents are embedded and interact within cellular spaces called sheets. Agents are reactive to direct manipulation and have autonomous behavior. Agent Sheets draws upon a similarly spirited broad field of paradigms: artificial life, visual programming, “programmable drawing tools,” “simulation environments”, games, cellular automata, and “spreadsheet extensions.” Repenning draws upon these shared characteristics: visual, spatial notation, dynamic, direct manipulation, and incremental agency. The basic tool palette is also a gallery, defined in simulation terms. Highlights: • Kits (“agencies”) describe specific domains. One effect of “|ayered” design is “roles”—end-users vs. scenario designers. Example domains in thesis: Turing machines, circuits, flow, traffic, programs. • Sheet is a cellular 2d space, but agents can be stacked up in a cell. • Incremental refinement of art, behavior, etc… • A highly generalize idea of flow is used for things like neural nets, flow charts, water flow, circuits, system dynamic style models, and traffic. • It also supports ecological style spatial simulations. • User interaction and agent communication is in the same representation. i.e. Anything can do to one another everything the user can. AgentSheets is still going, and has even gone all 3D like Minecraft! AgentCubes! https://agentsheets.com/ Another great visual programming language for kids that supported defining cellular automata rules by example and visual programming: KidSim (later Cocoa, then Stagecast Creator) Smith, David C., Allen Cypher, and James Spohrer (1994) In KidSim graphical simulations are created via graphical rewrite rules, which also enables a kind of programming by demonstration. The creators argue that most people can use editor GUIs (e.g. paint programs), and can give directions, but cannot program. Their solution is to “get rid of the programming language” in favor of a philosophy grounded in GUI design: • Visibility. Relevant information is visible; causality is clear; modelessness. • Copy and modify, not make from scratch. • See and point, not remember and type. • Concrete, not abstract. • Familiar conceptual model. (“minimum translation distance”). They choose a symbolic simulation microworld as a domain because it leads to knowing, ownership, and motivation. All objects are agents which have appearances, properties (name value pairs), and rules. Programming by demonstration extends to using a calculator and dragging properties around to define conditionals. One of the creators of KidSim, David Smith, was also the creator of another graphical programming environment: Pygmalion. Smith, David C., Allen Cypher, and James Spohrer (1994) (Then I ran across TodePond's Spellular Automata video and realized I was preaching to the choir! TodePond wrote: "and stagecast creator is a big inspiration to me! I name-dropped it in a demo I did this week :D") Wow I did not realize I was evangelizing to the choir! This video by TodePond, is exactly what I was talking about, just much more beautiful than I'd imagined possible: https://www.youtube.com/watch?v=xvlsJ3FqNYU I was watching Lex Fredman interview Michael Levin, and Lex expressed the same level of fascination about cellular automata that I have: Michael Levin: Michael Levin: Biology, Life, Aliens, Evolution, Embryogenesis & Xenobots | Lex Fridman Podcast #325 https://www.youtube.com/watch?v=p3lsYlod5OU 1:44:29: Lex: Whenever I think about something like unconventional cognition, I think about cellular automata. I'm just captivated by the beauty of the thing. The fact that from simple little objects you can create such beautiful complexity that very quickly you forget about the individual objects and you see the things that it creates as its own organisms. That blows my mind every time. Like honestly I could full time just eat mushrooms and watch cellular automata. I don't even have to do mushrooms. Cellular automata, it feels like from the engineering perspective, I love when a very simple system captures something really powerful. Because then you can study that system to understand something fundamental about complexity, about life on earth. Anyway how Do I communicate with the thing? If a cellular automata can do cognition, if a plant can do cognition, if a xenobot can do cognition, how do I whisper in its ear and get an answer back, too? How do I have a conversation? How do I have a xenobot on the podcast? Then I watched Lex interview Steven Wolfram: https://www.youtube.com/watch?v=ez773teNFYA Stephen Wolfram: Cellular Automata, Computation, and Physics | Lex Fridman Podcast #89 - YouTube https://www.youtube.com I hate it when a program I wrote mocks me. In Lex Fridman's interview of Steven Wolfram, he demonstrates the machine learning functions in Mathematica by taking a photo of himself, which identifies him as a .... (I won't give it away): https://www.youtube.com/watch?v=ez773teNFYA&t=2h20m05s Here's a video I recently recorded of the CAM-6 simulator I implemented decades ago, and rewrote in JavaScript a few years ago. https://www.youtube.com/watch?v=LyLMHxRNuck I recorded that demo to show to Norman Margolus, who co-wrote the book and wrote the CAM6 PC Forth code and many rules, so it's pretty long and technical and starts out showing lots of code, but I'm sure you'll totally get and appreciate it. I linked to a pdf copy of the book in the comments, as well as the source code and playable app. Demo of Don Hopkins' CAM6 Cellular Automata Machine simulator. Live App: https://donhopkins.com/home/CAM6 Github Repo: https://github.com/SimHacker/CAM6/ Javacript Source Code: https://github.com/SimHacker/CAM6/blob/master/javascript/CAM... PDF of CAM6 Book: https://donhopkins.com/home/cam-book.pdf Comments from the code: // This code originally started life as a CAM6 simulator written in C // and Forth, based on the original CAM6 hardware and compatible with // the brilliant Forth software developed by Toffoli and Margolus. But // then it took on a life of its own (not to mention a lot of other CA // rules), and evolved into supporting many other cellular automata // rules and image processing effects. Eventually it was translated to // C++ and Python, and then more recently it has finally been // rewritten from the ground up in JavaScript. // The CAM6 hardware and Forth software for defining rules and // orchestrating simulations is thoroughly described in this wonderful // book by Tommaso Toffoli and Norman Margolus of MIT. // Cellular Automata Machines: A New Environment for Modeling // Published April 1987 by MIT Press. ISBN: 9780262200608. // http://mitpress.mit.edu/9780262526319/ Here's another demo I recorded a while ago that shows more rules: https://www.loom.com/share/cc09b916134b43cea201b61e71432f32 Making a Falling Sand Simulator: https://news.ycombinator.com/item?id=31309616 Oh My Gosh, It's Covered in Rule 30s: https://news.ycombinator.com/item?id=14458955 Wolfram Rule 30 Prizes: https://news.ycombinator.com/item?id=21130098 Finding Mona Lisa in the Game of Life: https://news.ycombinator.com/item?id=22552006 Andrew Wuensche's and Mike Lesser's gorgeous coffee table book, "The Global Dynamics of Cellular Automata": https://news.ycombinator.com/item?id=22570750 Here's some stuff about Dave Ackley's "Robust First Computing" and "Moveable Feast Machine": https://news.ycombinator.com/item?id=22304063 DonHopkins on Feb 11, 2020 | parent | context | favorite | on: Growing Neural Cellular Automata: A Differentiable... Also check out the "Moveable Feast Machine", Robust-first Computing, and this Distributed City Generation example: https://news.ycombinator.com/item?id=21858577 DonHopkins on Oct 26, 2017 | parent | favorite | on: Cryptography with Cellular Automata (1985) [pdf] A "Moveable Feast Machine" is a "Robust First" asynchronous distributed fault tolerant cellular-automata-like computer architecture. It's similar to a Cellular Automata, but it different in several important ways, for the sake of "Robust First Computing". These differences give some insight into what CA really are, and what their limitations are. Cellular Automata are synchronous and deterministic, and can only modify the current cell: all cells are evaluated at once (so the evaluation order doesn't matter), so it's necessary to double buffer the "before" and "after" cells, and the rule can only change the value of the current (center) cell. Moveable Feast Machines are like asynchronous non-deterministic cellular automata with large windows that can modify adjacent cells. Here's a great example with an amazing demo and explanation, and some stuff I posted about it earlier: https://news.ycombinator.com/item?id=14236973 Robust-first Computing: Distributed City Generation: https://www.youtube.com/watch?v=XkSXERxucPc https://news.ycombinator.com/item?id=22304110 DonHopkins on Feb 11, 2020 | parent | context | favorite | on: Growing Neural Cellular Automata: A Differentiable... Dave Ackley, who developed the Moveable Feast Machine, had some interesting thoughts about moving from 2D to 3D grids of cells: https://news.ycombinator.com/item?id=21131468 DonHopkins 4 months ago | parent | favorite | on: Wolfram Rule 30 Prizes Very beautiful and artistically rendered! Those would make great fireworks and weapons in Minecraft! From a different engineering perspective, Dave Ackley had some interesting things to say about the difficulties of going from 2D to 3D, which I quoted in an earlier discussion about visual programming: https://news.ycombinator.com/item?id=18497585 David Ackley, who developed the two-dimensional CA-like "Moveable Feast Machine" architecture for "Robust First Computing", touched on moving from 2D to 3D in his retirement talk: https://youtu.be/YtzKgTxtVH8?t=3780 "Well 3D is the number one question. And my answer is, depending on what mood I'm in, we need to crawl before we fly." "Or I say, I need to actually preserve one dimension to build the thing and fix it. Imagine if you had a three-dimensional computer, how you can actually fix something in the middle of it? It's going to be a bit of a challenge." "So fundamentally, I'm just keeping the third dimension in my back pocket, to do other engineering. I think it would be relatively easy to imaging taking a 2D model like this, and having a finite number of layers of it, sort of a 2.1D model, where there would be a little local communication up and down, and then it was indefinitely scalable in two dimensions." "And I think that might in fact be quite powerful. Beyond that you think about things like what about wrap-around torus connectivity rooowaaah, non-euclidian dwooraaah, aaah uuh, they say you can do that if you want, but you have to respect indefinite scalability. Our world is 3D, and you can make little tricks to make toruses embedded in a thing, but it has other consequences." Here's more stuff about the Moveable Feast Machine: https://news.ycombinator.com/item?id=15560845 https://news.ycombinator.com/item?id=14236973 The most amazing mind blowing demo is Robust-first Computing: Distributed City Generation: https://www.youtube.com/watch?v=XkSXERxucPc And a paper about how that works: https://www.cs.unm.edu/~ackley/papers/paper_tsmall1_11_24.pd... Plus there's a lot more here: https://movablefeastmachine.org/ Now he's working on a hardware implementation of indefinitely scalable robust first computing: https://www.youtube.com/channel/UC1M91QuLZfCzHjBMEKvIc-A John von Neumann's 29 State Cellular Automata https://news.ycombinator.com/item?id=22304084 John von Neumann's book "Theory of Self-Reproducing Automata": https://news.ycombinator.com/item?id=21858465 Factorio, and Will Wright on simulation games: https://news.ycombinator.com/item?id=24163024
In Ask HN: What weird technical scene are you fond/part of?
https://news.ycombinator.com/item?id=22738268 DonHopkins on March 31, 2020 | parent | context | favorite | on: Von Neumann Universal Constructor Here's some stuff about that I posted in an earlier discussion, and transcribed from his book, "Theory of Self-Reproducing Automata". His concept of self-reproducing mutating probabilistic quantum mechanical machine evolution is quite fascinating and terrifying at the same time (or outside of time), potentially much more powerful and dangerous than mere physical nanotechnology "gray goo" and universe-infesting self replicating von Neumann probes: Can Programming Be Liberated from the von Neumann Style? (1977) [pdf] (thocp.net) https://news.ycombinator.com/item?id=21855249 https://news.ycombinator.com/item?id=21858465 John von Neuman's 29 state cellular automata machine is (ironically) a classical
Read the rest
decidedly "non von Neumann architecture". https://en.wikipedia.org/wiki/Von_Neumann_cellular_automaton He wrote the book on "Theory of Self-Reproducing Automata": https://archive.org/details/theoryofselfrepr00vonn_0 He designed a 29 state cellular automata architecture to implement a universal constructor that could reproduce itself (which he worked out on paper, amazingly): https://en.wikipedia.org/wiki/Von_Neumann_universal_construc... He actually philosophized about three different kinds of universal constructors at different levels of reality: First, the purely deterministic and relatively harmless mathematical kind referenced above, an idealized abstract 29 state cellular automata, which could reproduce itself with a Universal Constructor, but was quite brittle, synchronous, and intolerant of errors. These have been digitally implemented in the real world on modern computing machinery, and they make great virtual pets, kind of like digital tribbles, but not as cute and fuzzy. https://github.com/SimHacker/CAM6/blob/master/javascript/CAM... Second, the physical mechanical and potentially dangerous kind, which is robust and error tolerant enough to work in the real world (given enough resources), and is now a popular theme in sci-fi: the self reproducing robot swarms called "Von Neumann Probes" on the astronomical scale, or "Gray Goo" on the nanotech scale. https://en.wikipedia.org/wiki/Self-replicating_spacecraft#Vo... https://grey-goo.fandom.com/wiki/Von_Neumann_probe >The von Neumann probe, nicknamed the Goo, was a self-replicating nanomass capable of traversing through keyholes, which are wormholes in space. The probe was named after Hungarian-American scientist John von Neumann, who popularized the idea of self-replicating machines. Third, the probabilistic quantum mechanical kind, which could mutate and model evolutionary processes, and rip holes in the space-time continuum, which he unfortunately (or fortunately, the the sake of humanity) didn't have time to fully explore before his tragic death. p. 99 of "Theory of Self-Reproducing Automata": >Von Neumann had been interested in the applications of probability theory throughout his career; his work on the foundations of quantum mechanics and his theory of games are examples. When he became interested in automata, it was natural for him to apply probability theory here also. The Third Lecture of Part I of the present work is devoted to this subject. His "Probabilistic Logics and the Synthesis of Reliable Organisms from Unreliable Components" is the first work on probabilistic automata, that is, automata in which the transitions between states are probabilistic rather than deterministic. Whenever he discussed self-reproduction, he mentioned mutations, which are random changes of elements (cf. p. 86 above and Sec. 1.7.4.2 below). In Section 1.1.2.1 above and Section 1.8 below he posed the problems of modeling evolutionary processes in the framework of automata theory, of quantizing natural selection, and of explaining how highly efficient, complex, powerful automata can evolve from inefficient, simple, weak automata. A complete solution to these problems would give us a probabilistic model of self-reproduction and evolution. [9] [9] For some related work, see J. H. Holland, "Outline for a Logical Theory of Adaptive Systems", and "Concerning Efficient Adaptive Systems". https://www.deepdyve.com/lp/association-for-computing-machin... https://deepblue.lib.umich.edu/bitstream/handle/2027.42/5578... https://www.worldscientific.com/worldscibooks/10.1142/10841 Ericson2314 3 months ago [-] > Although I refer to conventional languages as "von Neumann languages" to take note of their origin and style, I do not, of course, blame the great mathematician for their complexity. In fact, some might say that I bear some responsibility for that problem. From the paper. Whew.
In Theory of Self Reproducing Automata (1966) [pdf]
Typically a cellular automata simulation will have some edge condition like wrapping or mirroring an adjacent cell. A nice optimization trick is to make the cell buffers 2 cells wider and taller (or two times whatever the neighborhood radius is), and then before each generation you update the "gutter" by copying just the wrapped (or mirrored) pixels. Then your run the rule on the inset rectangle, and the code (in the inner loop) doesn't have to do bounds checking, and can assume there's a valid cell to read in all directions. That saves a hell of a lot of tests and branches in the inner loop. Also, you you can define the Margolus neighborhood in terms of the Moore neighborhood + horizontal phase (even/odd column x) + vertical phase (even/odd row y) + time phase (even/odd time). With that information the rule can tell if it's at an even or
Read the rest
odd step, and which of the four squares of the grid it's in. That's how the CAM6 worked in hardware: it used the x/y/time phases as additional bits to determine the Margolus neighborhood lookup table index. https://github.com/SimHacker/CAM6/blob/master/javascript/CAM... Here's how my CAM6 emulator computes the CAM6-hardware-compatible Margolus lookup table index, based on the 9 Moore neighbors + phaseTime, phaseX, and phaseY: function getTableIndexUnrotated( nw, n, ne, w, c, e, sw, s, se, phaseTime, phaseX, phaseY) { // 0 1 2 3 4 5 6 7 8 9 // c0 c1 cw0 ccw0 opp0 cw1 ccw1 opp1 pha0 pha1 // 0x1 0x2 0x4 0x8 0x10 0x20 0x40 0x80 0x100 0x200 var cw, ccw, opp; if (phaseTime) { return ( // c c' (c & 0x03) | // cw cw' (cw = (phaseX ? (phaseY ? (e & 0x03) : (n & 0x03)) : (phaseY ? (s & 0x03) : (w & 0x03))), (((cw & 0x01) << 2) | ((cw & 0x02) << 4))) | // ccw ccw' (ccw = (phaseX ? (phaseY ? (s & 0x03) : (e & 0x03)) : (phaseY ? (w & 0x03) : (n & 0x03))), (((ccw & 0x01) << 3) | ((ccw & 0x02) << 5))) | // opp opp' (opp = (phaseX ? (phaseY ? (se & 0x03) : (ne & 0x03)) : (phaseY ? (sw & 0x03) : (nw & 0x03))), (((opp & 0x01) << 4) | ((opp & 0x02) << 6))) | // pha pha' 0x200); } else { return ( // c c' (c & 0x03) | // cw cw' (cw = (phaseX ? (phaseY ? (w & 0x03) : (s & 0x03)) : (phaseY ? (n & 0x03) : (e & 0x03))), (((cw & 0x01) << 2) | ((cw & 0x02) << 4))) | // ccw ccw' (ccw = (phaseX ? (phaseY ? (n & 0x03) : (w & 0x03)) : (phaseY ? (e & 0x03) : (s & 0x03))), (((ccw & 0x01) << 3) | ((ccw & 0x02) << 5))) | // opp opp' (opp = (phaseX ? (phaseY ? (nw & 0x03) : (sw & 0x03)) : (phaseY ? (ne & 0x03) : (se & 0x03))), (((opp & 0x01) << 4) | ((opp & 0x02) << 6))) | // pha pha' 0x100); } };
In Making a falling sand simulator

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.