Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a problem with my homework. I need to do maze with 2 parametres. First parameter is list of strings which represent the maze by lines gradually from top to bottom. ('*' - wall, ' ' - field, 's' - starting position). At the beginning we are in position 's'.The second argument is a list of directions of movement ('d' - down, 'u' - up, 'l' - left, 'r' - right). Each letter means that we move one cell in that direction and to the new position we put character '.'
maze :: Result -> String -> Result 

sampleInput =
 ["*********",
  "*s*   * *",
  "* * * * *",
  "* * * * *",
  "*   *   *",
  "******* *",
  "        *",
  "*********"]

I really dont know what to do. Nothing works.
I will be grateful for any help.

At the end after doing all the steps I must print actual situation.

What I have tried:

The result should looked like this:
```
Prelude>pp(maze sampleInput "dddrruuurrdddrrddllllll")
*********
*s*...* *
*.*.*.* *
*.*.*.* *
*...*...*
*******.*
 .......*
*********
```
Posted
Updated 4-Nov-19 9:48am
v2

1 solution

See Haskell tutorial here: Haskell Tutorial - Tutorialspoint[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900