Created
March 18, 2011 03:49
-
-
Save ubergeek42/875593 to your computer and use it in GitHub Desktop.
endo1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
- Author: Keith Johnson, kjohns07@my.fit.edu | |
- Course: CSE5400, Spring 2011 | |
- Project: endo1 | |
-} | |
module Main where | |
import Text.Printf | |
main :: IO() | |
main = Prelude.interact(parseInput) | |
parseInput :: String->String | |
parseInput "" = "" | |
parseInput x = '\n':(trans (take 7 x))++ parseInput (drop 7 x) | |
trans :: String->String | |
trans "PIPIIIC" = "black" | |
trans "PIPIIIP" = "red" | |
trans "PIPIICC" = "green" | |
trans "PIPIICF" = "yellow" | |
trans "PIPIICP" = "blue" | |
trans "PIPIIFC" = "magenta" | |
trans "PIPIIFF" = "cyan" | |
trans "PIPIIPC" = "white" | |
trans "PIPIIPF" = "trans" | |
trans "PIPIIPP" = "opaque" | |
trans "PIIPICP" = "empty" | |
trans "PIIIIIP" = "move" | |
trans "PCCCCCP" = "ccw" | |
trans "PFFFFFP" = "cw" | |
trans "PCCIFFP" = "mark" | |
trans "PFFICCP" = "line" | |
trans "PIIPIIP" = "fill" | |
trans "PCCPFFP" = "add" | |
trans "PFFPCCP" = "compose" | |
trans "PFFICCF" = "clip" | |
trans x | |
| length x /= 7 = "SHORT" | |
| otherwise = "UNKNOWN" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment