Prisoner's Dilemma game engine implemented using Cats Free Monad and Freestyle
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Free Prisoners

An application built on top of Free Monad in Cats. It shows how Free can be used to create pure DSLs, side-effecting interpreters and how to use those things together.

The example implements a way to play Prisoner's Dilemma in several modes:

Running local games

  1. sbt "runMain com.michalplachta.freeprisoners.apps.HotSeatGame" - to run Hot Seat Game.
  2. sbt "runMain com.michalplachta.freeprisoners.apps.SinglePlayerGame" - to run Single Player Game.

Running Multiplayer Game with the Remote Server

RemoteServerInterpreter uses Akka Remoting (codename Artery).

To run Multiplayer Game you will need three separate sbt sessions:

  1. BIND_PORT=2552 sbt "runMain com.michalplachta.freeprisoners.apps.MultiplayerServer" - to run the server on specified server port,
  2. sbt "runMain com.michalplachta.freeprisoners.apps.MultiplayerGame" - to run the first player session,
  3. sbt "runMain com.michalplachta.freeprisoners.apps.MultiplayerGame" - to run the second player session.

See application.conf for more details about the configuration of all 3 actor systems.