Conways Game of Life - 3D

Blitz3D Forums/Blitz3D Programming/Conways Game of Life - 3D

Blitzplotter(Posted 2016) [#1]
I'm curious as to whether there has been many 3D implementations of this popular little concept...

[EDIT]:--

http://www.blitzbasic.com/Community/posts.php?topic=82094

[edit] it would appear I'm 7 years too late with this topic, which I discovered 7 minutes after I made this post. Although I've an interesting slant on how to 'stimulate' the life data in the first place depedant upon random data from the real world.....

[edit... again]

This is very well put:

http://cs.brown.edu/courses/cs195v/projects/life/edwallac/index.html

to quote Evan on his exploits in 3D land with Conway:

The algorithm can be trivially extended to 3D, except the rules must be changed to maintain insteresting behavior. Each cell has 26 neighbors in 3D instead of 8 in 2D. I experimented with many rules but there were only a few that produced results worth noting.

The first rule set resurrects dead cells if they have exactly 5 neighbors and kills live cells if they have less than 5 or exactly 8 neighbors. It was most interesting when the grid was initialized with each cell having a 5% chance of being alive. Unfortunately the directionless nature of the rules caused each pattern to grow outward in all directions which made for boring visuals.

The second rule set resurrects dead cells if they have from 14 to 19 neighbors and kills live cells if they have less than 13 neighbors. When the grid is initialized with each cell having a 50% chance of being alive, the population shrinks over time and converges to stable 3D structures:


Heres my initial stabs in Blitz3D:




Blitzplotter(Posted 2016) [#2]
Thanks to the help I received from RemiD, Kryzon & Stevie G (and my printed copy of the B3D manual) I was able to cobble together this slice of code which helps me understand the syntactical sugar to help me realise a conway thing with cubes in B3d:


Graphics3D 800,600, 32, 3

Local CamPivot = CreatePivot()

Local Cam = CreateCamera(CamPivot)PositionEntity(Cam , 0 , 30 , -70)


globalpivot = CreatePivot()

PositionEntity globalpivot,1,1,1

PointEntity(Cam , globalpivot)

Global greencubecount=0



;1st cube

x=1: y=1: z=1

bsuffix$="B899"

cubelotsb=CreateCube(globalpivot)

NameEntity cubelotsb,(bsuffix$)

ScaleEntity cubelotsb,0.4,0.4,0.4

PositionEntity cubelotsb,x,y,z

EntityColor cubelotsb,0,255,0

;2nd cube

x=1: y=4: z=2

bsuffix$="C999"

cubelotsb=CreateCube(globalpivot)

NameEntity cubelotsb,(bsuffix$)

ScaleEntity cubelotsb,0.4,0.4,0.4

PositionEntity cubelotsb,x,y,z

EntityColor cubelotsb,255,0,0

;########################################################################

While 1
	
	UpdateWorld()
	RenderWorld()
	
	If KeyDown(16)
		
		Text 20,20,"Q Pressed, attempting to 'delete' the green cube
		
		FreeEntity FindChild( GlobalPivot,"B899")
		
		If greencubecount>=1 
			
			greencubecount=greencubecount-1
			
		EndIf
		
		
	EndIf
	
	If KeyDown(17)
		
		Text 20,20,"W Pressed, attempting to 'generate' the green cube
		
		x=1: y=1: z=1
		
		bsuffix$="B899"
		
		cubelotsb=CreateCube(globalpivot)
		
		NameEntity cubelotsb,(bsuffix$)
		
		ScaleEntity cubelotsb,0.4,0.4,0.4
		
		PositionEntity cubelotsb,x+(greencubecount*1.5),y,z
		
		EntityColor cubelotsb,0,255,0
		
		greencubecount=greencubecount+1
		
	EndIf
	
	If KeyDown(200)
		Text 90,90,"in"
		
		MoveEntity Cam,0,0,10
		
	EndIf
	
	If KeyDown(208)
		Text 90,90,"out"
		
		MoveEntity Cam,0,0,-10
	EndIf
	
	VWait 4
	
	Text 20,40,"Amount of green cubes idented with B999: "+greencubecount
	
	Text 20,62,"press W to generate green cubes, press Q to decrement green cubes..."
	
	Flip
	
	Cls
	
Wend