YGl      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ %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.     8Humanise type class for pretty printing data structures.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comSafe-Simplistic role data structure and instances.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneINThe  allegiance is used for the Loners. It is not used to determine who has won (i.e., if one Loner wins, the others still lose).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. YHah, maybe not as liked as the Jester, but the Drunk sure does their fair share of stupid Zthings in the night! No-one knows if they even actually make it home; sometimes people see [them sleeping outside the Blacksmith's home, others say they see them wandering towards the \woods. It's pointless quizzing the Village Drunk in the morning about their doings; they can never remember what they did!:The Village Drunk is initially aligned with the Villagers.{On the third night the Village Drunk sobers up and is randomly assigned a new alignment, either Villagers or Werewolves.!]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."ZAwareness comes easy to the Beholder. They listen to their senses and trust their hunches. YOver the years the Beholder has grown to know a certain few of the village just by paying Xattention. Little cues here and there, the way someone talks, the way they move - it all -gives clues as to their true nature and role.FAt the start of the game the Beholder is informed the Seer's identity.#]Never trust a politician. Nor a Crooked Senator for that matter. The Crooked Senator may seem [like he has the village's best interests at heart, but let's be honest, when put in a tough [situation he looks after no-one but himself. Even when safe, the Crooked Senator may decide Ito toy with the Villagers' emotions and try pit them against one another.?The Crooked Senator looks at the village votes as they come in.$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.&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.'[Traditionally a Werewolf once transformed loses all memories and personality. Over years of Ytransforming, the Lycan has slowly evolved and learnt how to retain themself. Night after \night of devouring with the other Werewolves took its toll. The screams alone were enough to 8turn the Lycan and make them question their true nature.nThe Lycan is aligned with the Villagers, but appears to nature-seeing roles (e.g., the Seer) as a Werewolf.(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.,\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..]The Alpha Wolf leads the Werewolves in the raids against Fougres each night and not even the [Seer can see them coming. If the Werewolves caused the Villagers to question and accuse one Wanother beforehand, the Alpha Wolf eliminates any shred of humanity left. No-one can be +trusted anymore and no-one knows the truth.MThe Alpha Wolf appears to nature-seeing roles (e.g., the Seer) as a Villager./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.( !"#$%&'()*+,-./  !"#$%&'()*+,-./  !"#$%&'()*+,-./ !"#$%&'()*+,-./0Extra utility functions for working with lenses.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneIN0The counter-part to 1!, but more general as it takes a  instead. 0 = 1A re-write of  to be more general by taking a  instead. 1 = 2A companion to M that, rather than using a predicate, filters on the given lens for matches.012012012012uSimplistic player data structure with functions for searching, filtering and querying lists of players.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone4IN.3"Surprise surprise, players may be 5 or 4.6A player has a 7, 8 and 92. Any stateful information needed for a player's role is held on the Game itself.-N.B., player equality is defined on just the 7.<Creates a new 4 player.=The traversal of 6 s with a .. = = 8 .  . >The traversal of 6 s with a ". > = 8 .  " ?The traversal of 6 s with a #. ? = 8 .  # @The traversal of 6 s with a $. @ = 8 .  $ AThe traversal of 6 s with an !. A = 8 .  ! BThe traversal of 6 s with a %. B = 8 .  % CThe traversal of 6 s with a &. C = 8 .  & DThe traversal of 6 s with a '. D = 8 .  ' EThe traversal of 6 s with a . E = 8 .   FThe traversal of 6 s with a (. F = 8 .  ( GThe traversal of 6 s with a ). G = 8 .  ) HThe traversal of 6 s with a *. H = 8 .  * IThe traversal of 6 s with a +. I = 8 .  + JThe traversal of 6 s with a /. J = 8 .  / KThe traversal of 6 s with a ,. K = 8 .  , LThe traversal of 6 s with a  . L = 8 .    MThe traversal of 6 s with a -. M = 8 .  - NThe traversal of 6s aligned with the . N = 8 .  .  OThe traversal of 6s aligned with the . O = 8 .  .  PThis  provides the traversal of 6 names. P =  . 7 QThis  provides the traversal of 6 roles. Q =  . 8 RThis  provides the traversal of 6 states. R =  . 9 SThis  provides the traversal of = 6s. S =  .  (0 =) TThis  provides the traversal of > 6s. T =  .  (0 >) UThis  provides the traversal of ? 6s. U =  .  (0 ?) VThis  provides the traversal of @ 6s. V =  .  (0 @) WThis  provides the traversal of A 6s. W =  .  (0 A) XThis  provides the traversal of B 6s. X =  .  (0 B) YThis  provides the traversal of C 6s. Y =  .  (0 C) ZThis  provides the traversal of D 6s. Z =  .  (0 D) [This  provides the traversal of E 6s. [ =  .  (0 E) \This  provides the traversal of F 6s. \ =  .  (0 F) ]This  provides the traversal of G 6s. ] =  .  (0 G) ^This  provides the traversal of H 6s. ^ =  .  (0 H) _This  provides the traversal of I 6s. _ =  .  (0 I) `This  provides the traversal of J 6s. ` =  .  (0 J) aThis  provides the traversal of K 6s. a =  .  (0 K) bThis  provides the traversal of L 6s. b =  .  (0 L) cThis  provides the traversal of M 6s. c =  .  (0 M) dThis  provides the traversal of N 6s. d =  .  (0 N) eThis  provides the traversal of O 6s. e =  .  (0 O) fThis  provides the traversal of 4 6s. f =  ( $ 9 . :) gThis  provides the traversal of 5 6s. g =  ( $ 9 . ;) :3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg53456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg56789345:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg43456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgPGame data structure with functions for manipulating and querying the game state.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone#h Events occur after a l2 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 l2 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.i WerewolvesjProtector, Werewolves and WitchkWitchl<Most of these are fairly self-sufficient (the turn stages). v and wS are provided as meaningful breaks between the day and night as, for example, a y? 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.|VThere are a few key pieces of information that a game always needs to hold. These are:the ,the  number,the  andthe .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 ).In order to advance a game's 9, 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 . Y will check to see if any of the win conditions are met and if so, advance the game's  to n. ScapegoatWitchWitchHunterJesterWitchWitchWitch Protector ProtectorOrphan ScapegoatSeerVillagers and Werewolves All of the l&s in the order that they should occur.An infinite cycle of all l&s in the order that they should occur.4Checks whether the stage is available for the given |s. 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 y.. If the Fallen Angel is in play, then the yF is available on the first day rather than only after the first night.Creates a new |Q 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 }? in a game (which is names only) and maps them to their player. Gets all 4 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 ^.  == 0  game = game ^.  == 2*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 N< 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.^hijklmnopqrstuvwxyz{|}~Ihijklmnopqrstuvwxyz{|}~I|~}lmnopqrstuvwxyz{hijk8hijklmnopqrstuvwxyz{|}~+Suite of messages used throughout the game.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneE      !"#$%&'()*+,-./0123456789:;-  !"#$%&'()*+,-./01234567E      !"#$%&'()*+,-./0123456789:;$Utility functions for working in a (< |) 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.>9Get a random allegiance (either Villagers or Werewolves).#?@=>ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_#?@=>ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_#?@=>ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_Command data structure.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone47INEngine functions.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone47 `abcdefg `abcdefg+Re-exports all of the public modules under  Game.Werewolf.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone  !"#$%&'()*+,-./3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Global commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone Hunter 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.comNoneSeer commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneStatus commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone47hijhijVillager commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneWerewolf commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneWitch commands.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone47kkl  !"##$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRS6TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  2S      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxwerew_4nO90EJnVlz2vXVGddZydfGame.Werewolf.ResponseData.String.HumaniseGame.Werewolf.RoleControl.Lens.ExtraGame.Werewolf.PlayerGame.Werewolf.GameGame.Werewolf.CommandGame.Werewolf.EngineGame.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.WerewolfMessagetomessageResponseokmessagessuccessfailureexitWith publicMessageprivateMessage groupMessagesHumanisehumanise AllegianceNoOne Villagers WerewolvesRole allegiancebalance descriptionnamerules_NoOne _Villagers _WerewolvesallRolesrestrictedRoles orphanRolevillageDrunkRolefallenAngelRole beholderRolecrookedSenatorRole druidRole hunterRole jesterRole lycanRole protectorRole scapegoatRoleseerRolesimpleVillagerRoletrueVillagerRole witchRole alphaWolfRolesimpleWerewolfRoleis filteredByStateAliveDeadPlayerrolestate_Alive_Dead newPlayer alphaWolfbeholdercrookedSenatordruid fallenAngelhunterjesterlycanorphan protector scapegoatseersimpleVillagersimpleWerewolf trueVillager villageDrunkwitchvillagerwerewolfnamesrolesstates alphaWolves beholderscrookedSenatorsdruids fallenAngelshuntersjesterslycansorphans protectors scapegoatsseerssimpleVillagerssimpleWerewolves trueVillagers villageDrunkswitches villagers werewolvesalivedeadEvent DevourEvent NoDevourEvent PoisonEventStage FerinasGruntGameOver HuntersTurn1 HuntersTurn2Lynching OrphansTurnProtectorsTurnScapegoatsTurn SeersTurnSunriseSunsetVillageDrunksTurn VillagesTurnWerewolvesTurn WitchsTurnGame allowedVotersbootseventshealhealUsedhunterRetaliatedjesterRevealedpassedplayerspoison poisonUsed priorProtectprotect roleModelroundscapegoatBlamedseestagevotes _FerinasGrunt _GameOver _HuntersTurn1 _HuntersTurn2 _Lynching _OrphansTurn_ProtectorsTurn_ScapegoatsTurn _SeersTurn_Sunrise_Sunset_VillageDrunksTurn _VillagesTurn_WerewolvesTurn _WitchsTurn _DevourEvent_NoDevourEvent _PoisonEvent allStages stageCyclestageAvailablenewGame killPlayergetAllowedVotersgetPendingVoters getVoteResult isFirstRound isThirdRounddoesPlayerExist hasAnyoneWonhasFallenAngelWonhasVillagersWonhasWerewolvesWon noopCommandvalidatePlayer bootCommand chooseCommandprotectCommand seeCommand circleCommand pingCommand statusCommand voteCommand healCommand passCommand poisonCommandbaseGHC.BaseNothingJust$fToJSONMessage$fFromJSONMessage$fToJSONResponse$fFromJSONResponse_name _allegiance_balance _description_rules$fHumaniseAllegiance$fEqRolelens_KgvaV1Y0kP54rcZ9J9yx7OControl.Lens.GetterGettingControl.Lens.Foldhashasn'tfilteredonlyControl.Lens.Type TraversalData.Traversabletraverse_role_state $fEqPlayer_allowedVoters_heal _healUsed_hunterRetaliated_jesterRevealed_passed_poison _poisonUsed _priorProtect_protect _roleModel_scapegoatBlamed_see_votes_stage_round_players_events_boots$fHumaniseStagenewGameMessagesnewPlayersInGameMessagenewPlayerMessagebeholderMessagetrueVillagerMessage stageMessageshuntersTurnMessagesorphansTurnMessagesprotectorsTurnMessagesscapegoatsTurnMessagesseersTurnMessagesvillageDrunksTurnMessagesunriseMessagenightFallsMessagefirstVillagesTurnMessagesvillagesTurnMessagesfirstWerewolvesTurnMessageswerewolvesTurnMessageswitchsTurnMessagesgameOverMessagesplayerWonMessageplayerContributedMessageplayerLostMessageplayerQuitMessagegameIsOverMessageplayerDoesNotExistMessageplayerCannotDoThatMessage!playerCannotDoThatRightNowMessageplayerIsDeadMessagetargetIsDeadMessageplayerVotedToBootMessageplayerBootedMessage"playerHasAlreadyVotedToBootMessage circleMessagepingPlayerMessagepingRoleMessagecurrentStageMessagesrolesInGameMessageplayersInGameMessagewaitingOnMessageferinaGruntsMessage!fallenAngelJoinedVillagersMessageplayerShotMessageorphanJoinedPackMessages/playerCannotProtectSamePlayerTwiceInARowMessage"scapegoatChoseAllowedVotersMessage'playerMustChooseAtLeastOneTargetMessageplayerCannotChooseJesterMessageplayerSeenMessage villageDrunkJoinedVillageMessagevillageDrunkJoinedPackMessagesplayerMadeLynchVoteMessageplayerLynchedMessagenoPlayerLynchedMessagejesterLynchedMessagescapegoatLynchedMessageplayerHasAlreadyVotedMessageplayerMadeDevourVoteMessageplayerDevouredMessagenoPlayerDevouredMessage(playerCannotDevourAnotherWerewolfMessageplayerCannotChooseSelfMessageplayerPoisonedMessageplayerHasAlreadyHealedMessageplayerHasAlreadyPoisonedMessagearticle concatList conjugateToBe tryPluralmtl_Aue4leSeVkpKLsfHIV51E8Control.Monad.State.Class MonadStatesetPlayerAllegiancegetRandomAllegiance removePlayer findPlayerBy_getAdjacentAlivePlayers getPlayerVote isGameOver isHuntersTurn isOrphansTurnisProtectorsTurnisScapegoatsTurn isSeersTurn isSunriseisVillagesTurnisWerewolvesTurn isWitchsTurnisPlayerHunterisPlayerJesterisPlayerOrphanisPlayerProtectorisPlayerScapegoat isPlayerSeer isPlayerWitchisPlayerWerewolf isPlayerAlive isPlayerDead checkBoots checkStage' lynchVotees devourVotees advanceStage checkEventspingRole pingVillagerspingWerewolvesvalidateCommand