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:
- Hot Seat Game - two players play using one computer and console input/output,
- Single Player Game - one player plays against a bot,
- Multiplayer Game - one player plays against another player (or bot) on remote server.
Running local games
sbt "runMain com.michalplachta.freeprisoners.apps.HotSeatGame"- to run Hot Seat Game.
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
BIND_PORT=2552 sbt "runMain com.michalplachta.freeprisoners.apps.MultiplayerServer"- to run the server on specified server port,
sbt "runMain com.michalplachta.freeprisoners.apps.MultiplayerGame"- to run the first player session,
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.