Skip to content

Comment on Asynchronous Life, re-implementing Conways 'life' the async wayparent

Comments

I'd like to participate, and I don't want to look at your PHP. Can you elaborate on what needs to be implemented?

Do I have this right:

- use linked objects for the cells instead of an array

- a method to bring a cell to the next generation, this method recursively calls itself on the neighbors

- live cells should be created on the fly, growing the "grid" (non rectangular) as necessary

Almost, the recursion is only used when creating new cells, other than that it is all simple iteration.

Basically the 'cell creation' is a shortcut used because I didn't want to start off with a fixed size array of cells.

Each cell operates independently of its neighbours.

Nice to have a taker!

It's a small enough project that you can do it in a day and it is large enough to get some insight into the various ways of solving things with different languages.

I'm really curious what your code will look like and what language you will write it in.

Please let me know when you're done, email in my profile.

Ok, so the main loop is like

    for c in cells: c.update()
And update looks at the values of the neighbors and updates accordingly. Seems straightforward, but I'm sure there will be pitfalls :)

I'm going to start in about 4 hours, I have other work to do now.

Yep, you got it.

I see several problems with this:

If you start with two disconnected cell groups, how do you know when they collide? It seems like the best way to do this is to have a global cell array (or hash table) such that world[position] returns the cell at position.

If you update separate groups at different speeds you run into problems unless you save the complete history. So you still have to update everything in sync? Then what is asynchronous about this?

> If you start with two disconnected cell groups, how do you know when they collide?

You create 'dead' cells in between that connect the two populations.

That's also why you can't remove them. Remember, this is a simulation of a fabric, the dead cells not being there all the time is an optimization, in a real fabric all cells would exist all the time.

The async component is the fact that there is no global authority supplying a clock, each 'peer' is on its own from the moment of power-up.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.