This project is my attempt to solve a classical exercise, explained hereinafter, by JavaScript implementation.
The outcome should be data describing exactly one litre of vodka, which is accepted as 40% solution of alcohol in water. To achieve this goal one may use just the following:
- Unlimited actions;
- Unlimited source of water and alcohol;
- Two tanks: 3 and 5 litres.
Since there are no measurement instruments, one may only fill tanks totally and pour water from various sources to another tank or nowhere.
My implementation approach is focused on creating an intellectual system that would solve the exercise by itself and save lazy me from googling out the right algorithm.
- Pure proprietary JavaScript, no external dependencies;
- Abstraction layers are modules;
- Clear, sensible semantics.
Development dependencies exist for testing.
- Format defines output style;
- Automat is charged with setting up experimental environment (?), performing serial execution of methods and checking progress (almost ready);
- Model describes entities (Fluid, Mix, Schnapps and Tank) and protocols (ready);
- View adds some Model and Automat output detailing via toString overriding (ready);
- Etalon implements output standard and estimation;
- Technology implements generating tree of Experiments and processing their output (expected);
- Experiment instances hold a scope, a log and can be cloned to start next technological step.
user@host:/project/folder$ npm install && npm test