battleship

Safe HaskellSafe

PlayerInterface

Description

This trusted module implements player interfaces, which are secure against each other. Each player interface creates its own player (see Player). Player interfaces communicate using the mechanism of PlayerInterfaceMsg.

Synopsis

Documentation

playerInterface :: Handle -> (PIMsg -> DC ()) -> DC PIMsg -> Bool -> DCPriv -> DC ()

playerInterface clnt send recv goFirst priv returns a DC action that, when run, starts a player interface.

  • The current state must have label dcPublic and clearance cFalse %% cTrue.
  • clnt is the handle used for communicating with the player's client side; its label must be dcPublic.
  • send and recv are used for communicating with the opponent player interface; they must work when the current label and clearance are dcPublic and clearance cFalse %% cTrue, and must not affect the current label or clearance.
  • goFirst is True iff the player interface is supposed to take the first (3rd, 5th, etc.) turn.
  • toCNF priv is toCNF $ principal "player1", if goFirst, and is toCNF $ principal "player2", otherwise.

As the DC action is run, the current label and clearance will be maintained at dcPublic and cFalse %% cTrue, respectively.