-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell front-end for DGS' bot interface -- -- The Dragon Go Server exposes a convenient interface for bots. This -- module provides some functions for accessing that interface to log in -- to the server, retrieve your status page, retrieve the state of any -- games you are playing, and make moves in games. @package dgs @version 0.2 -- | This is a quick and dirty interface to Dragon Go Server's robot -- interface, as outlined at -- http://www.dragongoserver.net/faq.php?read=t&cat=215#Entry219. -- It does almost no sanity-checking of things you send it, nor does it -- do very much error-checking on the things Dragon sends back. Use with -- caution. -- -- Here are some sample interactions from ghci, with a fictitious -- password: -- --
--   *Network.DGS> browseDGS (silence >> login development "smartypants" "password")
--   LoginSuccess
--   *Network.DGS> browseDGS (silence >> statusUID production 4155) >>= mapM_ print
--   (453881,"jedge42",False,"2009-12-21 03:14 GMT","F: 30d 1h")
--   (532927,"bartnix",False,"2009-12-20 06:06 GMT","F: 21d 13h")
--   *Network.DGS> browseDGS (silence >> statusUser production "dmwit") >>= mapM_ print
--   (453881,"jedge42",False,"2009-12-21 03:14 GMT","F: 30d 1h")
--   (532927,"bartnix",False,"2009-12-20 06:06 GMT","F: 21d 13h")
--   *Network.DGS> :{
--   *Network.DGS| browseDGS $ do {
--   *Network.DGS|   silence;
--   *Network.DGS|   login development "smartypants" "password";
--   *Network.DGS|   (_, (gid, _, black, _, _):_) <- status development;
--   *Network.DGS|   move development gid black (16, 18) (17, 16)
--   *Network.DGS|   }
--   *Network.DGS| :}
--   MoveSuccess
--   
module Network.DGS data LoginResult WrongUsername :: LoginResult WrongPassword :: LoginResult -- | it's a bug in the library if one of these ever gets built LoginProblem :: String -> LoginResult LoginSuccess :: LoginResult -- | some commands either require you to be logged in, or will give -- additional information if you log in login :: String -> String -> String -> DGS LoginResult -- | (game ID, username of the opponent, current player is black?, date, -- time remaining) type Game = (Integer, String, Bool, String, String) -- | (message ID, username of the sender, subject, date) type Message = (Integer, String, String, String) -- | get the inbox and games list of whoever is currently logged in; this -- will return ([], []) if you are not logged in status :: String -> DGS ([Message], [Game]) -- | get the games list of an arbitrary user; this will give the same -- results whether or not you are logged in statusUID :: String -> Integer -> DGS [Game] -- | get the games list of an arbitrary user this will give the same -- results whether or not you are logged in statusUser :: String -> String -> DGS [Game] -- | 0-indexed x/y coordinates that start at the top left type Point = (Integer, Integer) data MoveResult NotLoggedIn :: MoveResult NoGameNumber :: MoveResult -- | or a bad game ID DatabaseCorrupted :: MoveResult -- | or you're not playing in the game, or you claimed to be the wrong -- color NotYourTurn :: MoveResult -- | or the previous move didn't match reality MoveAlreadyPlayed :: MoveResult -- | ko, playing on top of another stone, playing off the board IllegalPosition :: MoveResult -- | it's a bug in the library if one of these ever gets built MoveProblem :: String -> MoveResult MoveSuccess :: MoveResult move :: String -> Integer -> Bool -> Point -> Point -> DGS MoveResult -- | you can only get private comments if you are logged in; if you are not -- logged in, this will succeed, but a request for private comments will -- be ignored, and you'll get an SGF with only the public comments sgf :: String -> Integer -> Bool -> DGS String -- | a convenient type synonym for HTTP's browser monad newtype DGS a DGS :: BrowserAction (HandleStream String) a -> DGS a runDGS :: DGS a -> BrowserAction (HandleStream String) a -- | the address of the development server, -- "dragongoserver.sourceforge.net" development :: String -- | the address of the most well-known public server, -- "www.dragongoserver.net" production :: String -- | by default, HTTP's browser chatters a lot on stdout; this action turns -- off the chatter silence :: DGS () browseDGS :: DGS a -> IO a instance Eq MoveResult instance Ord MoveResult instance Show MoveResult instance Read MoveResult instance Eq LoginResult instance Ord LoginResult instance Show LoginResult instance Read LoginResult instance Functor DGS instance Monad DGS instance MonadIO DGS instance MonadIO (BrowserAction conn)