Skip to content

Instantly share code, notes, and snippets.

@ubergeek42
Created March 18, 2011 03:49
Show Gist options
  • Save ubergeek42/875593 to your computer and use it in GitHub Desktop.
Save ubergeek42/875593 to your computer and use it in GitHub Desktop.
endo1
{-
- 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