{-# LANGUAGE BangPatterns #-}

{-# LANGUAGE OverloadedStrings #-}

import Formatting

import System.Clock

import Formatting.Clock

import Control.Parallel.Strategies

skynet :: Int Int Int

skynet levels children = sky levels 0

where

childnums = [0children-1]

sky 0 position = position

sky lvl position = sum (map (λcn sky (lvl-1) $ position×children + cn) childnums

`using` evalList rpar)

main :: IO ()

main = do

start getTime Monotonic

let !result = skynet 6 10

end getTime Monotonic

fprint ("Result: " % int % " in " % timeSpecs % "\n") result start end