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
-
212 Solvers
-
Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
230 Solvers
-
1805 Solvers
-
Is this is a Tic Tac Toe X Win?
513 Solvers
-
9567 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!