implement transition function in Life class