|
|
@ -107,8 +107,8 @@ readFiles (x:xs) = do f <- BS.readFile x |
|
|
|
|
|
|
|
iterategc :: [GameComputation] -> Maybe (Int,Int64) -> Maybe Int -> IO [(([Command], Int), Int)] |
|
|
|
iterategc gcs tlimit mlimit = do rtl <- timeLimit tlimit |
|
|
|
rml <- memLimit mlimit |
|
|
|
(gcresult rtl rml) |
|
|
|
rml <- memLimit mlimit |
|
|
|
(gcresult rtl rml) |
|
|
|
where |
|
|
|
gcresult True _ = return best |
|
|
|
gcresult _ True = return best |
|
|
@ -116,9 +116,9 @@ iterategc gcs tlimit mlimit = do rtl <- timeLimit tlimit |
|
|
|
then return best |
|
|
|
else iterategc (applyNtimes gccompperstep itf gcs) tlimit mlimit |
|
|
|
where |
|
|
|
itf gcs1 = map (\x -> advanceGameComputation x) gcs1 |
|
|
|
applyNtimes 1 f x = f x |
|
|
|
applyNtimes n f x = f (applyNtimes (n-1) f x) |
|
|
|
itf gcs1 = map advanceGameComputation gcs1 |
|
|
|
applyNtimes 0 _ accum = accum |
|
|
|
applyNtimes n f accum = applyNtimes (n - 1) f (f accum) |
|
|
|
best = map getBestGameComputation gcs |
|
|
|
|
|
|
|
timeLimit :: Maybe (Int,Int64) -> IO Bool |
|
|
|