Game: Game of Life

Just a simple Game of Life clone to test out map traversal and stuff.

A to generate a random map.
B to advance a single tick.
Crank sets the game speed.


Game Of (3.0 KB)

Highlighting this fairly generic bit of code, which runs a function on every tile of the map:

on SomeEvent do
	x = 0
	y = 0
	function = "SomeFunction"
	call "MapTraversal"

on MapTraversal do
	call function
	x += 1
	if x==25 then
		x = 0
		y += 1
	if y!=15 then
		call "MapTraversal"

Fun trying to figure out how to get by without for loops. Interested if anyone comes up with a different/better way.


Hehe, recursion might be an issue on actual hardware. Would while loops not work for this? (Maybe you didn’t see it hidden under the Conditionals section)

did not see that lol. hmm that opens up a lot…

This is great. I'm just jumping back into messing with Pulp since units are starting to ship. Let me tell you, my way of trying to do this was waaaaaay more complicated. I was brute forcing this with nested loops :sweat_smile:. Getting my head around these globally scoped variables has been so tricky. Very different way of coding than I'm used to.

I also love how you used the frames to help track state! Much easier I think than having four separate tiles ("alive", "dead", "willDie", "willRevive").

Thanks for the inspiration on this!