FP Test3 2024
Jump to navigation
Jump to search
Home Preparation For Test 3 - 2024
Consider following type representing a maze:
type Maze = [String]
If you want to print this maze on a screen you can use:
printMaze :: Maze -> IO ()
printMaze x = putStr (concat (map (++"\n") x))
Maze example:
sample1 :: [String]
sample1 = ["*********",
"* * * *",
"* * * * *",
"* * * * *",
"* * *",
"******* *",
" *",
"*********"]
sample2 :: [String]
sample2 = [" ",
" ",
" *** ",
" *** ",
" *** ",
" ",
" "]
sample3 :: [String]
sample3 = [" * * ",
" ##### ",
" *** ",
" * * ",
" *** ",
" * ",
" "]
ghci> printMaze sample1
*********
* * * *
* * * * *
* * * * *
* * *
******* *
*
*********