Browse Source

resolved bug on ByteString

adaptedStrategy0
Andrea Bellandi 9 years ago
parent
commit
8bd0993832
2 changed files with 4 additions and 6 deletions
  1. +2
    -3
      src/Main0.hs
  2. +2
    -3
      src/Main1.hs

+ 2
- 3
src/Main0.hs View File

@ -6,7 +6,7 @@ import Data.Aeson
import Data.Aeson.Types import Data.Aeson.Types
import System.Environment import System.Environment
import qualified Data.ByteString.Lazy as BS
import qualified Data.ByteString.Lazy.Char8 as BS
import System.IO import System.IO
import Datatypes import Datatypes
import Opt import Opt
@ -32,10 +32,9 @@ main = do args <- getArgs
commandspoints <- return (map (\(seed,game) -> strat0 game) gmseed) commandspoints <- return (map (\(seed,game) -> strat0 game) gmseed)
(commands,points) <- return $ unzip commandspoints (commands,points) <- return $ unzip commandspoints
seeds <- return ((map (\(seed, _) -> seed)) gmseed) seeds <- return ((map (\(seed, _) -> seed)) gmseed)
putStrLn $ show $ encode $ (packAll id seeds commands)
BS.putStrLn $ encode $ (packAll id seeds commands)
writeFile ("scores") (scoredata id (fst $ unzip gmseed) points) writeFile ("scores") (scoredata id (fst $ unzip gmseed) points)
packAll :: Int -> [Int] -> [[Command]] -> [JSONSer] packAll :: Int -> [Int] -> [[Command]] -> [JSONSer]
packAll id seeds commandLists = zipWith (\x y -> JSONSer id x "lilik0" y) seeds commandStrings packAll id seeds commandLists = zipWith (\x y -> JSONSer id x "lilik0" y) seeds commandStrings
where where


+ 2
- 3
src/Main1.hs View File

@ -6,7 +6,7 @@ import Data.Aeson
import Data.Aeson.Types import Data.Aeson.Types
import System.Environment import System.Environment
import qualified Data.ByteString.Lazy as BS
import qualified Data.ByteString.Lazy.Char8 as BS
import System.IO import System.IO
import Datatypes import Datatypes
import Opt import Opt
@ -32,8 +32,7 @@ main = do args <- getArgs
commandspoints <- return (map (\(seed,game) -> strat1 game) gmseed) commandspoints <- return (map (\(seed,game) -> strat1 game) gmseed)
(commands,points) <- return $ unzip commandspoints (commands,points) <- return $ unzip commandspoints
seeds <- return ((map (\(seed, _) -> seed)) gmseed) seeds <- return ((map (\(seed, _) -> seed)) gmseed)
putStrLn $ show $ encode $ (packAll id seeds commands)
-- print points
BS.putStrLn $ encode $ (packAll id seeds commands)
writeFile ("scores") (scoredata id (fst $ unzip gmseed) points) writeFile ("scores") (scoredata id (fst $ unzip gmseed) points)


Loading…
Cancel
Save