An open API service indexing awesome lists of open source software.

https://github.com/tim-w-james/shape-drawer

Program that allows users to draw shapes, built with Haskell
https://github.com/tim-w-james/shape-drawer

haskell

Last synced: 4 months ago
JSON representation

Program that allows users to draw shapes, built with Haskell

Awesome Lists containing this project

README

          



Shape Drawer


Program that allows users to draw shapes, built with Haskell


This project was created during my university studies at ANU in 2019 and has been transferred from the ANU GitLab server.


Read the technical report »



Table of Contents



  1. About The Project



  2. Usage


  3. Contact

  4. Acknowledgements

## About The Project

Using the functional programming language [Haskell](https://www.haskell.org/platform/) I created a program that draws shapes (line, polygon, rectangle, circle and ellipse).
Find the core algorithm in [src/view.hs](https://github.com/Tim-W-James/Shape-Drawer/blob/master/src/view.hs).
To find out how the algorithm has been implemented, read the [report](https://github.com/Tim-W-James/Shape-Drawer/blob/master/report.pdf).

### Built With

* [Haskell Functional Programming Language](https://www.haskell.org/platform/)
* [CodeWorld API](https://hackage.haskell.org/package/codeworld-api/docs/CodeWorld.html)

## Usage

### Prerequisites

* To run requires the Global Haskell Compiler and Cabal: https://www.haskell.org/platform/
* To develop use [IntelliJ IDEA](https://www.jetbrains.com/idea/)

### Installation

1. Clone the repo
```sh
git clone https://github.com/Tim-W-James/Sushi-Go-AI.git
```
2. Navigate into the root directory and run
```sh
cabal build
cabal run shapes
```
3. Follow the local host link to a browser

### How to use
Available shapes:
* line
* polygon
* rectangle
* circle
* ellipse

| Action | Effect |
|----------------------------|-----------------------------------------------------------------------------------|
| `Esc` (key) | Clear the canvas |
| `M` (key) | Display a mystery image |
| `C` (key) | Cycle colour (of shape to draw) |
| `T` (key) | Cycle tool (type of shape to draw) |
| `Backspace`/`Delete` (key) | Remove the last added shape |
| `D` (key) | Print the current `Model` to the terminal (useful for testing) |
| Click-drag-release (mouse) | When not drawing polygons, draw a shape between the click-point and release-point |
| Click (mouse) | When drawing polygons, add a point to the polygon |
| `Spacebar` (key) | Finish drawing a polygon, adding it to the canvas. |

## Contact

Email: [tim.jameswork9800@gmail.com](mailto:tim.jameswork9800@gmail.com "tim.jameswork9800@gmail.com")

Project Link: [https://github.com/Tim-W-James/Shape-Drawer](https://github.com/Tim-W-James/Shape-Drawer)

## Acknowledgements

* Australian National University for project skeleton and CodeWorld API implementation

[release-shield]: https://img.shields.io/github/v/release/Tim-W-James/repo_name.svg?include_prereleases&style=for-the-badge
[release-url]: https://github.com/Tim-W-James/repo_name/releases
[last-commit-shield]: https://img.shields.io/github/last-commit/Tim-W-James/repo_name.svg?style=for-the-badge
[last-commit-url]: https://github.com/Tim-W-James/repo_name/commits/main
[contributors-shield]: https://img.shields.io/github/contributors/Tim-W-James/repo_name.svg?style=for-the-badge
[contributors-url]: https://github.com/Tim-W-James/repo_name/graphs/contributors
[contributors-shield]: https://img.shields.io/github/contributors/Tim-W-James/repo_name.svg?style=for-the-badge
[contributors-url]: https://github.com/Tim-W-James/repo_name/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/Tim-W-James/repo_name.svg?style=for-the-badge
[forks-url]: https://github.com/Tim-W-James/repo_name/network/members
[stars-shield]: https://img.shields.io/github/stars/Tim-W-James/repo_name.svg?style=for-the-badge
[stars-url]: https://github.com/Tim-W-James/repo_name/stargazers
[issues-shield]: https://img.shields.io/github/issues/Tim-W-James/repo_name.svg?style=for-the-badge
[issues-url]: https://github.com/Tim-W-James/repo_name/issues
[license-shield]: https://img.shields.io/github/license/Tim-W-James/repo_name?style=for-the-badge
[license-url]: https://github.com/Tim-W-James/repo_name/blob/main/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://linkedin.com/in/timothy-william-james/
[product-screenshot]: screenshot.png