more complex life simulation - JavaScript