Scalable Conway's Game of Life 2.0

Holidays are over and works getting back in the swing so I wanted to post my updates before things get crazy.

I hope everyone had fun over the holidays.

So new version. Took a lot of the feedback you fine people gave and made I think some significant improvements including some new features.

Not sure why it was happening but some people's browsers were catching key strokes before the game launched with the green flag causing an error. I've put in a running check and that seems to have fixed the bug. Also added in a QoL where the board boarder turns RED to indicate Paused and back to GREEN for unpaused

Sorry for the trouble everyone who tried to run it

First to the kudos because none of us would be as good as we are without the criticisms and feed back of others in our field

@qw23 - Your help with generalizing my idea of taking a snap shot of certain settings was AWESOME. I didn't take it ALL the way because I still wanted to keep this library free. Still THANK YOU!

@mobility212 - Thank you SO much for inspiring me to rethink my approach by pointing out the game really was not playing like it should.

Apparently I cannot quote more than 2 per post so the rest of you will be in a comment sorry about that.

Thank you all for the help learning how to harness this fun quirky little language

The Changes:

This was Version 1.0

This is Version 2.0

The first major change was moving all but the enter key stepping check into a single key press switchboard command block

Second was changing the entire mechanics of how each turn of the game is evaluated

instead of

Conways Game of Life script pic (2)

where each clone would independently note its neighbors then spend eternity living or dying by the changes to its neighbors

Here we

Conways Game of Life 2.0 script pic (2)

record the board ONCE with

By recoding a record of the clone itself, a boolean flag, and its neighbors based on proximity into a single list later in the game loop

run game can just evaluate the cells list as a whole and update all cells in a single turn

First it uses

in a nutshell this evaluates ALL cells setting a flag (from its record in the cells list) for each if their state should be toggled


maps a list of JUST the clone objects by first keeping ONLY the records with a toggle flag set

finally it tells each cell to in that filtered list to get its next costume

and turn over

Because in memory filtering and mapping of a list is ALWAYS faster after it is created than rebuilding the list every time the game runs significantly faster and more reliable. Also fixes the issue where cells were not updating together in a turn

The next thing

To test and validate the game mechanics were working I added a series of Templates for different game "pieces" things like Still Life which never change, or Oscillators that cycle between 2 or more states forever, or Spaceships that move across the screen in a repeatable manner

I recoded snap shots of gameboards with each template in the center and turned them into a series of costumes for a template sprite

It simply cycles through the templates in a category displaying the selected template above the board for the user

then if the board is clicked

Conways Game of Life 2.0 script pic (9)

If we have a selected template it calls

which reads in the layout data of the template which for an example is just a 2 dimensional array with the indexes of the alive or dead costumes (This one is the template shown above)

they are all grouped in their own categories like

Where each is paired with its costume index

Finally the game has the templated applied and control reverts to clicking toggling a single cell (this is a snap shot as the template is cycling)

Version 3.0?

Work is gearing up in full swing so it will probably be a while before I can really dig into this like last 2 weeks.

Some things I had hoped to figure out but just couldn't right now.

One big one is allowing the Templates to be stamped on the board at whatever cell the mouse cursor clicks on instead of defaulting the the center of the game board.

Also would love to figure out why the game throws the error it does when the stop button is pressed.


Thanks again for everyone's feedback on version 1.0. Looking forward to hearing more from everyone.

Additional shout outs sorry for the rest of you. Your thoughts and help are NO less important to me

@bh - Your little tidbit about using is my parent a text (still not quite sure HOW that limits things to just the parent sprite but it works so good enough for now) has VERY helpful even beyond the pause issue. Also thank you for pointing out the turbo mode. Knowledge is always great to have. Though I did end up not using it because I went a different direction

@cymplecy - Thank you for the critical suggestion of using proximity instead of touching for my neighbors. It works like a charm.

I got this when I play the project. Also when I tap on a cell it disappears instead of playing.

i've not seen that error at all. It runs just fine on another computer for me.

Can you reproduce the error and if so what exactly are you doing to reproduce it?

I've ran this as many different ways as I can think and right now I can't make it break like that

The game starts out running so clicking a cell WILL evaluate that cell and since any live cell next to less than 2 alive cells dies your cell dies immediately

You need to hit P to pause the game and then you can click to your hearts content, then press P again to unpause the game.

optionally you can hit R to generate a random pattern.

Error happens when it's the first time you started the project since reload.

ok I was able to get the error finally

if you have refreshed the page and hit the L, O, or S key (to cycle the different family of Templates - Details in the notes of the project) BEFORE you click the green flag to start.

It hasn't loaded the game board itself so its erroring out on values that haven't been created yet.

If you just hit the green flag to run before anything else it will run every time

I'll have to give it some thought on trying to prevent this

What have I told you about dissing Snap! :slight_smile:

I hope you're being sarcastic because I see nothing negative about what I said.

Not being sarcastic


Do you use these words to describe other languages?

Just to be totally clear and transparent and honest on where I'm coming from

Your new here, and like several others, you come from a professional text-based programming background.

So things seem a lot different here.

I am (and have been for a considerable amount of time) a block-programming evangelist and therefore push-back on suggestions that block programming languages are just "for kids", "quirky", "little", "low-level" etc

Snap! is the most advanced block programming environment in existence.

It is primarily a teaching language

It's designed to teach advanced computer language/science concepts

You entitled to your opinions on it and you can say what you want

I'm entitled to push back on them :slight_smile:

Happy New Year BTW :slight_smile:

See I will never see things that way. I get that you are trying to be stalwart about this language and the community and I respect that but nothing I said is untrue or malicious, or any of that.

Snap IS tiny (relative to almost any other language)

Snap IS quirky (You can't with an honest straight face tell me it isn't especially compared to 99% of other programing languages and development environments)

Snap IS fun.

Tiny does not translate to less powerful, less expressive, less useful, or anything like that. Only a fool who's never branched out past the language they wrote their first Hello World program in would think something so small minded.

Quirky is engaging, eye raising, bold all things I think you would say Snap is. Down to the bare text editor coding can be boring from time to time. Having something that sparks JOY in the act of creation through programming is a wonderful thing. I'm really sorry if it offends you but I'm excited by the quirky, the odd corners of programming. I'm never looking down on them I'm looking up in amazement of what people come up with when free to express themselves.

You'll find no argument from me on those points but you kind of reprove my point that both of the things I said hold true (I'm going to go out on a limb and assume you aren't upset I called the Snap fun :stuck_out_tongue: ).

In order to teach the language HAS to be relatively tiny in order to distill things down to their base components. Do you know how often I've ALREADY lamented to myself how I miss ALL of my higher order data manipulation functions I'm just USED to having as part of the language, my Skip, SkipWhile, Take, TakeWhile, Any, All? Quite often!! HOWEVER I remind myself that this IS a teaching language, and if I stop and think about it I should be able to derive ANY of those functions from what the language gives me. There's real POWER in the language intentionally being tiny especially in being simultaneously approachable, and deceptively expressive to someone just starting out learning about programming. I think that is fantastic

It being quirky is ALSO necessary for it being an effective teaching tool. Boring is the LAST thing you want your teaching programming language to be. I'd argue the original Beginners All-purpose Symbolic Instruction Code IS one of the MOST boring, awful programming languages ever invented!! It's stuffed to the gills with needless wordy syntax. End Function, End Sub End this, End that, Next this Next that. Does it convey the English language idea of what is happening? Sure DOES champ! It just does it in the same bland English language your prescription describes how to measure out your dosage. You know what ELSE conveys the English concepts of a loop, or a Function, or a Predicate? BRIGHT funky colored puzzle pieces, ones that wrap around others to visually denote scope, and nested logic, ones with engaging little shapes to clue the learner in how they go together. Snap is communicating the exact same core concepts as BASIC did decades ago, but its doing it in a VERY engaging way. Being quirky I really believe is a strength of this language to draw people in.

And lets imaging for a minute that someone DOES come in with the idea of "Oh look at this silly little baby language." Really honestly looking down on the language. Why is that a bad thing or even something to worry about? People like that do exist, however I would argue there's only two outcomes for that person.

  1. They never learn anything from the language, get bored, and move on

  2. They dig into the language and learn over time JUST how expressive a programming language can be ESPECIALLY one deliberately simplified.

So they are an annoying ship passing in the night never to be seen again, or if they have a heart and mind truly for programming (and not some religious fealty to a language, editor, or domain) you'll gain a true supporter right along side you. Snap doesn't need someone to defend it, it does an amazing job of standing on its own unique feet.

I did not get where I am and accomplish what I have in programming, and in my career by keeping my opinions to myself.

I also did not LEARN all that I have or experience the breadth of styles and approaches by keeping my opinions to myself.

Freely expressing my opinions does not mean I don't actively hear and listen to others opinions. I love the banter more than anything. We could all stand to hear and learn from the perspectives of others around us even the normal non programmers. To be clear YES I am insinuating we are NOT normal. No one that programs is normal, its what makes us fun.

Absolutely you are!

And you are under no obligation to agree or disagree with me. I just hope you can relax a little. Not everything is an attack, a slight, or an afront. Some of us are just hard wired to inject a bit of cheekiness, self deprecation, and sarcasm into everything we do. You'll find a lot of us unconsciously ramp it up when we are truly exited about something we love. It's like ribbing on your friends, joking with your spouse. Its a level of comfort and a feeling of non judgmental belonging we don't often find in other areas of our lives

Thank you I appreciate it!!

Also I genuinely enjoy our back and forth. I love the passion you have for Snap! I wish I had someone that excited programming as a teacher when I was in school I might have learned some cool stuff far sooner than I did teaching myself.

I can't seem to figure out how to get it to work, would you mind providing me with instructions on how to run the project without getting the "number instead of list" error?

Just saved an update. I'm not longer able to reproduce the original issue asking for a list

Refresh the page

Just hit Green flag to start (Looks best in the full screen mode) then either

R - to generate random game

L, O, or S to cycle through templates (should see it in a thought bubble at the top) then mouse click to drop in the center.


This is driving me nuts it runs perfectly fine on all of my browsers even on a different computer

Can I ask what browser you are using there it doesn't look familiar to me but it could just be a skin or theme

maybe telling @tofubug where the error is being thrown from would help instead of just saying ":confused:"

looks like chrome to me

I think I got things sorted out let me know how it works after you refresh your browser

It works now! It's slow but I shouldn't even mention that since anything complex on Snap! runs slow on my Chromebook.

Everything does just die though, even the preset templates.

Oh, and I should mention that I'm on Chrome 119.0.6045.212

I'll have to try it on my wife's Chromebook see how it runs. Been doing mostly Windows and VMs for testing

try creating a chrome os flex image in your vms