GithubHelp home page GithubHelp logo

imgedit's Introduction

imgedit

An implementation of the OnTheMarket code test, by Oliver Mooney

Installation

The project is implemented in Clojure, using Leiningen.

If neither is installed on your machine, install:

  1. A current JVM (via https://java.com/en/download/ or using a commandline package manager).
  2. Leiningen (via the instructions at https://leiningen.org)

Once both are installed, clone the project at the command line with

git clone https://github.com/OliverM/imgedit.git

This will install the source into the imgedit directory.

Usage

In the project directory, type lein run at the command line to launch the interface.

Similarly, to run tests, in the project directory type lein test.

Implementation discussion

I implemented the front-end parser using Instaparse. I hadn't used Instaparse previously and wanted to gain some experience using it. On the whole it went smoothly but there is an overlap between its post-parsing functionality and spec's conform functionality, so in general I didn't use the latter as widely as I might otherwise.

The requirements are implemented in a layered fashion; the parser limits numeric dimensions to positive integers beginning with 1, while the specs for dimension values limit them to 1-250, the image-command spec ensures commands fall within image boundaries, and the fdef generators for the inner implementation commands ensure commands are generated images with compatible boundaries.

Assumptions & Ambiguities

  • The spec stipulates arguments are separated by a single space; for ease of use I've relaxed this to one or more spaces
  • The spec says nothing about communication of parsing errors, so I've stuck to Instaparse's default for this, and leveraged it further by insisting numbers begin with 1 at the parsing level, rather than accepting numbers like "04"
  • The spec doesn't constrain the set of colours beyond single characters, so I'm just using char? as a validation of the parsed value
  • The spec says nothing about the starting state of the program, so I'm initialising it to a default state of a blank 10 x 10 image

imgedit's People

Contributors

oliverm avatar

Watchers

 avatar  avatar

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.