Logo: Relish

  1. Sign in

Project: Bdd-kata-conways-life

Evolving a living cell

A living cell should follow the rules of the game
when evolving from one generation to the next.

Scenarios
A living cell with 0 neighbors dies
Given
I have supplied the following generation
. . .
. x .
. . .
When
I tell the world to evolve once
Then
the center cell should be dead
A living cell with 1 neighbor dies
Given
I have supplied the following generation
. x .
. x .
. . .
When
I tell the world to evolve once
Then
the center cell should be dead
A living cell with 2 neighbors lives
Given
I have supplied the following generation
. x .
. x x
. . .
When
I tell the world to evolve once
Then
the center cell should be alive
A living cell with 3 neighbors lives
Given
I have supplied the following generation
x x x
. x .
. . .
When
I tell the world to evolve once
Then
the center cell should be alive
A living cell with 4 neighbors dies
Given
I have supplied the following generation
x x x
. x x
. . .
When
I tell the world to evolve once
Then
the center cell should be dead
A living cell with 5 neighbors dies
Given
I have supplied the following generation
x x x
x x x
. . .
When
I tell the world to evolve once
Then
the center cell should be dead
A living cell with 6 neighbors dies
Given
I have supplied the following generation
x x x
x x x
x . .
When
I tell the world to evolve once
Then
the center cell should be dead
A living cell with 7 neighbors dies
Given
I have supplied the following generation
x x x
x x x
x x .
When
I tell the world to evolve once
Then
the center cell should be dead
A living cell with 8 neighbors dies
Given
I have supplied the following generation
x x x
x x x
x x x
When
I tell the world to evolve once
Then
the center cell should be dead

Last published over 4 years ago by jcouball.