Browse Source

added deepseq dependency, fixes

adaptedStrategy0
Slash 9 years ago
parent
commit
1d849d6fb1
2 changed files with 5 additions and 6 deletions
  1. +1
    -1
      icfp2015.cabal
  2. +4
    -5
      src/Main.hs

+ 1
- 1
icfp2015.cabal View File

@ -60,7 +60,7 @@ executable icfp2015
other-extensions: OverloadedStrings, DeriveGeneric, DeriveDataTypeable other-extensions: OverloadedStrings, DeriveGeneric, DeriveDataTypeable
-- Other library packages from which modules are imported. -- Other library packages from which modules are imported.
build-depends: base >=4.6 && <4.9, hashable >=1.2 && <1.3, containers >=0.5 && <0.6, QuickCheck >=2.7 && <2.9, bytestring >=0.10 && <0.11, aeson >=0.8 && <0.9, pqueue >=1.3 && <1.4, clock, random
build-depends: base >=4.6 && <4.9, hashable >=1.2 && <1.3, containers >=0.5 && <0.6, QuickCheck >=2.7 && <2.9, bytestring >=0.10 && <0.11, aeson >=0.8 && <0.9, pqueue >=1.3 && <1.4, clock, random, deepseq >= 1.3 && <1.4
-- Directories containing source files. -- Directories containing source files.
hs-source-dirs: src hs-source-dirs: src


+ 4
- 5
src/Main.hs View File

@ -80,13 +80,12 @@ main = do args <- getArgs
let (ids,seeds,gamecomputations) = unzip3 loaddata let (ids,seeds,gamecomputations) = unzip3 loaddata
inittime <- secTime inittime <- secTime
results <- iterategc gamecomputations (timestruct timelimit inittime) memlimit results <- iterategc gamecomputations (timestruct timelimit inittime) memlimit
putStrLn "lol"
let (commandswpoints,strat) = unzip results let (commandswpoints,strat) = unzip results
let (commandlists, points) = unzip commandswpoints let (commandlists, points) = unzip commandswpoints
let wordlists = map cmdToString commandlists let wordlists = map cmdToString commandlists
let outJSONstructs = zipWith3 (\x y z -> (JSONSer x y strategyTag z)) ids seeds wordlists let outJSONstructs = zipWith3 (\x y z -> (JSONSer x y strategyTag z)) ids seeds wordlists
BS.putStrLn $ encode outJSONstructs BS.putStrLn $ encode outJSONstructs
writelogfile logf (zip4 ids seeds points strat)
writeLogFile logf (zip4 ids seeds points strat)
where where
timestruct Nothing _ = Nothing timestruct Nothing _ = Nothing
timestruct (Just maxtime) intime = Just (maxtime, intime) timestruct (Just maxtime) intime = Just (maxtime, intime)
@ -143,9 +142,9 @@ secTime :: IO Int64
secTime = do (TimeSpec s _) <- getTime Monotonic secTime = do (TimeSpec s _) <- getTime Monotonic
return s return s
writelogfile :: Bool -> [(Int,Int,Int,Int)] -> IO ()
writelogfile False _ = return ()
writelogfile _ els = writeFile logFileName scoredata
writeLogFile :: Bool -> [(Int,Int,Int,Int)] -> IO ()
writeLogFile False _ = return ()
writeLogFile _ els = writeFile logFileName scoredata
where where
scoredata = foldl strlog "\n" els scoredata = foldl strlog "\n" els
strlog x (a,b,c,d) = sa ++ sb ++ sc ++ sd ++ x ++ "\n" strlog x (a,b,c,d) = sa ++ sb ++ sc ++ sd ++ x ++ "\n"


Loading…
Cancel
Save