docstring and improvements for game_machine
game machine state diagram