Giter Site home page Giter Site logo

mi-afp / hw06 Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 25 KB

Homework to practice Foldable, Traversable, State/Parser, Monad Transformers and Combinators, Arrow, and Lens

License: MIT License

Haskell 100.00%
lenses monad-transformers quadtree geography travel foldable homework traversable

hw06's Introduction

hw06

Homework to practice Foldable, Traversable, State Monad Transformer, and Lens

Task

In this homework you will implement some functions to work with maps...

  1. Data.QuadTree = make QuadTree data structure an instance of Functor, Foldable, and Traversable (think about delegation) and implement other prepated functions. You can use prepared lenses for data types QuadTree and Quadrant to make your code more readable. Spoiler: the most challenging part is fromMatrix.
  2. 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...
  3. 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.

Notes

  • 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.

License

This project is licensed under the MIT License - see the LICENSE file for more details.

hw06's People

Contributors

mareksuchanek avatar shanemat avatar

Watchers

 avatar  avatar  avatar

hw06's Issues

Map box right border is misaligned

In src/MapTraveler.hs:88-89 the right border doesn't align correctly due to using replicate (w-2) instead of replicate w, which is the correct number of to print to cover the map's width since the box is 2 chars wider than the map.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.