Nomyx-Language-0.4.1: Language to express rules for Nomic

Safe HaskellNone

Language.Nomyx.Players

Contents

Description

All the building blocks to allow rules to manage players.

Synopsis

Players

getPlayers :: Nomex [PlayerInfo]Source

get all the players

getPlayer :: PlayerNumber -> Nomex (Maybe PlayerInfo)Source

Get a specific player

getPlayerName :: PlayerNumber -> Nomex (Maybe PlayerName)Source

Set the name of a player

setPlayerName :: PlayerNumber -> PlayerName -> Nomex BoolSource

Set the name of a player

getPlayersNumber :: Nomex IntSource

Get the total number of players

getAllPlayerNumbers :: Nomex [PlayerNumber]Source

Get all the players number

delPlayer :: PlayerNumber -> Nomex BoolSource

Remove the player from the game (kick)

forEachPlayer :: (PlayerNumber -> Nomex ()) -> (PlayerNumber -> Nomex ()) -> (PlayerNumber -> Nomex ()) -> Nomex ()Source

perform an action for each current players, new players and leaving players

forEachPlayer_ :: (PlayerNumber -> Nomex ()) -> Nomex ()Source

perform the same action for each players, including new players

createValueForEachPlayer :: forall a. (Typeable a, Show a, Eq a) => a -> MsgVar [(PlayerNumber, a)] -> Nomex ()Source

create a value initialized for each players manages players joining and leaving

createValueForEachPlayer_ :: MsgVar [(PlayerNumber, Int)] -> Nomex ()Source

create a value initialized for each players initialized to zero manages players joining and leaving

getValueOfPlayer :: forall a. (Typeable a, Show a, Eq a) => PlayerNumber -> MsgVar [(PlayerNumber, a)] -> Nomex (Maybe a)Source

modifyValueOfPlayer :: (Eq a, Show a, Typeable a) => PlayerNumber -> MsgVar [(PlayerNumber, a)] -> (a -> a) -> Nomex ()Source

modifyAllValues :: (Eq a, Show a, Typeable a) => MsgVar [(PlayerNumber, a)] -> (a -> a) -> Nomex ()Source

showPlayer :: PlayerNumber -> Nomex StringSource

show a player name based on his number

setVictory :: [PlayerNumber] -> Nomex ()Source

set victory to a list of players

giveVictory :: PlayerNumber -> Nomex ()Source

give victory to one player