
iliali16 wrote:
type Line = [Char] type Board = [Line]
so my question is if this is ok to represent a map. If yes I will try to write the function which makes it 4 x 4 myself. What I jsut need as an answer is Yes or No. Just to let you know is that I am trying to build the Wumpus World
A list of lists of cells is a possible representation for a two-dimensional array, yes. for bigger maps, there may be a performance problem, but for such a small world, it should be fine. You may consider using an array, e.g. with import Data.Array type Board = Array (Int, Int) Char Boards will be indexed by coordinate tuples. Another point: maybe you should use an algebraic data type instead of Char to represent the individual cells? e.g. data Cell = Wumpus | Trap | Gold | Nothing type Board = [[Cell]] Be aware of the Wumpus! Tillmann