2013-01-28 11:08:08 +04:00
|
|
|
{-# LANGUAGE BangPatterns #-}
|
|
|
|
module BenchNoDiffOpt where
|
|
|
|
|
|
|
|
{-# LANGUAGE BangPatterns #-}
|
|
|
|
import Graphics.Vty
|
2013-05-11 10:23:41 +04:00
|
|
|
import Verify
|
2013-01-28 11:08:08 +04:00
|
|
|
|
|
|
|
import Control.Concurrent( threadDelay )
|
|
|
|
import Control.Monad( liftM2 )
|
|
|
|
|
|
|
|
import qualified Data.ByteString.Char8 as B
|
|
|
|
import Data.List
|
|
|
|
|
|
|
|
import System.Environment( getArgs )
|
|
|
|
import System.IO
|
|
|
|
import System.Random
|
|
|
|
|
2017-01-22 09:21:58 +03:00
|
|
|
bench0 = do
|
2014-04-12 04:51:13 +04:00
|
|
|
let fixedGen = mkStdGen 0
|
|
|
|
setStdGen fixedGen
|
2017-01-24 22:46:14 +03:00
|
|
|
vty <- mkVty defaultConfig
|
2014-04-12 04:51:13 +04:00
|
|
|
(w,h) <- displayBounds $ outputIface vty
|
|
|
|
let images = return $ (image0, image1)
|
|
|
|
image0 = charFill defAttr 'X' w h
|
|
|
|
image1 = charFill defAttr '0' w h
|
2013-05-11 10:23:41 +04:00
|
|
|
bench d = do
|
2014-04-12 04:51:13 +04:00
|
|
|
flipOut vty 300 image0 image1
|
2013-05-11 10:23:41 +04:00
|
|
|
shutdown vty
|
|
|
|
return $ Bench images bench
|
2013-01-28 11:08:08 +04:00
|
|
|
|
2017-01-22 09:21:58 +03:00
|
|
|
flipOut vty n image0 image1 =
|
2014-04-12 04:51:13 +04:00
|
|
|
let !pLeft = picForImage image0
|
|
|
|
!pRight = picForImage image1
|
|
|
|
wLeft 0 = return ()
|
|
|
|
wLeft n = update vty pLeft >> wRight (n-1)
|
|
|
|
wRight 0 = return ()
|
|
|
|
wRight n = update vty pRight >> wLeft (n-1)
|
|
|
|
in wLeft n
|