Apparently this scene from The Labyrinth is based on the heaven/hell logic puzzle he devised: https://www.youtube.com/watch?v=ReFhu8KYbmU
> Many of his logic problems are extensions of classic puzzles. Knights and Knaves involves knights (who always tell the truth) and knaves (who always lie). This is based on a story of two doors and two guards, one who lies and one who tells the truth. One door leads to heaven and one to hell, and the puzzle is to find out which door leads to heaven by asking one of the guards a question. One way to do this is to ask "Which door would the other guard say leads to hell?". This idea was famously used in the 1986 film Labyrinth.
According to: https://en.wikipedia.org/wiki/Raymond_Smullyan