Skip to content

daniel-llach/gameOfLife

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game of life (technical test for developer)

This is a demo of Game of life created in REDUX (I put the logic of the question in the front this time).

Then I made a front visualization

Instructions

npm install
node app.js

The original question:

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

Given a board with m by n cells, each cell has an initial state live (1) or dead (0). Each cell interacts with its eight neighbors (horizontal, vertical, diagonal) using the following four rules:

  • Any live cell with fewer than two live neighbors dies, as if caused by under-population.
  • Any live cell with two or three live neighbors lives on to the next generation.
  • Any live cell with more than three live neighbors dies, as if by over-population..
  • Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction. Write a function to compute the next state (after one update) of the board given its current state. nextGeneration([ [1, 1, 1], [1, 0, 0], [1, 1, 0] ])

Will return: [ [1, 1, 0], [0, 0, 1], [1, 1, 0] ]

About

Technical demo for node - react - redux job

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published