From 6c4e63f085d70acf8ac2679d3bd26d87f19b35db Mon Sep 17 00:00:00 2001 From: Jonas Betzendahl Date: Tue, 29 Apr 2014 00:18:38 +0200 Subject: [PATCH] cosmetics --- Pioneers.cabal | 2 +- src/Map/Combinators.hs | 2 +- src/Map/Creation.hs | 12 +----------- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Pioneers.cabal b/Pioneers.cabal index de59517..ec1f70a 100644 --- a/Pioneers.cabal +++ b/Pioneers.cabal @@ -51,7 +51,7 @@ executable Pioneers attoparsec-binary >= 0.1 Default-Language: Haskell2010 -test-suite QuickCheckTests +test-suite MapTests type: exitcode-stdio-1.0 hs-source-dirs: tests/Map, src main-is: MapTestSuite.hs diff --git a/src/Map/Combinators.hs b/src/Map/Combinators.hs index 9dabb89..7837fac 100644 --- a/src/Map/Combinators.hs +++ b/src/Map/Combinators.hs @@ -31,7 +31,7 @@ gaussMountain :: Int -> PlayMap -> PlayMap gaussMountain seed mp = aplByPlace (liftUp c) (\(_,_) -> True) mp where g = mkStdGen seed - c = head $ randomRs (bounds mp) g + c = let ((a,b), (x,y)) = bounds mp in (head (randomRs (a,x) g), (head (randomRs (b,y) g))) amp = head $ randomRs (5.0, 20.0) g sig = head $ randomRs (5.0, 25.0) g fi = fromIntegral diff --git a/src/Map/Creation.hs b/src/Map/Creation.hs index da0a12b..b5d4ec3 100644 --- a/src/Map/Creation.hs +++ b/src/Map/Creation.hs @@ -2,19 +2,9 @@ module Map.Creation where import Map.Types -import Map.Map +-- import Map.Map unused (for now) import Data.Array -import System.Random - --- Orphan instance since this isn't where either Random nor Tuples are defined -instance (Random x, Random y) => Random (x, y) where - randomR ((x1, y1), (x2, y2)) gen1 = let (a, gen2) = randomR (x1, x2) gen1 - (b, gen3) = randomR (y1, y2) gen2 - in ((a, b), gen3) - - random gen1 = let (a, gen2) = random gen1 - (b, gen3) = random gen2 in ((a,b), gen3) -- | Generate a new Map of given Type and Size --