Skip to content
Snippets Groups Projects
Commit 862e37b2 authored by ik1g19's avatar ik1g19
Browse files

fixed addToGrid

parent 54291f1b
No related branches found
No related tags found
No related merge requests found
......@@ -166,9 +166,11 @@ insertString rg s gen | elemAt rg (x,y) /= Rand &&
((x,y),newGen) = generatePos gen (length rg)
vDirs = validDirs rg s (x,y)
addToGrid :: Orientation -> String -> (Int,Int) -> RandGrid
addToGrid dir (c:cs) (x',y') = addToGrid dir cs charAdded (nextPos dir (x',y'))
addToGrid :: Orientation -> String -> RandGrid -> (Int,Int) -> RandGrid
addToGrid dir (c:[]) rg (x',y') = insertAt2D (Letter c) (x',y') rg
addToGrid dir (c:cs) rg (x',y') = addToGrid dir cs charAdded (nextPos dir (x',y'))
where
charAdded :: RandGrid
charAdded = insertAt2D (Letter c) (x',y') rg
--addToGrid dir = map (\(c,(m,n)) -> insertAt2D (Letter c) (m,n) rg) (zip s (take (length s) $ iterate (nextPos dir) (x,y)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment