Problem 52. What is the next step in Conway's Life?
Given a matrix A that represents the state of Conway's game of Life at one instant (time t=n), return the matrix B that represents the state of the game at the next instant (time t=n+1).
Assume a toroidal game board, so the edges of the matrix wrap left to right and top to bottom.
Examples:
Input A = [ 1 1 0 0
0 1 0 0
1 1 0 0
0 0 0 0 ]
Output B = [ 1 1 0 0
0 0 1 0
1 1 0 0
0 0 0 0 ]
Input A = [ 0 1 1 0
1 1 1 0
0 0 1 0
0 0 0 0 ]
Output B = [ 1 0 1 1
1 0 0 0
0 0 1 1
0 1 1 0 ]
Solution Stats
Problem Comments
-
11 Comments
Show
8 older comments
Dyuman Joshi
on 22 Aug 2023
Thanks for notifying @Peter, I have updated the link.
Jonah
on 9 Sep 2023
Am I misunderstanding the rules to the game, or are two of the solutions that the site checks against incorrect
Yufei
on 22 Jun 2024
I think the two of the solutions are wrong. Because it may misunderstand the corner...
Solution Comments
Show commentsProblem Recent Solvers655
Suggested Problems
-
Arrange Vector in descending order
11984 Solvers
-
Find last zero for each column
595 Solvers
-
362 Solvers
-
884 Solvers
-
Solve a System of Linear Equations
12822 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!