Growing a Maze Question
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I was wondering if someone could help me on this one:
A cellular automaton consists of a grid of cells where each cell is either on or off. In a single time step a new generation is computed based on the previous generation and a fixed rule. The most famous example of a cellular automaton is Conway’s Game of Life. In this exercise we will implement a variation which results in maze-like structures. Create a function with the following signature The input A is a matrix with the initial state of each cell, where a value of 0 indicates a cell is off and a 1 indicates a cell is on. The input steps indicates how many new generations need to be computed. A new generation can be computed with the following rules:
Survival: If a cell is on and it has at least one and at most four neighbors which are on, it will be on in the new generation.
Birth: If a cell is off and it has precisely three neighbors which are on, it will be on in the new generation.
Death: All other cells will be off in the new generation.
The neighbors of a cell are all cells which are directly adjacent to it, including the diagonal cells. Most cells have eight neighbors, while those at the sides of the grid have five neighbors and the cells in the corners only three neighbors.
Where do I start at all?
4 Kommentare
Stephen23
am 14 Sep. 2018
Bearbeitet: Stephen23
am 14 Sep. 2018
"Where do I start at all?"
By reading about cellular automata. Read the Wikipedia article for Conway's Game of Life. Read about possible ways to write the code. Read blogs on the topic. Look at some examples in MATLAB. etc. etc.
Conway’s Game of Life has been coded up countless times in countless languages, since it was released in 1970. A search for "MATLAB Conway game of life" using [a major internet search engine] returned over 140,000 results. A search on MATLAB File Exchange for "Conway" returned 13 results (including some very nice looking ones).
The internet is full of information... why not start making use it?
Antworten (1)
Image Analyst
am 14 Sep. 2018
Hint:
function ComputeLastGeneration(A, steps)
Inside that function you'll use a for loop "steps" times to compute the successive generations. Strangely the instructions don't call for an output, but it might not be a bad idea to return the final generation.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Conway's Game of Life finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!