Code Monkey home page Code Monkey logo

paintshop's Introduction

paintshop - naive functional solution

A simple test project to explore maximum of Java 8 functional features

Usage

First variant:

$ echo -e "5\n1 G 2 G\n1 M 3 M" | java -jar target/paintshop-root-<version>.jar -stdin [-v]

Different variant:

java -jar target/paintshop-root-<version>.jar <path to file> [-v]

How to build

Run

mvn clean verify

That will compile, test, gather code coverage and shade classes into 1 executable jar file that can be used to run via java -jar command

Code coverage

Will be here

Problem Definition

You want to mix the colors, so that:

  • There is just one batch for each color, and it's either gloss or matte.
  • For each customer, there is at least one color they like.
  • You make as few mattes as possible (because they are more expensive).

The solution to paintshop problem is following (this one uses depth-first search):

  1. Consider that we generate bounded stream of potential solutions, that will record a singular combination of colours, per variant of customer's preference.
  2. A resulting solution will have a seen-by of users, correct solution have to satisfy all users.
  3. A generator will emit solutions in price increasing order (it will use up all possible combinations of GLOSS paints, and then mattes).
  4. A correct cheapest solution will see all users satisfied in it and being first generated.
  5. Solution will not exist when all possible combinations of paints have been exhausted.

paintshop's People

Contributors

iggyzap avatar

Watchers

 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.