Browse Source

Text.JSON.Generic deleted Main1

adaptedStrategy0
Andrea Bellandi 9 years ago
parent
commit
e7bf68251a
1 changed files with 11 additions and 5 deletions
  1. +11
    -5
      src/Main1.hs

+ 11
- 5
src/Main1.hs View File

@ -1,10 +1,13 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
module Main where
import GHC.Generics
import Data.Aeson
import Data.Aeson.Types
import System.Environment
import qualified Data.ByteString.Lazy as BS
import System.IO
import Text.JSON.Generic
import System.IO
import Datatypes
import Opt
import JSONDeser
@ -15,7 +18,10 @@ data JSONSer = JSONSer { problemId :: Int,
seed :: Int,
tag :: String,
solution :: String
} deriving (Show, Data, Typeable)
} deriving (Show, Generic)
instance FromJSON JSONSer
instance ToJSON JSONSer
main :: IO ()
main = do args <- getArgs
@ -26,7 +32,7 @@ main = do args <- getArgs
commandspoints <- return (map (\(seed,game) -> strat1 game) gmseed)
(commands,points) <- return $ unzip commandspoints
seeds <- return ((map (\(seed, _) -> seed)) gmseed)
putStrLn . encodeJSON $ (packAll id seeds commands)
putStrLn $ show $ encode $ (packAll id seeds commands)
-- print points
writeFile ("scores") (scoredata id (fst $ unzip gmseed) points)


Loading…
Cancel
Save