Cody

Problem 52. What is the next step in Conway's Life?

Created by Cody Team in Community

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

44.41% Correct | 55.59% Incorrect
Last solution submitted on Mar 14, 2019

Problem Comments

Solution Comments

Recent Solvers366

Suggested Problems

More from this Author95

Tags

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!