The Game of Life A simulation of "life". From simple rules, complex behavior arises Rules –A cell that is alive and has fewer than two live neighbors dies.

Slides:



Advertisements
Similar presentations
{ John Conway’s Game of Life.  John von Neumann  Wanted to find/create a machine that could replicate itself  Found an answer, but it was very complex.
Advertisements

Programming project #2 1 CS502 Spring 2006 Programming Project #2 CS-502 Operating Systems Spring 2006.
Game of Life in 21 st Century ECE817 Presentation By Kyusik Chung
Game of Life Rules and Games Linh Tran ECE 573. What is Life? Life is just one example of a cellular automaton, which is any system in which rules are.
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
1 The Game of Life Supplement 2. 2 Background The Game of Life was devised by the British mathematician John Horton Conway in More sophisticated.
Cellular Automata (Reading: Chapter 10, Complexity: A Guided Tour)
1 Chapter 13 Artificial Life: Learning through Emergent Behavior.
Creating new worlds inside the computer COS 116: 2/14/2008 Sanjeev Arora.
CELLULAR AUTOMATON Presented by Rajini Singh.
CELLULAR AUTOMATA Derek Karssenberg, Utrecht University, the Netherlands LIFE (Conway)
Conway’s Game of Life Andrew Williams
CS305j Introduction to Computing Two Dimensional Arrays 1 Topic 22 Two Dimensional Arrays "Computer Science is a science of abstraction -creating the right.
Project 1CS-4513, D-Term Programming Project #1 Concurrent Game of Life Due Friday, March 20.
© The McGraw-Hill Companies, 2006 Chapter 16 Two-dimensional arrays.
Cellular Automata Orit Moskovich
04/25/13 Halting Problem Discrete Structures (CS 173) Derek Hoiem, University of Illinois 1
Introduction At the heart of the growth of a multi-cellular organism is the process of cellular division… … aka (in computing) self-replication.
Cellular Automata and Game Design By Pete Strader.
Variations of Conway’s Game of Life Eswar Kondapavuluri.
Parallelization: Conway’s Game of Life. Cellular automata: Important for science Biology – Mapping brain tumor growth Ecology – Interactions of species.
Introduction Computational Challenges Serial Solutions Distributed Memory Solution Shared Memory Solution Parallel Analysis Conclusion Introduction: 
ARRAYS EXAMPLE: THE GAME OF LIFE CITS Scope of this lecture The Game of Life Implementation Performance Issues References:
Creating new worlds inside the computer COS 116, Spring 2012 Adam Finkelstein.
1 1.1 © 2012 Pearson Education, Inc. Linear Equations in Linear Algebra SYSTEMS OF LINEAR EQUATIONS.
What's ahead? Conway gives a whole new outlook on "loopy" ! John Conway 10/18 no class - Fall break 10/19 no new hw due 10/11 Dynamic & binary data 10/12.
Chapter 12: Simulation and Modeling
Data Structures Using C++ 2E Chapter 6 Recursion.
Three variables Systems of Equations and Inequalities.
The Role of Artificial Life, Cellular Automata and Emergence in the study of Artificial Intelligence Ognen Spiroski CITY Liberal Studies 2005.
Data Structures Using C++ 2E Chapter 6 Recursion.
STAT115 STAT225 BIST512 BIO298 - Intro to Computational Biology Python Tutorial II Monty Python, Game of Life and Sequence Alignment Feb 1, 2011 Daniel.
More Accurate Rate Estimation CS 170: Computing for the Sciences and Mathematics.
CS 5 Today HW 9 (lab + 2 probs) due Sunday, 11/8 at midnight Dizzying arrays of possibilities… John Conway Carl Gauss This week’s credits: Exam 2 on Mon.,Tue.
CS 484 – Artificial Intelligence1 Announcements Lab 4 due today, November 8 Homework 8 due Tuesday, November 13 ½ to 1 page description of final project.
Course material – G. Tempesti Course material will generally be available the day before the lecture Includes.
1 Chapter 13 Artificial Life: Learning through Emergent Behavior.
Activity 2-1: The Game of Life
Topic 26 Two Dimensional Arrays "Computer Science is a science of abstraction -creating the right model for a problem and devising the appropriate mechanizable.
Cellular Automata. The Game The Game of Life is not your typical computer game. It is a 'cellular automation', and was invented by the Cambridge mathematician.
EECS 110: Lec 12: Mutable Data Aleksandar Kuzmanovic Northwestern University
Parallel Programming 0024 Spring Semester 2010 May 6, 2010.
1 Data Structures CSCI 132, Spring 2014 Lecture 4 Implementing Life.
Programming Principles Chapter 1. Objectives Discuss the program design process. Introduce the Game of Life. Discuss object oriented design. – Information.
עקרונות תכנות מונחה עצמים תרגול 6 - GUI. סיכום ביניים GUI:  Swing  Basic components  Event handling  Containers  Layouts.
Model Iteration Iteration means to repeat a process and is sometimes referred to as looping. In ModelBuilder, you can use iteration to cause the entire.
Review Recursion Call Stack. Two-dimensional Arrays Visualized as a grid int[][] grays = {{0, 20, 40}, {60, 80, 100}, {120, 140, 160}, {180, 200, 220}};
Cellular Automata. John von Neumann 1903 – 1957 “a Hungarian-American mathematician and polymath who made major contributions to a vast number of fields,
Homework 9 Due ( M & T sections ) ( W & Th sections ) at midnight Sun., 11/3 Mon., 11/4 Problems
A Variation on Conway’s Game of Life Winston Lee EPS 109.
The Northern Lights: Demonstrations. Programmability Overview A major aspect of our project is programmability- it is an interactive display medium, the.
Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally.
TRU-COMP3710 Artificial Life and Emergent Behavior1 Course Outline Part I – Introduction to Artificial Intelligence Part II – Classical Artificial Intelligence.
1 Arrays of Arrays An array can represent a collection of any type of object - including other arrays! The world is filled with examples Monthly magazine:
Ionut Trestian Northwestern University
Week 9 - Monday.  What did we talk about last time?  Method practice  Lab 8.
Conway’s Game of Life Jess Barak Game Theory. History Invented by John Conway in 1970 Wanted to simplify problem from 1940s presented by John von Neumann.
Week 9 - Wednesday.  What did we talk about last time?  2D arrays  Queen attacking pawn example  Started Game of Life.
EECS 110: Lec 12: Mutable Data Aleksandar Kuzmanovic Northwestern University
Practical Session 9 Computer Architecture and Assembly Language.
EECS 110: Lec 12: Mutable Data
Chaotic Behavior - Cellular automata
Illustrations of Simple Cellular Automata
HMC’s Galileo Auditorium Some of Cope’s generated MP3s:
Topic 26 Two Dimensional Arrays
Ionut Trestian Northwestern University
2D Array and Matrix.
Northwestern University
EECS 110: Lec 12: Mutable Data
2D Array and Matrix Application: Game of Life
Presentation transcript:

The Game of Life A simulation of "life". From simple rules, complex behavior arises Rules –A cell that is alive and has fewer than two live neighbors dies (because of loneliness) –A cell that is alive and has more than 3 live neighbors dies (because of over-crowding) –A cell that is dead and has exactly 3 live neighbors comes to life –All other cells maintain their state

The Game of Life: History Created by John Horton Conway, a British Mathematician Inspired by a problem presented by John Von Neumann: –Build a hypothetical machine that can build copies of itself First presented in 1970, Scientific American

“Life” Evolutionary rules Grid World Everything depends on a cell’s eight neighbors red cells are alive white cells are empty Exactly 3 neighbors give birth to a new, live cell! Exactly 2 or 3 neighbors keep an existing cell alive Any other number of neighbors kill the central cell (or keep it dead) John Conway

Life Evolutionary rules Grid World Everything depends on a cell’s eight neighbors red cells are alive white cells are empty Exactly 3 neighbors give birth to a new, live cell! Exactly 2 or 3 neighbors keep an existing cell alive Any other number of neighbors kill the central cell (or keep it dead)

Life Evolutionary rules Grid World Everything depends on a cell’s eight neighbors red cells are alive white cells are empty Exactly 3 neighbors give birth to a new, live cell! Exactly 2 or 3 neighbors keep an existing cell alive Any other number of neighbors kill the central cell (or keep it dead)

Life Evolutionary rules Grid World Everything depends on a cell’s eight neighbors red cells are alive white cells are empty Exactly 3 neighbors give birth to a new, live cell! Exactly 2 or 3 neighbors keep an existing cell alive Any other number of neighbors kill the central cell (or keep it dead) life out there... Keep going!

Creating Life updateNextLife(oldB, newB) old generation or "board" new generation or "board"

Creating Life old generation or "board" new generation or "board" updateNextLife(oldB, newB)

Details For each generation… 0 represents an empty cell 1 represents a living cell outermost edge should always be left empty (even if there are 3 neighbors) compute all cells based on their previous neighbors old generation or "board" new generation or "board" life out there... updateNextLife(oldB, newB)

Main Loop def life( width, height ): """ will become John Conway's Game of Life... """ B = createBoard(width, height) csplot.showAndClickInIdle(B) while True: # run forever csplot.show(B) # show current B time.sleep(0.25) # pause a bit oldB = B B = createBoard( width, height ) updateNextLife( oldB, B ) # gets a new board

Main Loop def life( width, height ): """ will become John Conway's Game of Life... """ B = createBoard(width, height) csplot.showAndClickInIdle(B) while True: # run forever csplot.show(B) # show current B time.sleep(0.25) # pause a bit oldB = B B = createBoard( width, height ) updateNextLife( oldB, B ) # gets a new board Why not just have update RETURN a new list? (i.e., why bother with mutation at all?) Update MUTATES the list B

to  and beyond! Are there stable life configurations? Are there oscillating life configurations? Are there self-propagating life configurations? "rocks" "plants" "animals" period 3 period 2

to  and beyond! Are there life configurations that expand forever? What is the largest amount of the life universe that can be filled with cells? How sophisticated can the structures in the life universe be? Are all feasible configurations reachable?

Gaussian Elimination 2p + 3n + -1q = p + -1n + 2q = p + -9n + 4q = Goal: Find p,n,q Carl Gauss is so money!

Gaussian Elimination 2p + 3n + -1q = p + -1n + 2q = p + -9n + 4q = Goal: get 1s along the diagonal get 0s elsewhere on the left Find p,n,q 1p + 0n + 0q = p + 1n + 0q = p + 0n + 1q = 25.00

Gaussian Elimination 2p + 3n + -1q = p + -1n + 2q = p + -9n + 4q = Goal: get 1s along the diagonal get 0s elsewhere on the left Find p,n,q 1p + 0n + 0q = p + 1n + 0q = p + 0n + 1q = Just the array is necessary ! We can get rid of the variables... Using only row operations (our methods) ! where to start?

Solve multiply Row 0 by 0.5

Solve multiply Row 0 by add 3 times Row 0 to Row 1 add -1 times Row 0 to Row 2

Solve multiply Row 0 by multiply Row 1 by 1/3.5 add a multiple of Row 1 to Row 0 add a multiple of Row 1 to Row 2 add 3 times Row 0 to Row 1 add -1 times Row 0 to Row 2

Solve multiply Row 0 by add 3 times Row 0 to Row 1 add -1 times Row 0 to Row same for other columns as far as possible... multiply Row 1 by 1/3.5 add a multiple of Row 1 to Row 0 add a multiple of Row 1 to Row 2

def add2ofRow1IntoRow2( A ): before after A A two of row 1 are to be added to row 2 row 0 row 1 row 2 row 0 row 1 row 2 Write a method that adds two times the values in row # 1 into the values in row # 2. Only row 2's values change. You may assume that A has at least three rows! How could you make the source and destination rows inputs to this function? How would it change the code? The values in row 1 should not change

def addRowSIntoRowD( rs, rd, A ): row 0 row 1 row 2 row 0 row 1 row 2 Write a method that adds row # s into the values in row # d. s d s d

Using 2d arrays Before After arr A method for multiplying columns:

Solving ?! Gaussian Elimination 2p + 3n + -1q = p + -1n + 2q = p + -9n + 4q = p n q = p n q = p n q = Goal: get 1s along the diagonal get 0s elsewhere on the left multiply the zeroth row (R0) by 0.5 Find p,n,q 1.00p n q = p n q = p n q = add 3 times R0 to R1 add -1 times R0 to R2

Solved ! 1.00p n q = p n q = p n q = multiply R1 by 1 / p n q = p n q = p n q = add -1.5 times R1 to R0 add 10.5 times R1 to R2 1.00p n q = p n q = p n q = add 3 times R0 to R1 add -1 times R0 to R2 continue p n q = p n q = p n q = only the array is necessary !

Solved ! 1.00p n q = p n q = p n q = multiply R1 by 1 / p n q = p n q = p n q = add -1.5 times R1 to R0 add 10.5 times R1 to R2 1.00p n q = p n q = p n q = add 3 times R0 to R1 add -1 times R0 to R2 continue p n q = p n q = p n q = only the array is necessary !