See the Wikipedia page on the Prisoner’s Dilemma

The axl.game.prisoner._ package uses axle.game typeclasses to model the game:

scala> import axle._
import axle._

scala> import axle.game._
import axle.game._

scala> import axle.game.prisoner._
import axle.game.prisoner._

scala> import Strategies._
import Strategies._

scala> val p1 = Player("P1", "Player 1")
p1: axle.game.Player = Player(P1,Player 1)

scala> val p2 = Player("P2", "Player 2")
p2: axle.game.Player = Player(P2,Player 2)

scala> val game = PrisonersDilemma(
     |   p1, randomMove, prefixedDisplay("1")(println),
     |   p2, randomMove, prefixedDisplay("2")(println))
game: axle.game.prisoner.PrisonersDilemma = PrisonersDilemma(Player(P1,Player 1),<function2>,<function1>,Player(P2,Player 2),<function2>,<function1>)

scala> play(game)
1> Prisoner's Dilemma
1> You have been caught
2> Prisoner's Dilemma
2> You have been caught
1> You chose betrayal
1> You have been caught
2> Player 1 chose something
2> You have been caught
1> Player 2 chose something
1> You have been caught
2> You chose betrayal
2> You have been caught
1> 
1> You have been caught
1> You is imprisoned for 2 years
1> Player 2 is imprisoned for 2 years
2> 
2> You have been caught
2> Player 1 is imprisoned for 2 years
2> You is imprisoned for 2 years
res0: axle.game.prisoner.PrisonersDilemmaState = PrisonersDilemmaState(Some(Betrayal()),true,Some(Betrayal()))