Open evincarofautumn opened 7 years ago
How about parsing a video game map (I'm thinking a text-based game like Zork)?
Example, parsing a "house":
[Front yard]
|
|
[office]--------[living room]----[kitchen]
|
|
[bedroom]----[bathroom]
I'm currently writing my own 2D parser in Go (not published to GitHub yet) so I find this project interesting, especially since it's written in Haskell (which is truthfully somewhat beyond me haha).
How about parsing a video game map
@PappasBrent: That’s a nice idea!
I think that, in general, an interesting test case is one that is not only 2D, but also encodes some structure in the spatial relationships between things. I had thought that a map wouldn’t be an interesting example, because I was only thinking of map “tiles”, like this:
front yard
office living room kitchen
bedroom bathroom
This could be just an array or CSV. But your example also uses space to describe connections between rooms, whereas mine would need additional data.
So a few other things come to mind:
written in Haskell (which is truthfully somewhat beyond me haha)
If you have any questions about the code, I’d be happy to help or give a brief overview. (It’s an incentive to write some docs as a side effect.)
A simple ASCII table extractor:
A Funciton interpreter:
2D ASCII math notation, extending the existing math notation test: