Jeremiah 18:7-10
"At what instant I shall speak concerning a nation, and concerning a kingdom, to pluck up, and to pull down, and to destroy it;
If that nation, against whom I have pronounced, turn from their evil, I will repent of the evil that I thought to do unto them.
And at what instant I shall speak concerning a nation, and concerning a kingdom, to build and to plant it;
If it do evil in my sight, that it obey not my voice, then I will repent of the good, wherewith I said I would benefit them."
===============================
There is a basis as to why God shows mercy or not, and that basis is.........OBEDIENCE
If that nation (Nineveh), against whom I have pronounced (overthown in 40 days), turn from their evil (Nineveh repented) I will repent of the evil that I thought to do unto them.(And God saw their works, that they turned from their evil way; and God repented of the evil, that he had said that he would do unto them; and he did it not.)
Pharaoh would not repent therefore saw no mercy.
Gen 6:9 "...Noah was a righteous man and perfect in his generations, and Noah walked with God."
Gen 7:1 "And the LORD said unto Noah, Come thou and all thy house into the ark; for thee have I seen righteous before me in this generation."
Noah was an obedient, righteous man therefore found grace in God's eyes.
God SAW the obedient repentance of Nineveh and SAW Noah's righteous and his walk of obedience. Faith is not just a mental assent of the mind but an action, an action that could be seen by God.