+hashGame (xs, ys) =
+ hash ( toList $ Q.take 2 xs
+ , toList $ Q.take 2 ys
+ -- , Q.length xs
+ -- , Q.length ys
+ )
+
+inCache :: Game -> Cache -> Bool
+inCache game cache = case (M.lookup h cache) of
+ Just games -> game `S.member` games
+ Nothing -> False
+ where h = hashGame game
+
+enCache :: Game -> Cache -> Cache
+enCache game cache = case (M.lookup h cache) of
+ Just games -> M.insert h (S.insert game games) cache
+ Nothing -> M.insert h (S.singleton game) cache
+ where h = hashGame game