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

Safe HaskellNone

Language.Nomyx.Examples

Description

This file gives a list of example rules that the players can submit. You can copy-paste them in the field Code of the web GUI. Don't hesitate to get inspiration from there and create your own rules!

Synopsis

Documentation

nothing :: RuleSource

A rule that does nothing

helloWorld :: RuleSource

A rule that says hello to all players

accounts :: MsgVar [(PlayerNumber, Int)]Source

account variable name and type

createBankAccount :: RuleSource

Create a bank account for each players

winXEcuPerDay :: Int -> RuleSource

each player wins X Ecu each day you can also try with minutly or monthly instead of daily and everything in the time-recurrence package

winXEcuOnRuleAccepted :: Int -> RuleSource

a player wins X Ecu if a rule proposed is accepted

moneyTransfer :: RuleSource

a player can transfer money to another player it does not accept new players or check if balance is positive, to keep the example simple

delRule :: RuleNumber -> RuleSource

delete a rule

voteWithMajority :: RuleSource

a majority vote, with the folowing parameters: a quorum of 2 voters is necessary for the validity of the vote the vote is assessed after every vote in case the winner is already known the vote will finish anyway after one day

makeKing :: PlayerNumber -> RuleSource

player pn is the king: we create a variable King to identify him, and we prefix his name with King

monarchy :: RuleSource

Monarchy: only the king decides which rules to accept or reject

revolution :: PlayerNumber -> RuleSource

Revolution! Hail to the king! This rule suppresses the democracy (usually rules 1 and 2), installs the king and activates monarchy.

displayTime :: RuleSource

will display the time to all players in 5 seconds

iWin :: RuleSource

Only one player can achieve victory: No group victory. Forbidding group victory usually becomes necessary when lowering the voting quorum: a coalition of players could simply force a victory rule and win the game. noGroupVictory :: RuleFunc noGroupVictory = ruleFunc $ onEvent_ Victory $ (VictoryData ps) -> when (length ps >1) $ setVictory []

Rule that state that you win. Good luck on having this accepted by other players ;)

returnToDemocracy :: [RuleNumber] -> RuleSource

Change current system (the rules passed in parameter) to absolute majority (half participants plus one)

victoryXRules :: Int -> RuleSource

set the victory for players having more than X accepted rules

banPlayer :: PlayerNumber -> RuleSource

kick a player and prevent him from returning

referendumOnKickPlayer :: RuleSource

triggers a referendum, if the outcome is yes player 2 will be kicked

gameMasterElections :: RuleSource

triggers elections (all players are candidates), the winner becomes game master

bravoButton :: RuleSource

display a button and greets you when pressed (for player 1)

displayBankAccount :: RuleSource

Permanently display the bank accounts