I usually swear a lot and flip the tv/console/computer off. It doesn't change anything re: cheating bastard AI/stupid mechanics, but it allows me to vent my hate.
Often I'll keep at it until I beat that particular part then quit and leave the game untouched for days/months/years/ever.