diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | Untitled.ipynb | 43 | ||||
-rw-r--r-- | index.html | 9 |
4 files changed, 40 insertions, 22 deletions
@@ -1 +1,2 @@ .ipynb_checkpoints +node_modules @@ -1,7 +1,4 @@ -recipes.json from https://github.com/teijo/iba-cocktails. +# well-ordered - -- check lp scores against python -- roseacrucis -- use strict -- greedy + greedyscore +IBA recipe data from https://github.com/teijo/iba-cocktails. +glpk.js from https://github.com/jvail/glpk.js/. diff --git a/Untitled.ipynb b/Untitled.ipynb index 40be1aa..5352cf4 100644 --- a/Untitled.ipynb +++ b/Untitled.ipynb @@ -2,14 +2,14 @@ "cells": [ { "cell_type": "code", - "execution_count": 208, + "execution_count": 212, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "['Dark rum', 'Dry white wine', 'Créme de Menthe', 'Peach bitters', 'Maraschino', 'Galliano', 'Raspberry syrup', 'Campari', 'Tequila', 'Créme de Cassis', 'DOM Bénédictine', 'Lillet Blonde', 'Sweet vermouth', 'Kirsch', 'Cream liqueur', 'Grenadine', 'Cherry liqueur', 'Calvados', 'Bourbon', 'Aperol', 'Créme de Cacao', 'Triple Sec', 'Absinthe', 'DiSaronno', 'Peach schnapps', 'Rye', 'Coffee liqueur', 'Drambuie', 'Strawberry syrup', 'Irish whiskey', \"Peychaud's bitters\", 'Raspberry liqueur', 'Scotch', 'Dry vermouth', 'Peach puree', 'Apricot brandy', 'White rum', 'Pisco', 'Orange flower water', 'Prosecco', 'Orange bitters', 'Cognac', 'Angostura bitters', 'Gin', 'Vodka', 'Orgeat', 'Cachaca', 'Blackberry liqueur', 'Champagne', 'Red Port']\n" + "['Grenadine', 'Bourbon', 'White rum', 'Campari', 'Strawberry syrup', 'Angostura bitters', 'Gin', 'Lime juice', 'Vodka', 'Lillet Blonde', 'Sweet vermouth', 'Dry vermouth', 'Kirsch']\n" ] } ], @@ -34,6 +34,7 @@ " 'Olive juice',\n", " 'Ginger Ale',\n", "]\n", + "skip = []\n", "recipesj = json.load(open('recipes-fix.json'))\n", "ingredients = set()\n", "for recipe in recipesj:\n", @@ -62,10 +63,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 213, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "13" + ] + }, + "execution_count": 213, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "n_ingredients" + ] }, { "cell_type": "code", @@ -83,18 +97,19 @@ }, { "cell_type": "code", - "execution_count": 192, + "execution_count": 214, "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "(50, 50)" - ] - }, - "execution_count": 192, - "metadata": {}, - "output_type": "execute_result" + "ename": "FileNotFoundError", + "evalue": "[Errno 2] No such file or directory: 'sol.2'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m<ipython-input-214-5e2507ee49c6>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mlinesf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'sol.2'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mlines\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlinesf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplitlines\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mlinesf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclose\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0msol\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mseen\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mset\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'sol.2'" + ] } ], "source": [ @@ -64,6 +64,12 @@ form { <body> <div class="container"> <h3>Well-Ordered</h3> + <p> + The bibulous sorcerer Roseacrucis has depleted our distilled reserves. You must journey to obtain the + hallowed ingredients necessary to recreate the seventy-seven official IBA cocktails—but your wallet runs + light, and your thirst grows stronger. In what order do you obtain the ingredients in order to create the + most recipes for the fewest stater? + </p> <noscript>Sorry, JavaScript is required to run Well-Ordered.</noscript> <div id="form"> <form action="/" method="none"> @@ -345,8 +351,7 @@ form { <input id="limit" name="limit" type="number" value="120" min="10"></input> </div> <div> - <button type="submit" id="optimal">Compute optimal (slow)</button> - <button type="button" id="greedy">Compute greedy (fast)</button> + <button type="submit" id="optimal">Compute ordering</button> </div> </form> </div> |