Lesson 19. Capstone: The prisoner’s dilemma

Let’s pretend you’ve been given the honor of organizing a hack-a-thon—a programming competition where competitors are given a coding challenge they’re expected to solve.

Being the lover of game theory that you are, you decide to use the prisoner’s dilemma as the challenge for the hack-a-thon. How did I know you are a lover of game theory, you ask? Ahem, who isn’t? But on the off chance that you’re not, I’ll explain the prisoner’s dilemma. Two prisoners are interrogated in separate rooms, each asked to snitch on the other prisoner. Exactly what happens when each prisoner snitches on the other changes depending on who tells the story, but the basic idea is this. The best outcome for both prisoners is ...

Get Get Programming with JavaScript Next now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.