"      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ -Simplistic role data structure and instances.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneINOThe Loner allegiances are seldom used, rather they are present for correctness.uRole definitions require only a few pieces of information. Most of the game logic behind a role is implemented in Game.Werewolf.Command and Game.Werewolf.Engine.The balance attribute on a role indicates the allegiance it favours. For example, a Simple Werewolf has a balance of -4 while the Seer has a balance of 2. A balance of 0 means it favours neither allegiance.+N.B., role equality is defined on just the  as a role's # may change throughout the game. 5A list containing all the roles defined in this file.EA list containing roles that are restricted to a single instance per Game.   =   \\ [, ] YAbandoned by their parents as a child, with no-one wanting to look after another mouth to Zfeed, the Orphan was left to fend for themself. No-one looked twice at the Orphan and even \fewer showed kindness towards the lonely child. One day however, one townsperson changed all \this. He offered the Orphan food, water and a roof over their head. Grateful for his chairty Yand affection, the Orphan made him their role model. Pray that no ill should befall their Jrole model, for they are the only one conforming the Orphan as a Villager.On the first night, the Orphan chooses a player to become their role model. So long as the role model is alive, the Orphan is a Villager. If however the role model is eliminated, then the Orphan becomes a Werewolf.]Long ago during the War in Heaven, angels fell from the sky as one by one those that followed ZLucifer were defeated. For centuries they lived amongst mortal Villagers as punishment for Ytheir sins and wrongdoings. The Fallen Angel was one such being and is now one of the few ]angels left on Earth. Nothing is worse punishment for them, the Fallen Angel yearns for death to once again be free!fWhen the Fallen Angel is in play, the game begins with the village's vote and then the first night.The Fallen Angel wins if they manage to get eliminated on the first round (day or night). If however they fail, they become a Villager for the rest of the game.YHow honoured we are to be in the presence of such a noble leader. The return of the Druid \marks an exceptional time in Fougres's history! Friend of the woodland creatures, practiced Vphilosopher and now, with the help of Ferina their companion, a bane to the Werewolves \themselves! My does she have a nose on her, strong enough to sniff out lycanthropes in close Sproximity! Listen for her grunt and heed her warning for she will not let you down.Each morning when Ferina wakes from her slumber she will be alert and cautious. If the Druid is next to a Werewolf then Ferina will grunt in warning.]A skilled marksman with quick reflexes. In the unfortunate situation that they are jumped and Zkilled unjustly, they let off a shot at their attacker, killing them instantly. The Hunter  never misses.cIf the Hunter is killed they choose one player, believed to be an attacker, to kill immediately.XThe Protector is one of the few pure of heart and altruistic Villagers; they are forever Wputting others needs above their own. Each night they fight against the Werewolves with Dnaught but a sword and shield, potentially saving an innocents life.Each night the Protector chooses a player deemed worthy of their protection. That player is safe for that night (and only that night) against the Werewolves.BThe Protector may not protect the same player two nights in a row.ZWerewolves don't just spring up out of the ground! That's where dwarves come from. Clearly Wsomeone is to blame for this affliction to Fougres. Unluckily for the Scapegoat, since Pno-one actually knows who brought them here, the blame is always laid upon them!\If the village's vote ends in a tie, it's the Scapegoat who is eliminated instead of no-one.In this event, the Scapegoat has one last task to complete: they must choose whom is permitted to vote or not on the next day.[The Seer has the ability to see into fellow townsfolk and determine their true nature. This ]ability to see is not given out lightly, for certain it is a gift! The visions will always be Ptrue, but only for the present as not even the Seer knows what the future holds.FEach night the Seer sees the allegiance of one player of their choice.XA simple, ordinary townsperson in every way. Some may be cobblers, others bakers or even [nobles. No matter their differences though, the plight of Werewolves in Fougres unites all 'the Villagers in this unfortunate time.The Simple Villager has no special abilities, they must use their guile to determine whom among them is not who they say they are.WEvery village needs a Jester; they're so stupid, but provide so much entertainment! The [Jester may not have any special abilities, but at least no one in the village wants to hurt them.If the village votes to lynch the Jester, their identity is revealed. The village realise there's no point in burning them and so they are set free.VThe Jester continues to play but may no longer vote as no one can take them seriously.\The True Villager has a heart and soul as clear as day! Their allegiance and devotion to the ]village are beyond reproach. If there is one person whom you should confide in, listen to and trust, it is the True Villager.BAt the start of the game the True Villager's identity is revealed.]Somehow forgotten with the coming of the Werewolves, the Witch has a chance to prove themself Zvaluable to the village and maybe abolish the absurd pastime of burning and drowning their [cult. The Witch is blessed (or maybe cursed) with the ability to make two powerful potions; Jone of which heals a victim of the Werewolves, the other poisons a player.The Witch is called after the Werewolves. They are able to heal and poison one player per game. There is no restriction on using both potions in one night or to heal themself.WThe Simple Werewolf is a fearsome lupine, cunning like no other creature that roams the \forest. Their origin is unknown, but that matters little, for they present a grave threat to ZFougres. While each day they hide in plain sight as an ordinary Villager, each night they Ltransform and devour an innocent. There is little hope left for the village.-A Werewolf may never devour another Werewolf.The counter-part to !, but more general as it takes a  instead.A re-write of  to be more general by taking a  instead.A companion to M that, rather than using a predicate, filters on the given lens for matches.%     %Response and message data structures.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone0 =A message may be either public or private, indicated by it's to field.Each message contains a single text field. This field is permitted to contain special characters such as new lines and tabs. The message recipient:  for a public message,  for a private message.!The message text."#When a user sends a command to the werewolf' binary, a response is always returned.)The chat interface should then relay any messagesN from the response. Whether or not the command was valid (indicated by the ok+ flag) is often irrelevant as the returned messages$ will include errors to the user.$!Boolean flag to indicate success.%List of messages.&A successful, empty response.' An unsuccessful, empty response.(PExits fast with the given response. The response is encoded as JSON, printed to stdout( and then the program is exited with 0 (success).The program always exits with success even if the response was a failure one. This is to distinguish between bad calls to the binary and bad commands to the werewolf engine.)-Creates a public message with the given text.* privateMessage to messageCreates a private message to to with the given text.+ groupMessages tos messageLCreates multiple private messages (1 to each recipient) with the given text. !"#$%&'()*+ !"#$%&'()*+"#$%&'( !)*+  !"#$%&'()*+uSimplistic player data structure with functions for searching, filtering and querying lists of players.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone47IN$,"Surprise surprise, players may be . or -./A player has a 0, 1 and 22. Any stateful information needed for a player's role is held on the Game itself.-N.B., player equality is defined on just the 0.5Creates a new - player.6The traversal of / s with a . 6 = 1 .   7The traversal of / s with an . 7 = 1 .   8The traversal of / s with a . 8 = 1 .   9The traversal of / s with a . 9 = 1 .   :The traversal of / s with a . : = 1 .   ;The traversal of / s with a . ; = 1 .   <The traversal of / s with a . < = 1 .   =The traversal of / s with a . = = 1 .   >The traversal of / s with a . > = 1 .   ?The traversal of / s with a . ? = 1 .   @The traversal of / s with a . @ = 1 .   AThe traversal of / s with a . A = 1 .   BThe traversal of /s aligned with the . B = 1 .  .   CThe traversal of /s aligned with the . C = 1 .  .   DThis  provides the traversal of / names. D =  . 0 EThis  provides the traversal of / roles. E =  . 1 FThis  provides the traversal of / states. F =  . 2 GThis  provides the traversal of 6 /s. G =  .  ( 6) HThis  provides the traversal of 7 /s. H =  .  ( 7) IThis  provides the traversal of 8 /s. I =  .  ( 8) JThis  provides the traversal of 9 /s. J =  .  ( 9) KThis  provides the traversal of : /s. K =  .  ( :) LThis  provides the traversal of ; /s. L =  .  ( ;) MThis  provides the traversal of < /s. M =  .  ( <) NThis  provides the traversal of = /s. N =  .  ( =) OThis  provides the traversal of > /s. O =  .  ( >) PThis  provides the traversal of ? /s. P =  .  ( ?) QThis  provides the traversal of @ /s. Q =  .  ( @) RThis  provides the traversal of A /s. R =  .  ( A) SThis  provides the traversal of B /s. S =  .  ( B) TThis  provides the traversal of C /s. T =  .  ( C) UThis  provides the traversal of - /s. U =  ( $ 2 . 3) VThis  provides the traversal of . /s. V =  ( $ 2 . 4) 0,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV.,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV./012,-.3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV*,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVPGame data structure with functions for manipulating and querying the game state.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone"W Events occur after a [2 is advanced. This is automatically handled in 7, while an event's specific behaviour is defined by  and .DFor the most part events are used to allow something to happen on a [2 different to when it was triggered. E.g., the  DeovurEvent~ occurs after the village wakes up rather than when the Werewolves' vote, this gives the Witch a chance to heal the victim.X WerewolvesYProtector, Werewolves and WitchZWitch[<Most of these are fairly self-sufficient (the turn stages). e and fS are provided as meaningful breaks between the day and night as, for example, a g? may not always be available (curse that retched Scapegoat).2Once the game reaches a turn stage, it requires a d to help push it past. Often only certain roles and commands may be performed at any given stage.jVThere are a few key pieces of information that a game always needs to hold. These are:the |,the y number,the s andthe m.Any further fields on the game are specific to one or more roles (and their respective turns!). Some of the additional fields are reset each round (e.g., the Seer's {I) while others are kept around for the whole game (e.g., the Orphan's x).In order to advance a game's 2, a Y from a user needs to be received. Afterwards the following steps should be performed:  the .run .run .g will perform any additional checks and manipulations to the game state before advancing the game's |. It also runs any relevant m. Y will check to see if any of the win conditions are met and if so, advance the game's | to ]. ScapegoatWitchWitchHunterJesterWitchWitchWitch Protector ProtectorOrphan ScapegoatSeerVillagers and Werewolves All of the [&s in the order that they should occur.An infinite cycle of all [&s in the order that they should occur.4Checks whether the stage is available for the given js. Most often this just involves checking if there is an applicable role alive, but sometimes it is more complex./One of the more complex checks here is for the g.. If the Fallen Angel is in play, then the gF is available on the first day rather than only after the first night.Creates a new jQ with the given players. No validations are performed here, those are left to .Kills the given player! This function should be used carefully as it doesn't clear any state that the player's role may use. If you're after just removing a player from a game for a test, try using a  instead. Gets all the k? in a game (which is names only) and maps them to their player. Gets all - players that have yet to vote.Gets all players that had theh highest vote count. This could be 1 or more players depending on whether the votes were in conflict.  game = game ^. y == 0*Queries whether the player is in the game.Queries whether anyone has won.~Queries whether the Fallen Angel has won. The Fallen Angel wins if they manage to get themselves killed on the first round.-N.B., we check that the Fallen Angel isn't a B< as the Fallen Angel's role is altered if they don't win.Queries whether the  Villagers have won. The  Villagers/ win if they are the only players surviving.Queries whether the  Werewolves have won. The  Werewolves/ win if they are the only players surviving.ZWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~FWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Fj|ysmlknopqrtuvwxz{}[\]^_`abcdefghi~WXYZ5WXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~+Suite of messages used throughout the game.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneA      +     A      $Utility functions for working in a (! j) environment.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone47IN"Fudges the player's allegiance. This function is useful for roles such as the Orphan where they align themselves differently given some trigger."#$"%&'()*+,-./0123456789:;<=>?@ABC"#$"%&'()*+,-./0123456789:;<=>?@ABC"#$"%&'()*+,-./0123456789:;<=>?@ABCEngine functions.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone47 DEFGHIJK DEFGHIJKCommand data structure.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone47IN+Re-exports all of the public modules under  Game.Werewolf.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Global commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneHunter commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone Orphan commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone Protector commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone Scapegoat commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone Seer commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone Status commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone47LMNLMNVillager commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneWerewolf commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneWitch commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone47OOP !"#$%&'()*+,-./0123456789:;;<=>>?@ABCDEFGHIJ&KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ "J      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU V W XYZwerew_6wW85cAHWuo1coYOYF9YVXGame.Werewolf.RoleGame.Werewolf.ResponseGame.Werewolf.PlayerGame.Werewolf.GameGame.Werewolf.EngineGame.Werewolf.CommandGame.Werewolf.Command.GlobalGame.Werewolf.Command.HunterGame.Werewolf.Command.OrphanGame.Werewolf.Command.ProtectorGame.Werewolf.Command.ScapegoatGame.Werewolf.Command.SeerGame.Werewolf.Command.StatusGame.Werewolf.Command.VillagerGame.Werewolf.Command.WerewolfGame.Werewolf.Command.WitchControl.Lens.Prismisn't checkStageeventAvailable applyEventCommandapply checkGameOver startGame quitCommandGame.Werewolf.MessagesGame.Werewolf.Util Game.Werewolf Allegiance FallenAngel Villagers WerewolvesRole allegiancebalance descriptionnamerules _FallenAngel _Villagers _WerewolvesallRolesrestrictedRoles orphanRolefallenAngelRole druidRole hunterRole protectorRole scapegoatRoleseerRolesimpleVillagerRole jesterRoletrueVillagerRole witchRolesimpleWerewolfRoleis filteredByMessagetomessageResponseokmessagessuccessfailureexitWith publicMessageprivateMessage groupMessagesStateAliveDeadPlayerrolestate_Alive_Dead newPlayerdruid fallenAngelhunterjesterorphan protector scapegoatseersimpleVillagersimpleWerewolf trueVillagerwitchvillagerwerewolfnamesrolesstatesdruids fallenAngelshuntersjestersorphans protectors scapegoatsseerssimpleVillagerssimpleWerewolves trueVillagerswitches villagers werewolvesalivedeadEvent DevourEvent NoDevourEvent PoisonEventStage FerinasGruntGameOver HuntersTurn1 HuntersTurn2Lynching OrphansTurnProtectorsTurnScapegoatsTurn SeersTurnSunriseSunset VillagesTurnWerewolvesTurn WitchsTurnGame allowedVotersbootseventshealhealUsedhunterRetaliatedjesterRevealedpassedplayerspoison poisonUsed priorProtectprotect roleModelroundscapegoatBlamedseestagevotes _FerinasGrunt _GameOver _HuntersTurn1 _HuntersTurn2 _Lynching _OrphansTurn_ProtectorsTurn_ScapegoatsTurn _SeersTurn_Sunrise_Sunset _VillagesTurn_WerewolvesTurn _WitchsTurn _DevourEvent_NoDevourEvent _PoisonEvent allStages stageCyclestageAvailablenewGame killPlayergetAllowedVotersgetPendingVoters getVoteResult isFirstRounddoesPlayerExist hasAnyoneWonhasFallenAngelWonhasVillagersWonhasWerewolvesWon noopCommandvalidatePlayer bootCommand chooseCommandprotectCommand seeCommand circleCommand pingCommand statusCommand voteCommand healCommand passCommand poisonCommandlens_0f1h8kfSy2H9wXZb3I8k5LControl.Lens.GetterGettingControl.Lens.Foldfiltered_name _allegiance_balance _description_rules$fEqRolebaseGHC.BaseNothingJust$fToJSONMessage$fFromJSONMessage$fToJSONResponse$fFromJSONResponseonlyControl.Lens.Type TraversalData.Traversabletraversehas_role_state $fEqPlayer_allowedVoters_heal _healUsed_hunterRetaliated_jesterRevealed_passed_poison _poisonUsed _priorProtect_protect _roleModel_scapegoatBlamed_see_votes_stage_round_players_events_bootsnewGameMessagesnewPlayersInGameMessagenewPlayerMessagetrueVillagerMessage stageMessageshuntersTurnMessagesorphansTurnMessagesprotectorsTurnMessagesscapegoatsTurnMessagesseersTurnMessagessunriseMessagenightFallsMessagefirstVillagesTurnMessagesvillagesTurnMessagesfirstWerewolvesTurnMessageswerewolvesTurnMessageswitchsTurnMessagesgameOverMessagesplayerWonMessageplayerContributedMessageplayerLostMessageplayerQuitMessagegameIsOverMessageplayerDoesNotExistMessageplayerCannotDoThatMessage!playerCannotDoThatRightNowMessageplayerIsDeadMessagetargetIsDeadMessageplayerVotedToBootMessageplayerBootedMessage"playerHasAlreadyVotedToBootMessage circleMessagepingPlayerMessagepingRoleMessagecurrentStageMessagesrolesInGameMessageplayersInGameMessagewaitingOnMessageferinaGruntsMessage!fallenAngelJoinedVillagersMessageplayerShotMessageorphanJoinedPackMessages/playerCannotProtectSamePlayerTwiceInARowMessage"scapegoatChoseAllowedVotersMessage'playerMustChooseAtLeastOneTargetMessageplayerCannotChooseJesterMessageplayerSeenMessageplayerMadeLynchVoteMessageplayerLynchedMessagenoPlayerLynchedMessagejesterLynchedMessagescapegoatLynchedMessageplayerHasAlreadyVotedMessageplayerMadeDevourVoteMessageplayerDevouredMessagenoPlayerDevouredMessage(playerCannotDevourAnotherWerewolfMessageplayerCannotChooseSelfMessageplayerPoisonedMessageplayerHasAlreadyHealedMessageplayerHasAlreadyPoisonedMessagearticle concatList conjugateToBe tryPluralmtl_Aue4leSeVkpKLsfHIV51E8Control.Monad.State.Class MonadStatesetPlayerAllegiance removePlayer findPlayerBy_getAdjacentAlivePlayers getPlayerVote isGameOver isHuntersTurn isOrphansTurnisProtectorsTurnisScapegoatsTurn isSeersTurn isSunriseisVillagesTurnisWerewolvesTurn isWitchsTurnisPlayerHunterisPlayerJesterisPlayerOrphanisPlayerProtectorisPlayerScapegoat isPlayerSeer isPlayerWitchisPlayerWerewolf isPlayerAlive isPlayerDead checkBoots checkStage' lynchVotees devourVotees advanceStage checkEventspingRole pingVillagerspingWerewolvesvalidateCommand