Skip to content

Instantly share code, notes, and snippets.

@joshcough
Last active February 6, 2016 22:51
Show Gist options
  • Save joshcough/ed7443d6d1f339e61e95 to your computer and use it in GitHub Desktop.
Save joshcough/ed7443d6d1f339e61e95 to your computer and use it in GitHub Desktop.
*ghci> g
Game {, [Josh rack: HXDOTQI score: 0id: 0] :| [[Nick rack: KGAITTE score: 0id: 1]], ______________________________________________
|3W| | |2L| | | |3W| | | |2L| | |3W|
| |2W| | | |3L| | | |3L| | | |2W| |
| | |2W| | | |2L| |2L| | | |2W| | |
|2L| | |2W| | | |2L| | | |2W| | |2L|
| | | | |2W| | | | | |2W| | | | |
| |3L| | | |3L| | | |3L| | | |3L| |
| | |2L| | | |2L| |2L| | | |2L| | |
|3W| | |2L| | | | *| | | |2L| | |3W|
| | |2L| | | |2L| |2L| | | |2L| | |
| |3L| | | |3L| | | |3L| | | |3L| |
| | | | |2W| | | | | |2W| | | | |
|2L| | |2W| | | |2L| | | |2W| | |2L|
| | |2W| | | |2L| |2L| | | |2W| | |
| |2W| | | |3L| | | |3L| | | |2W| |
|3W| | |2L| | | |3W| | | |2L| | |3W|
----------------------------------------------
, Bag {bagTiles = [A,N,_,U,U,A,C,T,S,A,E,Z,N,G,A,R,E,D,T,B,L,L,O,N,R,I,Y,A,E,A,M,O,A,S,I,O,F,N,E,O,M,S,F,P,W,I,I,N,D,V,V,I,B,U,H,L,_,R,R,E,I,L,P,J,A,G,S,R,R,U,O,W,E,Y,E,D,N,E,I,E,C,O,E,O,E,T]}, nr turns:0, }
it :: Game
*ghci> let g' = applyWord "DOT" Vertical (7,7) [] g
g' :: Either String Game
*ghci>
*ghci>
*ghci>
*ghci> encode g
"{\"gameBoard\":[],\"gameBag\":\"AN_UUACTSAEZNGAREDTBLLONRIYAEAMOASIOFNEOMSFPWIINDVVIBUHL_RREILPJAGSRRUOWEYEDNEIECOEOET\",\"gameTurns\":[],\"gamePlayers\":[{\"playerName\":\"Josh\",\"playerRack\":\"HXDOTQI\",\"playerType\":\"Human\",\"playerScore\":0,\"playerId\":0},{\"playerName\":\"Nick\",\"playerRack\":\"KGAITTE\",\"playerType\":\"Human\",\"playerScore\":0,\"playerId\":1}]}"
it :: Data.ByteString.Lazy.Internal.ByteString
*ghci> encode g'
"{\"Right\":{\"gameBoard\":[[[7,7],\"D\"],[[7,8],\"O\"],[[7,9],\"T\"]],\"gameBag\":\"UUACTSAEZNGAREDTBLLONRIYAEAMOASIOFNEOMSFPWIINDVVIBUHL_RREILPJAGSRRUOWEYEDNEIECOEOET\",\"gameTurns\":[{\"rackRemainder\":\"HXQI\",\"points\":8,\"tilesPlayed\":{\"wordPutTiles\":[[[7,7],\"D\",2],[[7,8],\"O\",1],[[7,9],\"T\",1]]},\"tilesTakenFromBag\":\"AN_\",\"playerId\":0}],\"gamePlayers\":[{\"playerName\":\"Nick\",\"playerRack\":\"KGAITTE\",\"playerType\":\"Human\",\"playerScore\":0,\"playerId\":1},{\"playerName\":\"Josh\",\"playerRack\":\"HXQIAN_\",\"playerType\":\"Human\",\"playerScore\":8,\"playerId\":0}]}}"
it :: Data.ByteString.Lazy.Internal.ByteString
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment