energy and game end check