diff options
author | Jed Barber <jjbarber@y7mail.com> | 2014-07-23 08:25:26 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2014-07-23 08:25:26 +1000 |
commit | ec0b71b4cf39d530cbadce01ad30236d85930527 (patch) | |
tree | 444c18fca5f6abb7cbd1081ef73e296f876e3028 /src/Grasp | |
parent | f2d0c1bed695fbe6c6ff9af1d5f06795f73df391 (diff) |
Fixed list item selection bug
Diffstat (limited to 'src/Grasp')
-rw-r--r-- | src/Grasp/Interpreter.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Grasp/Interpreter.hs b/src/Grasp/Interpreter.hs index 3e822ac..ad9215a 100644 --- a/src/Grasp/Interpreter.hs +++ b/src/Grasp/Interpreter.hs @@ -131,7 +131,7 @@ targetLNodes g = map (\(_,x,_) -> (x, fromJust (Graph.lab g x)) ) updateIP :: IP -> [LNode String] -> IO IP updateIP _ [] = return [] updateIP ip next = - getStdRandom (randomR (0,length next)) >>= + getStdRandom (randomR (0,length next - 1)) >>= (\x -> return ((next !! x):(tail ip)) ) @@ -146,7 +146,7 @@ setI g ip = do g' <- case inL of [] -> return g - _ -> (getStdRandom (randomR (0,length inL))) >>= + _ -> (getStdRandom (randomR (0,length inL - 1))) >>= (\x -> return (foldl' (\gr n -> reLabel gr n (inL !! x)) g outN) ) ip' <- updateIP ip nextLN @@ -343,7 +343,7 @@ putcI g ip = do fhL = targetLabels g (getByLabel "fh" edges) nextLN = targetLNodes g (getByLabel "next" edges) - r <- getStdRandom (randomR (0, length inL)) + r <- getStdRandom (randomR (0, length inL - 1)) c <- case inL of x | length x == 0 -> |