Is the word "rule" used in the same way in the following two sentences?

It was his rule to take a walk before breakfast.

He knew the rules of chess.
different meanings