wizard-wipeout/src-client/Main.hs
2023-12-11 10:48:25 +01:00

34 lines
901 B
Haskell

{-# LANGUAGE LambdaCase #-}
module Main where
import Control.Concurrent (threadDelay)
import Options.Applicative
-- internal imports
import Client.Communication
import Client.Types
import Library.Types
main :: IO ()
main = do
putStrLn "Hello, Arena!"
(Options socketLocation) <- execParser opts
putStrLn $ "connecting to Socket " <> socketLocation
sock <- connectSocket socketLocation
putStrLn "connected"
sendMessage (IdRequest) sock
threadDelay $ 5 * 10 ^ 6
clientId <- receiveMessage sock
putStrLn $ "received client UUID: " <> show (acClientUUID clientId)
threadDelay $ 5 * 10 ^ 6
putStrLn "sending quit message"
sendMessage (ClientMessage (acClientUUID clientId) ClientQuit) sock
where
opts = info (options <**> helper)
( fullDesc
<> progDesc "Run the \"wizard-wipeout\" Server."
<> header "wizard-wipeout - Last Mage standing"
)