There is an open source project called LessPass that is trying to solve the password management problem in much the same way that you are describing. Passwords are generated in a deterministic and algorithmic way using a master password, some known values related to the site, and some cryptography.

There are two challenges that I see with this concept. The first one, that you made reference too, is how do you write an algorithm that will generate a password that will be acceptable to the policies of any site.

The second is, how do you deal with sites that insist that you change your password from time to time? In order to do that, you about have to change your algorithm, which means that all your other passwords will be broken.

If these two problems can be solved, I'd be all for this type of password management.