USGA defines a stroke as any swing you had the intent to hit the ball, but this is a bit strict for our skill level. If you completely miss the ball and it doesn't move, it doesn't count. The opposite is true as well, if you accidentally hit the ball on practice swing simply return the ball to where it was.