*Weekend CHALLENGE Expired* : Conway's Game of Life. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

*Weekend CHALLENGE Expired* : Conway's Game of Life.

write a code that given a 2D array and a number of generations, compute n timesteps of Conway's Game of Life. The rules of the game are: Any live cell with fewer than two live neighbours dies, as if caused by underpopulation. Any live cell with more than three live neighbours dies, as if by overcrowding. Any live cell with two or three live neighbours lives on to the next generation. Any dead cell with exactly three live neighbours becomes a live cell. The universe is infinite in both the x and y dimensions and all cells are initially dead. (If there are no living cells as input, then return [[]].) note: 1 = alive cell; 0 = dead cell 0 1 0 0 c 1 1 0 0 c has 3 neighbors therefore c: if was alive stays alive at the next gen, and if c was dead turns alive at the next generation because exactly 3 neighbors. EXAMPLE: getGeneration(cells,nroGeneration); getGen([[]],3); //output itself: [[]] getGen([ [ 1, 0, 0 ], [ 0, 1, 1 ], [ 1, 1, 0 ] ], 1); //output: [[0,1,0],[1,1,1],[1,1,1]] getGen([[1,1,1],[0,1,0],[1,1,0]], 1); //output: [[0,1,0],[1,1,1],[0,0,0],[1,1,0]] HAPPY WEEKEND! 👍 note: referenced from: https://www.codewars.com/kata/conways-game-of-life-unlimited-edition DEMO, from: https://jsfiddle.net/makeschool_dion/zose7rv3/embedded/result/ One of the best answers, sponsored by JavaScript & Codewars: ANSWER: .https://code.sololearn.com/WdGZ8v3qNuq0/?ref=app Try it in other language!

23rd Aug 2017, 2:29 AM
ysraelcon
ysraelcon - avatar
17 Answers
+ 7
wow i really like this challenge. we had to implement this in university in assembly language with graphical output. looks pretty nice! Maybee it's still on my computer... if it is i will upload a link to it ( if you're interested ) ^^
18th Aug 2017, 6:27 PM
Julian Fechner
Julian Fechner - avatar
18th Aug 2017, 11:00 PM
Izi Lior Katie
Izi Lior Katie - avatar
+ 5
can't find the old version from university. i gave it a try in html ;) https://code.sololearn.com/W29oWuxumMal/?ref=app
20th Aug 2017, 3:48 PM
Julian Fechner
Julian Fechner - avatar
20th Aug 2017, 10:03 AM
ysraelcon
ysraelcon - avatar
+ 2
I know Im late, but here's mine: https://code.sololearn.com/cjekaaj7lQtd/?ref=app
26th Aug 2017, 10:28 AM
ReimarPB
ReimarPB - avatar
+ 1
of course, it could helps ones to resolve it :D, I think this one is hard at least for me, my solution is full long :D
18th Aug 2017, 7:32 PM
ysraelcon
ysraelcon - avatar
+ 1
HEY CODERS OUT THERE... NEW *DAILY CHALLENGE* RIGHT HERE: https://www.sololearn.com/discuss/645450/?ref=app
21st Aug 2017, 3:43 PM
Julian Fechner
Julian Fechner - avatar
+ 1
MY NEW *DAILY CHALLENGE*: GIVE IT A TRY!!! https://www.sololearn.com/discuss/647083/?ref=app
22nd Aug 2017, 10:22 AM
Julian Fechner
Julian Fechner - avatar
+ 1
@Pikachu check the answer on JavaScript, it is already published, so compare your code and if works try it to test it on codewars and thus unlock the kata in c# and bring us the best answer ☺, I don't know much of c# 😐
23rd Aug 2017, 2:01 AM
ysraelcon
ysraelcon - avatar
+ 1
@Pikachu, unlock the solution of the kata on https://www.codewars.com/kata/conways-game-of-life-unlimited-edition with c#, register, there's a lot of challenges 😀, easy and hard ones
23rd Aug 2017, 2:42 PM
ysraelcon
ysraelcon - avatar
0
what is [1,0,0] is it a cell or 3 neghbours
20th Aug 2017, 4:45 AM
‎ ‏‏‎Anonymous Guy
0
[1,0,0] are 3 cells, one alive and 2 dead
20th Aug 2017, 8:23 AM
ysraelcon
ysraelcon - avatar
28th Aug 2017, 8:30 AM
sayan chandra
sayan chandra - avatar
- 1
Ur question is understandable????
20th Aug 2017, 9:55 AM
KRITESH OJHA
KRITESH OJHA - avatar
- 1
different challenge on the way TUESDAY TALES https://www.sololearn.com/discuss/646010/?ref=app
21st Aug 2017, 7:23 PM
sayan chandra
sayan chandra - avatar
- 1
HERES THE NEW CHALLENGE... CHECK IT OUT FRIENDS https://www.sololearn.com/discuss/653982/?ref=app
24th Aug 2017, 6:51 PM
sayan chandra
sayan chandra - avatar
- 1
26th Aug 2017, 3:33 AM
sayan chandra
sayan chandra - avatar