Homework to practice Foldable, Traversable, State Monad Transformer, and Lens
In this homework you will implement some functions to work with maps...
- Data.QuadTree = make
QuadTree
data structure an instance ofFunctor
,Foldable
, andTraversable
(think about delegation) and implement other prepated functions. You can use prepared lenses for data typesQuadTree
andQuadrant
to make your code more readable. Spoiler: the most challenging part isfromMatrix
. - Data.Geography[.Styles] = this module defined
Coords
,Map
, and other related stuff. Few functions are not implemented and are waiting for you to be done. Try to make it as simple as possible. Recall syntactic sugar, point free style, and pattern matching. Again, lenses are ready for you... - MapTraveler = here is the interesting part - the
StateT
, you can rework it or just investigate and use as is. You have to implement 3 normal functions which are used in state manipulation and for the CLI.
When everything is done, you should be able to travel with:
% stack exec traveler
The Map Traveler
╔════════════════════════════════════════╗
║^ @ ~~~~~~ ░░░░░░░░║
║ ▓ ^ ~~~~~~~ ░░░░░░║
║ ^ ▓ ~~~~~~~ ^ ░░░░║
║ ███████ ▓ ^^ ~~~~~~~ ░░░░║
║ █ █ ▓ ~~~~~ ^ ░░░░║
║ ███████ ▓ ^ ~~ ║
║ ^^ ▓▓▓▓▓▓▓▓▓▓▓▓▓ ~~ ║
║ ^ ▓ ~~ ║
║ ^ ^ ▓ ~~ ║
║^^ ^ ^^ ▓ ~~~~ ║
║^^ ^ ░░░ ░░░░ ▓ ~~~ ║
║^^^^ ░░░░░░░░ ▓▓ ~~ ║
╚════════════════════════════════════════╝
What direction do you want to go?
w
╔════════════════════════════════════════╗
║^ @ ~~~~~~ ░░░░░░░░║
║ ▓ ^ ~~~~~~~ ░░░░░░║
║ ^ ▓ ~~~~~~~ ^ ░░░░║
║ ███████ ▓ ^^ ~~~~~~~ ░░░░║
║ █ █ ▓ ~~~~~ ^ ░░░░║
║ ███████ ▓ ^ ~~ ║
║ ^^ ▓▓▓▓▓▓▓▓▓▓▓▓▓ ~~ ║
║ ^ ▓ ~~ ║
║ ^ ^ ▓ ~~ ║
║^^ ^ ^^ ▓ ~~~~ ║
║^^ ^ ░░░ ░░░░ ▓ ~~~ ║
║^^^^ ░░░░░░░░ ▓▓ ~~ ║
╚════════════════════════════════════════╝
What direction do you want to go?
s
╔════════════════════════════════════════╗
║^ ▓ ~~~~~~ ░░░░░░░░║
║ @ ^ ~~~~~~~ ░░░░░░║
║ ^ ▓ ~~~~~~~ ^ ░░░░║
║ ███████ ▓ ^^ ~~~~~~~ ░░░░║
║ █ █ ▓ ~~~~~ ^ ░░░░║
║ ███████ ▓ ^ ~~ ║
║ ^^ ▓▓▓▓▓▓▓▓▓▓▓▓▓ ~~ ║
║ ^ ▓ ~~ ║
║ ^ ^ ▓ ~~ ║
║^^ ^ ^^ ▓ ~~~~ ║
║^^ ^ ░░░ ░░░░ ▓ ~~~ ║
║^^^^ ░░░░░░░░ ▓▓ ~~ ║
╚════════════════════════════════════════╝
What direction do you want to go?
q
Byeee!
You should be able to move with w a s d step by step thru walkable places in the map.
The CLI and some other trivial parts are not tested so you can improve it if you want. Also you can create other maps, options, and so on. You can also build some game on top of this and use some ncurses library.
- Follow DRY principle, use syntactic sugar when you can, make your code clean and understandable.
- If you encounter some trouble, create an issue in your repository.
- In case you find a bug or have an idea how to improve assignment project, create an issue or PR in this repository.
This project is licensed under the MIT License - see the LICENSE file for more details.