Browse Search Popular Register Upload Rules User list Login:
Search:
[Algodoo] Conway's game of life

Image:
screenshot of the scene

Author: swiss.assault

Group: Default

Filesize: 150.26 kB

Date added: 2010-05-22

Rating: 6.5

Downloads: 581

Views: 875

Comments: 4

Ratings: 4

Times favored: 0

Made with: Algodoo before v1.8.5

Tags:

Scene tag

Hi,


first, if you don't know Conway's "game of life" check out this page:
http://www.bitstorm.org/gameoflife/

Choose "Glider" from the drop down list there and press "next" several times.


Keys: [Enter] (don't hold it for too long!) to advance to the next generation.

If you want to make your own game of life scene, just delete the existing one and copy the living or dead cell from the left to generate a new matrix.

Make sure that no external laser is pointing towards the matrix.




How it works

Variables:
immortal = next state; true = alive, false = dead
collideWater = current state; true = alive, false = dead
friction = number of lasers that hit the block.
e.laser.color == [1, 1, 0, 1]: Yellow laser (always on)
e.laser.color == [0, 1, 0, 1]: Green laser (switched on by enter key)
color = [0, 1, 0, 0.5]: Cell is alive (green, transparent 50%)
color = [0, 0, 0, 1]: Cell is dead (black, opaque)

Code:

(e)=>{......e.laser.color == [0, 1, 0, 1] ? {
........................collideWater = immortal;
........................collideWater ? {
..............................color = [0, 1, 0, 0.5]
..........................................} : {
..............................color = [0, 0, 0, 1]
........................}
............} : {
........................e.laser.color == [1, 1, 0, 1] ? {
..............................friction = friction - 8;
..............................((friction == 2 && collideWater) || friction == 3) ? {
....................................immortal = true
..............................} : {
....................................immortal = false
..............................};
..............................friction = 0
........................} : {
..............................friction = friction + 1
........................}
............}
}


Explanation:
Check if laser color is yellow:
......Laser is yellow:
............- the current state (collideWater) is updated from the next state (immortal).
............- update the cell color depending on whether it is alive or not.
......Laser is not yellow: Check if the laser color is green:
............- Laser is green:
..................- substract 8 from number of lasers that hit the block because the 8 lasers that belong to the cell also hit the block.
..................- check the game of life rules:
........................- 2 lasers hit and cell is alive or 3 lasers hit:
..............................next state is 'alive'.
........................- else:
..............................next state is 'dead'.
............- Laser is not green: add 1 to the number of lasers that hit the block.




Greetings,
swiss
Last edited at 2010/05/23 10:20:42 by swiss.assault
Please log in to rate this scene
edit
Similar scenes
Title: [Algodoo only] Conway's Game of Life V.2
Rating: 6.3334
Filesize: 72.44 kB
Downloads: 635
Comments: 1
Ratings: 6
Date added: 2010/05/26 18:27:41
Made with: Algodoo before v1.8.5
Rating: rated 6.3
download
Title: Conway's Game of Life
Rating: 5
Filesize: 19.49 kB
Downloads: 400
Comments: 0
Ratings: 1
Date added: 2020/09/16 22:13:10
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: [Algodoo only] Game of Life V5
Rating: 5.625
Filesize: 6.78 kB
Downloads: 996
Comments: 3
Ratings: 2
Date added: 2011/04/22 11:27:41
Made with: Algodoo before v1.8.5
Rating: rated 5.6
download
Title: GAME OF LIFE simulation
Rating: 6.1111
Filesize: 85.71 kB
Downloads: 1682
Comments: 12
Ratings: 3
Date added: 2013/09/22 04:55:11
Made with: Algodoo v2.1.0
Rating: rated 6.1
download
Title: Game of Life (Methuselahs)
Rating: 6.8182
Filesize: 22.77 kB
Downloads: 927
Comments: 4
Ratings: 5
Date added: 2014/12/09 17:14:08
Made with: Algodoo v2.1.0
Rating: rated 6.8
download
Title: Saw Trap: The Rack (Read Story In Desc) ALGODOO ONLY
Rating: 4.1111
Filesize: 204.09 kB
Downloads: 2762
Comments: 3
Ratings: 3
Date added: 2010/11/02 21:07:19
Made with: Algodoo before v1.8.5
Rating: rated 4.1
download
Responses to this scene
show list
Title: [Algodoo only] Conway's Game of Life V.2
Rating: 6.3334
Filesize: 72.44 kB
Downloads: 635
Comments: 1
Ratings: 6
Date added: 2010/05/26 18:27:41
Made with: Algodoo before v1.8.5
Rating: rated 6.3
download
awesome. 'nuff said.
EDIT: i'll try to improve it, mainly lag management
Last edited at 2010/05/22 21:18:25 by RA2lover
Holy crap, that is amazing. Just like the real one.
Really good except it doesn't loop on to the otherside like the real one.
"Really good except it doesn't loop on to the otherside like the real one. "
I don't understand what you mean. You have to press the enter key for a short time to get to the next generation. If you hold it for too long, there are bugs.
If you continue this, it will behave exactly like the real one.