|
@ -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" |
|
|