Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
esambo committed Nov 25, 2011
1 parent ab2d82c commit 0ea47e3
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 15 deletions.
9 changes: 9 additions & 0 deletions features/.nav
@@ -0,0 +1,9 @@
- doc (Documentation):
- rules_of_life.md (Rules of Life)
- rules_of_simple_design.md (Rules of Simple Design)
- source_code.md (Source Code)
- live_cell.feature
- dead_cell.feature
- multiple_cells.feature
- static_structures.feature
- multiple_generations.feature
20 changes: 20 additions & 0 deletions features/README.md
@@ -0,0 +1,20 @@
# Practice Game of Life

## [Code Retreat](http://coderetreat.com)
w/ [Corey Haines](http://www.twitter.com/coreyhaines)
*- honing the craft together*

Coderetreat is a day-long, intensive practice event, focusing on the fundamentals of software development and modular design, primarily the [4 Rules of Simple Design](http://c2.com/cgi/wiki?XpSimplicityRules):

1. Tests Pass (green)
2. Reveal Intent (good names)
3. No Duplication (DRY)
4. Small


## Wikipedia: [Conway's Game of Life](http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life)

The **Game of Life**, also known simply as **Life**, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.

The "game" is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and observing how it evolves.

6 changes: 3 additions & 3 deletions features/dead_cell.feature
@@ -1,7 +1,7 @@
Feature: Evolving a dead cell
In order to create a functioning rules engine
As a programmer of Conway's Game of Life
I can evolve a single dead cell based
In order to create a functioning rules engine
As a programmer of Conway's Game of Life
I can evolve a single dead cell based

Scenario: Dead cell with 0 neighbors stays dead
Given the following setup
Expand Down
18 changes: 18 additions & 0 deletions features/doc/rules_of_life.md
@@ -0,0 +1,18 @@
Based on Wikipedia: Conway's Game of Life: [Rules](http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life#Rules)

The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square *cells*, each of which is in one of two possible states, *alive* or *dead*. Every cell interacts with its eight *neighbors*, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

### 1. Under-Population
- Any live cell with *fewer than 2* live neighbors *dies*

### 2. Next Generation
- Any live cell with *2 or 3* live neighbors *lives* on

### 3. Overcrowding
- Any live cell with *more than 3* live neighbors *dies*

### 4. Reproduction
- Any dead cell with *exactly 3* live neighbors becomes a *live* cell

The initial pattern constitutes the *seed* of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed—births and deaths occur simultaneously, and the discrete moment at which this happens is sometimes called a *tick* (in other words, each generation is a pure function of the preceding one). The rules continue to be applied repeatedly to create further generations.

8 changes: 8 additions & 0 deletions features/doc/rules_of_simple_design.md
@@ -0,0 +1,8 @@
[4 Rules of Simple Design](http://c2.com/cgi/wiki?XpSimplicityRules):

Based on the [SCNA 2011 Code Retreat](http://twitpic.com/7gz0k2)

1. Tests Pass (green)
2. Reveal Intent (good names)
3. No Duplication (DRY)
4. Small
3 changes: 3 additions & 0 deletions features/doc/source_code.md
@@ -0,0 +1,3 @@
## [Cucumber Features](http://cukes.info/)
Building a Conways’ Game of Life simulator is a great way to practice different techniques in the language of your choice. This ***[git repository](https://github.com/coreyhaines/practice_game_of_life)*** contains a set of cucumber features that describe the rules of Conway’s Game of Life. I’ve also included a few standard, larger patterns that you can use to check multiple generation evolution.

6 changes: 3 additions & 3 deletions features/live_cell.feature
@@ -1,7 +1,7 @@
Feature: Evolving a living cell
In order to create a functioning rules engine
As a programmer of Conway's Game of Life
I can evolve a single living cell
In order to create a functioning rules engine
As a programmer of Conway's Game of Life
I can evolve a single living cell

Scenario: Living cell with 0 neighbors dies
Given the following setup
Expand Down
6 changes: 3 additions & 3 deletions features/multiple_cells.feature
@@ -1,7 +1,7 @@
Feature: Evolving a grid with some cells in it
In order to create a functioning rules engine
As a programmer of Conway's Game of Life
I can evolve a multiple cell grid
In order to create a functioning rules engine
As a programmer of Conway's Game of Life
I can evolve a multiple cell grid

Scenario: Sparse grid with nobody staying alive
Given the following setup
Expand Down
6 changes: 3 additions & 3 deletions features/multiple_generations.feature
@@ -1,7 +1,7 @@
Feature: Evolving a grid over multiple generations
In order to create a functioning rules engine
As a programmer of Conway's Game of Life
I can evolve a grid over multiple generations
In order to create a functioning rules engine
As a programmer of Conway's Game of Life
I can evolve a grid over multiple generations

Scenario: Cells come alive, then die off
Given the following setup
Expand Down
6 changes: 3 additions & 3 deletions features/static_structures.feature
@@ -1,7 +1,7 @@
Feature: Cell configurations that are static
In order to create a functioning rules engine
As a programmer of Conway's Game of Life
I can see static structures surviving in my world
In order to create a functioning rules engine
As a programmer of Conway's Game of Life
I can see static structures surviving in my world

Scenario: Block
Given the following setup
Expand Down

0 comments on commit 0ea47e3

Please sign in to comment.