module TTT.Config
( Config(..)
, PlayerType (..)
, configurePlayerTypes
, configureGameState
) where

import TTT.GameState (GameState(..), initialState)

data Config = Config [PlayerType] GameState deriving (Eq, Show)
data PlayerType = Human | Computer deriving (Eq, Show)

configurePlayerTypes:: String -> Maybe [PlayerType]
configurePlayerTypes userInput =
    case userInput of
        "1" -> Just [Human, Computer]
        "2" -> Just [Computer, Human]
        "3" -> Just [Human, Human]
        _   -> Nothing

configureGameState:: String -> Maybe GameState
configureGameState userInput =
    case userInput of
        "1" -> Just (initialState 3)
        "2" -> Just (initialState 4)
        _   -> Nothing
