Giter VIP home page Giter VIP logo

live-free-or-die-jugging's Introduction

Live Free Or Die Jugging: A Water Jug Riddle Solver

Description

This application solves the Die Hard Water Jug Problem but goes one step beyond and solves the more general problem:

Given an X gallons jug, Y gallons jug, and Z measurement goal (all integers), measure either on either jug Z gallons of water.

Running wjug

wjug is an interactive binary, it expects the user to provide X, Y and Z and generates a "friendly" output indicating the result of the water jug simulation

Sample Run

Welcome to Water Jugs Riddle Solver!

The problem statement is:
There is have an X-gallon and a Y-gallon jug that you can fill from a lake. 
Measure Z gallons of water using only an X-gallon and Y-gallon jug.

Insert the value for the "x" jug, remember it must be positive: 5
Insert the value for the "y" jug, remember it must be positive: 4
Insert the value for the "z" goal, it must be smaller than either "x" or "y": 3
Fill Y 
(0/5, 4/4) 
Transfer to X 
(4/5, 0/4) 
Fill Y 
(4/5, 4/4) 
Transfer to X 
(5/5, 3/4) 

Parameters

Usage of ./wjug:
  -s    silences most output so only the solution is printed

Build

The built should be compatible with Mac, Linux and Windows architectures. If you can't find the binary in releases you can build your own.

Dependencies

go build ./cmd/wjug/...

Dockerfile

If for any reason you'd rather run the program within a docker container, there are no images uploaded but you can build your own.

docker build -t wjug . 
docker run -it wjug

live-free-or-die-jugging's People

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.