My Uncle's inheritance

It seems to be really common these days, but I too have a mysterious uncle that recently passed away. As all good uncles are, he was into puzzles and enigmas. After his death I have inherited his house, a really big manor far from the city.

Today I decided to go there to check it out. It took me a while to explore it all. I was hoping to find some of those games he created that I remember playing when I was a child, but I found none. Until I found his bedroom. As soon as I entered that room, something immediately caught my eye. On one of the walls there was a giant metal safe with two pieces of paper taped on it.

The first one was a letter handwritten by him. Here it is:

Dear FrodCube,

if you are reading this letter, it means that I am no longer in this world. I have decided to leave one last puzzle for you to solve. Your task is to open this old safe, finding the correct passcode. As you can see you will need to enter a $9$ digit code using its keypad. To make things easier for you, I have decided to use each of the numbers $1$ to $9$ once and only once in the code. To find it you will need to solve the puzzle you see next to this letter, but I'm not going to tell you how. That would be too easy!

Open the safe and all the games I have created during my lifetime will be yours.
Goodbye nephew, I hope you will have fun with this little head-scratcher of mine. Just remember this: being selfish is wrong. You should really care about those around you.

Carl Peter Fuzz.

Here is the other piece of paper:

What should I type to open the safe?

• it would be awesome if this happened to me Feb 10, 2017 at 2:36

The "selfish" comment:

The hint beneath each of the 9 blocks is the number of correct cells in that row or column in the blocks around this one. For instance, the hint "C=0" below the upper-left blocks means that of the two yellow blocks next to it, neither has an answer in the right column. Start by eliminating 0s.

If you need a second step:

The top-middle block has 3 blocks around it. 2 of those have to have answers in the bottom row, and 1 has to have an answer in the middle row, which means none can have an answer in the top row.

The numbers remaining in each area are:

879
245
316

The code is

either 879-245-316 (those numbers read left-to-right and top-to-bottom), or 847-569-213 (the number in each cell represents the order in which to press it), probably the latter.

• Are you planning to explain this further? Feb 10, 2017 at 2:46
• OK, just a minute... Feb 10, 2017 at 2:47
• Sorry it's not very clear... if you can do better, have at it. Feb 10, 2017 at 2:54