life game impl by javascript