{-# OPTIONS -Wall #-} module PowerPhrases where import Data.Maybe(mapMaybe) import Datatypes.Game (Command(..)) listToCommand :: String -> [Command] listToCommand str = mapMaybe charToCommand str charToCommand :: Char -> Maybe Command charToCommand 'p' = Just MoveW charToCommand '\'' = Just MoveW charToCommand '!' = Just MoveW charToCommand '.' = Just MoveW charToCommand '0' = Just MoveW charToCommand '3' = Just MoveW charToCommand 'b' = Just MoveE charToCommand 'c' = Just MoveE charToCommand 'e' = Just MoveE charToCommand 'f' = Just MoveE charToCommand 'y' = Just MoveE charToCommand '2' = Just MoveE charToCommand 'a' = Just MoveSW charToCommand 'g' = Just MoveSW charToCommand 'h' = Just MoveSW charToCommand 'i' = Just MoveSW charToCommand 'j' = Just MoveSW charToCommand '4' = Just MoveSW charToCommand 'l' = Just MoveSE charToCommand 'm' = Just MoveSE charToCommand 'n' = Just MoveSE charToCommand 'o' = Just MoveSE charToCommand ' ' = Just MoveSE charToCommand '5' = Just MoveSE charToCommand 'd' = Just RotateClockwise charToCommand 'q' = Just RotateClockwise charToCommand 'r' = Just RotateClockwise charToCommand 'v' = Just RotateClockwise charToCommand 'z' = Just RotateClockwise charToCommand '1' = Just RotateClockwise charToCommand 'k' = Just RotateCounterclockwise charToCommand 's' = Just RotateCounterclockwise charToCommand 't' = Just RotateCounterclockwise charToCommand 'u' = Just RotateCounterclockwise charToCommand 'w' = Just RotateCounterclockwise charToCommand 'x' = Just RotateCounterclockwise charToCommand _ = Nothing