These words are a portion of the retort uttered by the Moroccan Prince when he addresses Portia. In these lines, he is indirectly referring to the gamble that he has undertaken by competing in a lottery for Portia's hand in marriage. The venture was formulated by Portia's now deceased father and demands that suitors choose the right casket of three to successfully claim her as a bride.
The Prince compares this particular risk to playing a game of dice in which the outcome is never guaranteed. The Prince regrets that he has to participate in such a demeaning exercise. The end result is determined by fate which means that the participants cannot determine the outcome. To illustrate and emphasize his point, he alludes to a hero of classic Roman mythology, Hercules, who was renowned for his prowess and great strength. This section of the Prince's speech reads as follows:
If Hercules and Lichas play at dice
Which is the better man, the greater throw
May turn by fortune from the weaker hand:
So is Alcides beaten by his page;
And so may I, blind fortune leading me,
Miss that which one unworthier may attain,
And die with grieving.
The Prince is suggesting that if Hercules should play dice with his servant Lichas to determine which of the two is better, the result might go to the weaker man, in this case Lichas. The Prince is suggesting that he may become the victim of a similar outcome and lose to someone of a much lowlier stature and status than him. He declares that he will die of sadness if that should happen.
As it is, the arrogant and pompous Prince does get an opportunity to choose a casket in scene 7, and he makes the wrong choice. The Prince's earlier contention that the outcome of a lottery lies in the hands of fate is quite ironic here because his arrogance is what makes him choose incorrectly, not destiny.
His decision for not choosing the silver chest is determined by his supercilious assertion that it is unacceptable because "A golden mind stoops not to shows of dross" and that even thinking about choosing the lead casket would be "damnation to think so base a thought." He decides on the gold casket and is surprised when he finds a skull with an accompanying scroll inside. The scroll reads, in part:
All that glitters is not gold;...
...Fare you well; your suit is cold.
Cold, indeed; and labour lost:...
The Prince offers a saddened farewell, and he and his entourage depart with a flourish. Portia is immensely relieved that he has been unsuccessful.