From d323ca2988194c965410a8d16f891352d02eed97 Mon Sep 17 00:00:00 2001 From: kiana-S Date: Tue, 28 Dec 2021 18:17:19 -0500 Subject: [PATCH] Fix various display issues --- GOL/Space.hs | 2 +- Graphics/Display.hs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/GOL/Space.hs b/GOL/Space.hs index 29b20b9..934544a 100644 --- a/GOL/Space.hs +++ b/GOL/Space.hs @@ -51,7 +51,7 @@ instance Distributive ToroidalSpace where instance Representable ToroidalSpace where type Rep ToroidalSpace = (Int, Int) - index (TS s) (i, j) = s ! j ! i + index (TS s) (i, j) = s ! i ! j tabulate f = TS $ V.generate 100 (\x -> V.generate 100 $ \y -> f (x, y)) instance Space ToroidalSpace where diff --git a/Graphics/Display.hs b/Graphics/Display.hs index fa156f8..960f26a 100644 --- a/Graphics/Display.hs +++ b/Graphics/Display.hs @@ -32,4 +32,5 @@ drawGrid :: forall f. DisplayableSpace f => Config -> f Bool -> Picture drawGrid config xs = let (w, h) = windowSize config size = fromIntegral $ if w > h then h `div` sizey @f else w `div` sizex @f - in color (cellColor config) $ pictures $ drawCells xs size \ No newline at end of file + in translate (fromIntegral $ -w `div` 2) (fromIntegral $ -h `div` 2) $ + color (cellColor config) $ pictures $ drawCells xs size \ No newline at end of file