úΚU°%’      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLM N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w xyz{|}~€‚ƒ„…†‡ˆ‰ Š ‹ Œ  Ž   ‘ SafewA tile is a letter with a value, or a Blank tile which may have been given a letter. Blank tiles always have the value '0'.`Prints a letter in the style found on a scoresheet. E.g. blank letters are printed in lowercase.ŋisPlayble, applied to a played tile and compared against a tile returns true if a player returned a letter tile on their rack, or if the player played a Blank that has been given a letterSafe ’   ’Safe(Calculates the score of one played word.hThe first list contains squares that are already on the board (and thus are not subject to bonuses).9The second list contains squares that are newly occupied.“ūThe bonus operations that should be applied to the score of a word once it has been calculated. When using to calculate score, double and triple word bonuses should be applied last.”'Base value of a square, without bonuses “•”    “•”Safe$įRemoves played tiles from the player's tile rack, if it was possible for the player to play those tiles in the first place. A player may play a tile on his rack, unless it is a blank, which must first be assigned a letter. –ĨReturns true if the player cannot place any of the given tiles. A player cannot play a Blank tile that they have not given a letter, or a tile not on their rack.—˜™š !"#$–%›œ !"#$%"$# !%—˜™š !"#$–%›œSafe&'&'&'&'Safe+4The position above the given position, if it exists.,4The position below the given position, if it exists.-=The position to the left of the given position, if it exists..>The position to the right of the given position, if it exists./The position of the star square ()*+,-./012 &()*+,-./012 &*+,-.012/() ()*+,-./012Safe4YThe caller has supplied an invalid path to a letter bag file, or the file is not openable59The letter bag file is marformed, so could not be parsed.60The path given to a dictionary file was invalid.7<The dictionary file could not be parsed as it was malformed.8?A letter bag with insufficient tiles was used to create a game.9VThe player has made an illegal tile placement. Tiles placed must form a line of tiles.:dThe tiles the player placed do not connect with any word (applies after the first move on the board);HThe client put the player in the situation to be able to place no tiles.<4The first move on the board does not cover the star.=]The client allowed the player to place tiles on a square that is already occupied with tiles.>?A blank tile must be labeled with a letter before being placed.?UThe tiles the player placed formed one or more words which are not in the dictionary.@WThe caller allowed the client to place tiles on the board which were not in their rack.AZThe caller allowed the player to attempt to exchange when no letters were left in the bag.BQThe caller allowed the player to attempt to exchange tiles that they do not have.C?The caller allowed a move to be made when the game is finished.3456789:;<=>?@ABCDž3456789:;<=>?@ABCD3456789:;<=>?@ABCD3456789:;<=>?@ABCDžNoneEŠCreates a letter bag from a file where each line contains a space delimited letter character, letter value, and letter distribution. A blank letter is represented by a '_'/ character and has a disribution, but no value.@If successful, the letter bag is shuffled before it is returned.FjCreates a letter bag from a list of tiles. The order of the tiles is retained in the resulting letter bag.ŠThis function is effectful as it is necessary to create a stdGen for list to allow it to be shuffled using this generator in the future.GTakes n% numbers from a letter bag, yielding Ÿ5 if there is not enough tiles left in the bag or a  W tuple where the left value is the taken tiles, and the right value is the new bag.HŌExchanges given tiles for the same number of tiles from the bag. The exchanged letters are added to the bag, the bag is then shuffled, and then the same number of tiles as exchanged are drawn from the bag.Returns Ÿa if there are not enough letters in the bag to exchange the given tiles for. Otherwise returns  < with a tuple with the tiles given, and the new letterbag.I…Shuffles the contents of a letter bag. The bag is shuffled using the random generator which was created while constructing the bag.ĸ This function should not be used when creating an additional game with a new letter bag as the same seed value will be shared across games (meaning tiles will come out of the bag in the same order.) When constructing an additional game, use shuffleWithNewGenerator.Jĸ)Creates a letter bag using a list of tiles, and a generator which should be used when shuffling the bag. This function allows a game to be stepped through from the beginning where the moves and original generator were recorded, with any shuffling yielding the same bag as in the original game.Kĸ5Get the letter bag's current generator, which will be used to shuffle the contents of the bag in the next exchange or shuffle. If taken at the start of the game, with the original list of tiles in the bag in order, the game moves may be replayed in order with the original results of any shuffle retained.LŌShuffles a letter bag using a new random generator. This function should be used when spawning a new game using a letter bag with all the tiles remaining so that letter bags are unique between game instances. EĄFGHIJKLĒ  EFGHIJKL  E FJGHIL K EĄFGHIJKLĒ NoneNkReturns the list of words which are not present in the given dictionary from a list of input words. QjCreates a dictionary from a file containing a list of valid words, each word being seperated by a newline. MĢNOPQĪĨĶMNOPQMQPONMĢNOPQĪĨĶ SafeRSRSRSRS Safe TAReturns all the squares on the board, ordered by column then row.UiPlaces a tile on a square and yields the new board, if the target square is empty. Otherwise yields Ÿ.VbReturns the square at a given position if it is not occupied by a tile. Otherwise returns Nothing.W^Returns the square at a given position if it is occupied by a tile. Otherwise returns Nothing.XIAll letters immediately above a given square until a non-occupied square YIAll letters immediately below a given square until a non-occupied square ZKAll letters immediately left of a given square until a non-occupied square [LAll letters immediately right of a given square until a non-occupied square \ZPretty prints a board to a human readable string representation. Helpful for development. ]Creates an empty board. TU§ĻVWXYZ[\Đ]Š RTUVWXYZ[\] R]TUWXYZ[V\TU§ĻVWXYZ[\Đ]ŠNone^Ŧ_`abcdefghijklmnopqrsŽ­ŪŊ°^Ŧ_`abcdefghijklmnopqrsŽŪŊ° ^ Ŧ_`abcdefghijklmnopqrsŽ­ŪŊ° NonetStarts a new game. ąA game has at least 2 players, and 2 optional players (player 3 and 4.) The players should be newly created, as tiles from the letter bag will be distributed to each player.RTakes a letter bag and dictionary, which should be localised to the same language.KYields a tuple with the first player and the initial game state. Returns a ąR if there are not enough tiles in the letter bag to distribute to the players.w0Returns a history of the moves made in the game.tēģuvw^_`abcdefghijklmnotuvw"^_`abcdefghijtwibcdg_`aefklmuhvjnotēģuvwSafe {ŠPretty prints the places a given formed word intersects with letters that were already on the board using brackets. E.g. T(HI)S would denote that the player placed a T and an S4 on to the board, using the already placed word HI to form the new word THIS.|Scores an individual word. iNote: overallscore should be used to obtain the overall score as it takes into account any bingo bonuses.})Calculates the overall score of the play.bIf a player managed to place all 7 of their letters, then they receive a bingo bonus of 50 points.~All the words formed by a play.Returns the word formed by the first move on the board. The word must cover the star tile, and be linear. Any blank tiles must be labeled.€ÞReturns the words formed by the tiles played on the board. A played word must be connected to a tile already on the board (or intersect tiles on the board), and be formed linearly. Any blank tiles must be labeled.~Returns the main word formed by the played tiles. The main word is the linear stretch of tiles formed by the tiles placed.‚GReturns the list of words which were adjacent to the main word formed. ƒZReturns the list of positions mapped to the squares that the player placed their tiles on.…ĻScores the words formed by the tiles placed. The first item in the tuple is the overall score, while the second item is the list of scores for all the words formed.†qReturns true if the player placed all 7 of their letters while forming these words, incurring a + 50 score bonus.‡0Returns the words formed by the play as strings.īĩķxyz·ļđšŧ{|}~€‚ƒ„…†‡ˆž―xyz{|}~€‚ƒ„…†‡ˆzyx~‚ƒ„|}†{ˆ‡…€īĩķxyz·ļđšŧ{|}~€‚ƒ„…†‡ˆž― NoneŠkThe new player (with their updated letter rack and score), new game state, and the words formed by the move‹^The new game state, and the player with their rack before and after the exchange respectively.ŒMThe new game state with the opportunity to play passed on to the next player.ĸThe game has finished. The final game state, and the final words formed (if the game was ended by a player placing their final tiles.) The players before their scores were increased or decreased is also given.Žĸ7Transitiions the game to the next state. If the move places tiles, the player must have the tiles to place and place the tiles legally. If the move exchanges tiles, the bag must not be empty and the player must have the tiles to exchange. A ScrabbleError is returned if these condtions are not the case.øRestores a game from a list of moves. The game must be set up in the way the original game was set up (including the letter bag constructed with the same tiles and random generator, dictionary and the list of players in the original order.)ĸ#If the game is not set up as it was originally, this function will return a scrabble error with the move which was invalid with the given state. For example, if the original players are not ordered in the correct way then the player will not have the required tiles to make the move._Maps each move to a resulting game transition, if the move is legal. Has the same semantics as  but returns a list of ū so that laziness can be maintained, meaning all the game transitions dont have to be buffered before they can be consumed. ‰Š‹ŒŽŋĀÁ‘ÂÃÄÅÆĮ pqrs‰Š‹ŒŽ‘ pqrs‰Š‹ŒŽ‘‰Š‹ŒŽŋĀÁ‘ÂÃÄÅÆĮČ !"#$%&'()*+,-./01234556789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ [ \ ] ^ _ ` ` a b c d e f g h i jklmnopqrstuvwxyz{{|}~ €  ‚ ƒ„…†‡ˆ‰Š‹ŒŽ‘’“” • – — ˜ ™ š › œ žŸ ĄĒ&*ĢĪĨͧĻĐŠŦĐŠŽ­Ū [ Ŋ ° ą ē ģ ī ĩkķ·ļđšĐŧž ― ūŋĀÁ†ÃÄÅÆĮĐŧČ É Ę Ë Ė Í Î Ï Ð ŅŌhaske_9F4WKxhJc750HpLhmf8O17Wordify.Rules.Tile Wordify.Rules.LetterBag.InternalWordify.Rules.SquareWordify.Rules.PlayerWordify.Rules.Pos.InternalWordify.Rules.PosWordify.Rules.ScrabbleErrorWordify.Rules.LetterBagWordify.Rules.DictionaryWordify.Rules.Board.InternalWordify.Rules.BoardWordify.Rules.GameWordify.Rules.MoveWordify.Rules.FormedWordWordify.Rules.Game.InternalTileLetterBlank tileValue tileLetter printLetter isPlayable LetterBagtilesbagSize generatorSquareNormal DoubleLetter TripleLetter DoubleWord TripleWord putTileOn scoreSquaressquareIfOccupiedtileIfOccupied isOccupiedPlayernamerackscore LetterRack makePlayer tilesOnRack increaseScore reduceScore hasEmptyRack tileValues giveTiles removeTilesremovePlayedTilesexchangePosposMinposMaxposAtabovebelowleftrightstarPosxPosyPos gridValue ScrabbleErrorLetterBagFileNotOpenableMalformedLetterBagFileDictionaryFileNotFoundMalformedDictionaryFileNotEnoughLettersInStartingBagMisplacedLetterDoesNotConnectWithWord NoTilesPlacedDoesNotCoverTheStarTilePlacedTileOnOccupiedSquareCannotPlaceBlankWithoutLetterWordsNotInDictionaryPlayerCannotPlace CannotExchangeWhenNoLettersInBagPlayerCannotExchangeGameNotInProgress MiscErrormakeBag bagFromTiles takeLettersexchangeLetters shuffleBagmakeBagUsingGenerator getGeneratorshuffleWithNewGenerator Dictionary invalidWords isValidWorddictionaryFromWordsmakeDictionaryBoard allSquares placeTileunoccupiedSquareAtoccupiedSquareAt lettersAbove lettersBelow lettersLeft lettersRight prettyPrint emptyBoardGameplayer1player2optionalPlayersboardbag dictionary currentPlayer playerNumber moveNumberpasses gameStatushistory GameStatus InProgressFinishedHistoryMove PlaceTilesExchangePassmakeGameplayersnumberOfPlayers movesMade PlacedSquares FormedWord FormedWordsprettyPrintIntersections scoreWord overallScoreallWordswordFormedFirstMovewordsFormedMidGamemainWord adjacentWords playerPlacedplayerPlacedMapwordsWithScoresbingoBonusApplied wordStrings makeStringGameTransitionMoveTransitionExchangeTransitionPassTransition GameFinishedmakeMove restoreGamerestoreGameLazynewGame $fEqLetterBagapplyWordBonus baseValue isWordBonusplayerCanPlaceNameScoreplayerCanExchangetileFrequenciesposMap$fShowScrabbleErrorbaseGHC.BaseNothingJustparseBagStringparseBagreadDictionaryFileparseDictionaryupperCaseWords insertSquaresquareAtwalkFrom $fShowBoard updateGameupdateCurrentPlayer nextPlayerpass updateHistory Data.EitherLeftinitialisePlayersoptionalsToPlayers Direction HorizontalVertical FirstWordmain otherWordsplaced placedSquares wordsFormedEither makeBoardMove exchangeMovepassMoveaddMoveToHistory finaliseGameupdatePlayerRackAndBagnewBoardremoveLettersandGiveScorescoresIfWordsLegal