diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2013-04-02 01:57:09 -0400 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2013-04-02 01:57:09 -0400 |
| commit | 94fc90c32fb9d6694a95a9c191553aa39eabd10a (patch) | |
| tree | efafaeee96cba98f76353e18f59f0cb045fc6d70 /Fallen/Point.hs | |
| parent | 8cb868224840c734f38e9041aa1567cdecd17797 (diff) | |
| download | fallen-hs-94fc90c32fb9d6694a95a9c191553aa39eabd10a.tar.gz fallen-hs-94fc90c32fb9d6694a95a9c191553aa39eabd10a.tar.bz2 fallen-hs-94fc90c32fb9d6694a95a9c191553aa39eabd10a.zip | |
Got rid of pure functional randomness and started using IO monad
Diffstat (limited to 'Fallen/Point.hs')
| -rw-r--r-- | Fallen/Point.hs | 8 |
1 files changed, 4 insertions, 4 deletions
| diff --git a/Fallen/Point.hs b/Fallen/Point.hs index 321f3b0..0dec4bc 100644 --- a/Fallen/Point.hs +++ b/Fallen/Point.hs | |||
| @@ -34,10 +34,10 @@ module Fallen.Point | |||
| 34 | West -> East | 34 | West -> East |
| 35 | 35 | ||
| 36 | -- randomPoint :: Int -> Int -> Int -> Int -> IO Point | 36 | -- randomPoint :: Int -> Int -> Int -> Int -> IO Point |
| 37 | randomPoint minX minY maxX maxY rg = do | 37 | randomPoint minX minY maxX maxY = do |
| 38 | let (x,rg1) = randomR (minX, maxX) rg :: (Int,StdGen) | 38 | x <- randomRIO (minX, maxX) |
| 39 | let (y,rg2) = randomR (minY, maxY) rg1 :: (Int,StdGen) | 39 | y <- randomRIO (minY, maxY) |
| 40 | ((x,y),rg2) | 40 | return (x,y) |
| 41 | 41 | ||
| 42 | -- dirToPoint :: Point -> Point -> [Direction] | 42 | -- dirToPoint :: Point -> Point -> [Direction] |
| 43 | dirToPoint p1 p2 = horizDirToPoint p1 p2 ++ vertDirToPoint p1 p2 where | 43 | dirToPoint p1 p2 = horizDirToPoint p1 p2 ++ vertDirToPoint p1 p2 where |
