RuDv      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~%Response and message data structures.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone5 <A message may be either public or private, indicated by its 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.     FExtra utility functions for working with the interpolate Quasi Quoter.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone8Humanise type class for pretty printing data structures.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comSafe9Simplistic role data structure with lenses and instances.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneThe  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).!:Role definitions require only a few pieces of information.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.35A list containing all the roles defined in this file.4EA list containing roles that are restricted to a single instance per Game.  4 = 3 \\ [D, H] 5YAbandoned 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.6YHah, 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.7]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!cThe Fallen Angel wins if they manage to get lynched by the Villagers before the end of the game.8\In this time of turmoil, it would seem unlikely for the Villagers of Fougres to unanimously \agree on anything. Yet this is not so, for they all agree the village is haunted by a ghost. YThe vindictive Spiteful Ghost never moved on, rather they remain with the sole purpose of Vhaunting the village and ensuring that the Villagers never forget what they have done.The Spiteful ghost is dead and cannot win, however they know the game's role allocations and may haunt the village as they wish.9ZAwareness 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 in the player circle# 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.?]A beautiful flirt, the Medusa is aligned with the Villagers but harbours a terrifying secret. [During the day they are well known in the village of Fougres for their stunning appearance [which captures the eye and love of all the townsfolk. However when their secret takes ahold Wat sundown, their true self is revealed. Any who gaze upon her true form would see live Psnakes for hair and the few that further look into her eyes are turned to stone.If Medusa attracts the attention of a Werewolf during the night and is devoured, the first Werewolf to their left in the player circleS will catch their gaze and turn to stone, instantly killing the lupine predator.@YOriginally rejected by the townsfolk, the Oracle's prophetic divinations has earned trust Xwithin the village. With constant precognition - and concern for the future - the Oracle 7knows the village will only live if they work together.Each night the Oracle chooses a player to divine. They are then informed of the player's role the following morning. This wisdom is for the Oracle to use to ensure the future of Fougres.AXThe 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.BZWerewolves 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.C[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.DXA 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.E\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.F]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 on healing themself.G]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.HWThe 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.. !"()*+,-./0123456789:;<=>?@ABCDEFGH$ !()*+,-0123456789:;<=>?@ABCDEFGH$!-+()*, 0123456789:;<=>?@ABCDEFGH$ !"()*+,-./0123456789:;<=>?@ABCDEFGH0Extra utility functions for working with lenses.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneOTIThe counter-part to J!, but more general as it takes a  instead. I = JA re-write of   to be more general by taking a  instead. J = KCheck to see if this  or 0 matches 1 or more entries in the current state. K =  . LCheck to see if this  or % has no matches in the current state. L =  . MA companion to M that, rather than using a predicate, filters on the given lens for matches.IJKLMIJKLMIJKLMIJKLMrSimplistic player data structure with lenses for searching, filtering and querying lists of players.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone:OT7N"Surprise surprise, players may be P or O.QA player has a W, X and Y2. Any stateful information needed for a player's role is held on the Game itself.-N.B., player equality is defined on just the W.^Creates a new O player, with one exception: a o always starts P._The traversal of Q s with an G. _ = X .  G `The traversal of Q s with a 9. ` = X .  9 aThe traversal of Q s with a :. a = X .  : bThe traversal of Q s with a ;. b = X .  ; cThe traversal of Q s with a 7. c = X .  7 dThe traversal of Q s with a <. d = X .  < eThe traversal of Q s with a =. e = X .  = fThe traversal of Q s with a >. f = X .  > gThe traversal of Q s with a ?. g = X .  ? hThe traversal of Q s with a @. h = X .  @ iThe traversal of Q s with an 5. i = X .  5 jThe traversal of Q s with a A. j = X .  A kThe traversal of Q s with a B. k = X .  B lThe traversal of Q s with a C. l = X .  C mThe traversal of Q s with a D. m = X .  D nThe traversal of Q s with a H. n = X .  H oThe traversal of Q s with a 8. o = X .  8 pThe traversal of Q s with a E. p = X .  E qThe traversal of Q s with a 6. q = X .  6 rThe traversal of Q s with a F. r = X .  F sThe traversal of Qs aligned with . s = X . ( . 0 tThe traversal of Qs aligned with the . t = X . ( . 1 uThe traversal of Qs aligned with the  . u = X . ( . 2 vThis  provides the traversal of Q names. v =  . W wThis  provides the traversal of Q roles. w =  . X xThis  provides the traversal of Q states. x =  . Y yThis  provides the traversal of Qs with the given name. y name' = M . W name' zThis  provides the traversal of _ Qs. z =  .  (I _) {This  provides the traversal of ` Qs. { =  .  (I `) |This  provides the traversal of a Qs. | =  .  (I a) }This  provides the traversal of b Qs. } =  .  (I b) ~This  provides the traversal of c Qs. ~ =  .  (I c) This  provides the traversal of d Qs.  =  .  (I d) This  provides the traversal of e Qs.  =  .  (I e) This  provides the traversal of f Qs.  =  .  (I f) This  provides the traversal of g Qs.  =  .  (I g) This  provides the traversal of h Qs.  =  .  (I h) This  provides the traversal of i Qs.  =  .  (I i) This  provides the traversal of j Qs.  =  .  (I j) This  provides the traversal of k Qs.  =  .  (I k) This  provides the traversal of l Qs.  =  .  (I l) This  provides the traversal of m Qs.  =  .  (I m) This  provides the traversal of n Qs.  =  .  (I n) This  provides the traversal of o Qs.  =  .  (I o) This  provides the traversal of p Qs.  =  .  (I p) This  provides the traversal of q Qs.  =  .  (I q) This  provides the traversal of r Qs.  =  .  (I r) This  provides the traversal of s Qs.  =  .  . (I s) This  provides the traversal of t Qs.  =  .  (I t) This  provides the traversal of u Qs.  =  .  (I u) This  provides the traversal of O Qs.  =  ( $ Y . \) This  provides the traversal of P Qs.  =  ( $ Y . ]) DNOPQWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~>NOPQWXY\]^_`abcdefghijklmnopqrstuvwxyz{|}~>QWXYNOP\]^_`abcdefghijklmnopqrstuvwxyz{|}~>NOPQWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~+Simplistic game data structure with lenses.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNoneOT =Most of these are fairly self-explainable (the turn stages).  and S are provided as meaningful breaks between the day and night as, for example, a ? may not always be available (curse that retched Scapegoat).2Once the game reaches a turn stage, it requires a commandd 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 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 ).Jester, ScapegoatOracle Fallen AngelWitchHunterJesterWitchWitchWitch Protector ProtectorOrphan  Scapegoat Seer Villagers 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 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 .. If the Fallen Angel is in play, then the F is available on the first day rather than only after the first night.Creates a new \ with the given players. No validations are performed here, those are left to the binary.The traversal of the  victim's name. This is the player, if they exist, that received the majority of the votes. This could be an empty list depending on whether the votes were in conflict.  Gets the  victim's name. This is the player, if they exist, that received the majority of the votes. This could be an empty list depending on whether the votes were in conflict.The traversal of s on the first round.The traversal of s on the second round.The traversal of s on the third round. Gets all the ? in a game (which is names only) and maps them to their player. Gets all O players that have yet to vote.Queries whether anyone has won.}Queries whether the Fallen Angel has won. The Fallen Angel wins if they manage to get themselves lynched by the Villagers.Queries whether the  Villagers have won. The  Villagers/ win if they are the only players surviving.FN.B., the Fallen Angel is not considered when determining whether the  Villagers have won.Queries whether the  Werewolves have won. The  Werewolves/ win if they are the only players surviving.a     II:     +Re-exports all of the public modules under  Game.Werewolf.(c) Henry J. Wylde, 2016BSD3public@hjwylde.comNone  !()*,-0123456789:;<=>?@ABCDEFGHNOPQWXY\]^_`abcdefghijklmnopqrstuvwxyz{|}~     !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR STUVWXYZ[\]^4_`abcdefghijklmnopqrstuvwxyz{|}~*Y     &werewolf-1.2.0.3-GMKmIEzU2aeQ28cA1e4nAGame.Werewolf.ResponseData.String.Interpolate.ExtraData.String.HumaniseGame.Werewolf.RoleControl.Lens.ExtraGame.Werewolf.PlayerGame.Werewolf.GameControl.Lens.Prismisn't Game.WerewolfMessagetomessageResponseokmessagessuccessfailureexitWith publicMessageprivateMessage groupMessages$fToJSONMessage$fFromJSONMessage$fToJSONResponse$fFromJSONResponse $fEqMessage$fGenericMessage $fShowMessage $fEqResponse$fGenericResponse$fShowResponseiFileHumanisehumanise $fHumanise[]$fHumaniseText AllegianceNoOne Villagers WerewolvesRole$fHumaniseAllegiance$fEqAllegiance$fReadAllegiance$fShowAllegiance $fReadRole $fShowRole allegiancebalance descriptionnamerulestag$fHumaniseRole$fEqRole_NoOne _Villagers _WerewolvesallRolesrestrictedRoles orphanRolevillageDrunkRolefallenAngelRolespitefulGhostRole beholderRolecrookedSenatorRole druidRole hunterRole jesterRole lycanRole medusaRole oracleRole protectorRole scapegoatRoleseerRolesimpleVillagerRoletrueVillagerRole witchRole alphaWolfRolesimpleWerewolfRoleishasuse hasn'tuse filteredByStateAliveDeadPlayer $fEqState $fReadState $fShowState $fReadPlayer $fShowPlayerrolestate$fHumanisePlayer $fEqPlayer_Alive_Dead newPlayer alphaWolfbeholdercrookedSenatordruid fallenAngelhunterjesterlycanmedusaoracleorphan protector scapegoatseersimpleVillagersimpleWerewolf spitefulGhost trueVillager villageDrunkwitchlonervillagerwerewolfnamesrolesstatesnamed alphaWolves beholderscrookedSenatorsdruids fallenAngelshuntersjesterslycansmedusasoraclesorphans protectors scapegoatsseerssimpleVillagerssimpleWerewolvesspitefulGhosts trueVillagers villageDrunkswitchesloners villagers werewolvesalivedeadStage DruidsTurnGameOver HuntersTurn1 HuntersTurn2Lynching OraclesTurn OrphansTurnProtectorsTurnScapegoatsTurn SeersTurnSunriseSunsetVillageDrunksTurn VillagesTurnWerewolvesTurn WitchsTurnVariantStandardNoRoleKnowledgeGame$fHumaniseStage$fHumaniseVariant $fEqVariant $fReadVariant $fShowVariant $fEqStage $fReadStage $fShowStage$fEqGame $fReadGame $fShowGame allowedVotersbootsdivinefallenAngelLynchedhealUsedhunterRetaliatedjesterRevealedpassedplayerspoison poisonUsed priorProtectprotect roleModelroundscapegoatBlamedseestagevariantvotes _Standard_NoRoleKnowledge _DruidsTurn _GameOver _HuntersTurn1 _HuntersTurn2 _Lynching _OraclesTurn _OrphansTurn_ProtectorsTurn_ScapegoatsTurn _SeersTurn_Sunrise_Sunset_VillageDrunksTurn _VillagesTurn_WerewolvesTurn _WitchsTurn allStages stageCyclestageAvailablenewGamevotee firstRound secondRound thirdRoundgetAllowedVotersgetPendingVoters hasAnyoneWonhasFallenAngelWonhasVillagersWonhasWerewolvesWonbaseGHC.BaseNothingJust_tag_name _allegiance_balance _description_rules lens-4.14-6NeSDfeXgEcBWgmKHkYrH3Control.Lens.GetterGettingControl.Lens.Foldhashasn'tControl.Lens.TypeFold Traversal mtl-2.2.1-6qsR1PHUy5lL47Hpoa4jCMControl.Monad.State.ClassgetsfilteredonlyData.Traversabletraverse_role_state_allowedVoters_divine_fallenAngelLynched _healUsed_hunterRetaliated_jesterRevealed_passed_poison _poisonUsed _priorProtect_protect _roleModel_scapegoatBlamed_see_votesgetVotee_variant_stage_round_players_boots