The stunt was part of one contestant's act, a mentalist named Peter Antoniou. He performed a sort of psychological game and used the judges in his skit.

Simon Had To Guess Which Can Had Pineapple

Antoniou explained that in college, a popular prank was taking the labels off cans, so a person did not know what they would be eating.

He used that trick for his skit for Tuesday's episode. The performer had four cans on stage: one with pineapple and three filled with brawn.

Next, he tells Vergara that she has to eat one of the cans, but explained that Cowell would be picking which one.

Antoniou then asked Simon to guess which one contained the fruit.

Cowell seemed to be unsure which of the cans to choose, and he changed his mind a few times on which one he thought had the pineapple.

First he chose the yellow one, then changed his decision to black, and then began to go back and forth between the blue and the yellow. When Antoniou asked for his final decision, he settled on the yellow.

Related: Sofia Vergara Heats Things Up, As She Teases 'America's Got Talent'

Sofia Had To Eat The Can Simon Picked

After Cowell finally decided on a can, the next step was for a blindfolded Vergara to eat whatever was in it.

"I don't understand why it always has to be me," Sofia complained as she slipped the blindfold on.

Related:

America's Got Talent: 10 Ways The Talent Competition Is Staged

Antoniou then prompted her with a "Go!" and instructed her to dip into the can and eat what is on the fork.

She put it in her mouth and hesitatingly paused before realizing with relief that it was the one with pineapple.

The judge was so happy to not be eating the brawn, she ended up taking a few more bites of the yellow can.

Antoniou then had a final trick up his sleeve, instructing Simon to open a can that was placed on his desk. Inside was a piece of paper that correctly guessed some of the judge's favorite foods, to their amazement and the audience's.

Next: How Much Does ‘America’s Got Talent’ Judge, Sofia Vergara Make?