Mygame of life javascript solution