--- /dev/null
+<!DOCTYPE html>
+<!-- saved from url=(0030)http://adventofcode.com/day/15 -->
+<html lang="en-us"><script async="" src="http://www.google-analytics.com/analytics.js"></script><script type="text/javascript">window["_gaUserPrefs"] = { ioo : function() { return true; } }</script><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta charset="utf-8">
+<title>Day 15 - Advent of Code</title>
+<!--[if lt IE 9]><script src="/static/html5.js"></script><![endif]-->
+<link href="./advent-of-code-15_files/css" rel="stylesheet" type="text/css">
+<link rel="stylesheet" type="text/css" href="./advent-of-code-15_files/style.css">
+<link rel="shortcut icon" href="http://adventofcode.com/favicon.ico?2">
+<style type="text/css">:root .adsbygoogle
+{display:none !important;}</style><style type="text/css"></style><style id="style-1-cropbar-clipper">/* Copyright 2014 Evernote Corporation. All rights reserved. */
+.en-markup-crop-options {
+ top: 18px !important;
+ left: 50% !important;
+ margin-left: -100px !important;
+ width: 200px !important;
+ border: 2px rgba(255,255,255,.38) solid !important;
+ border-radius: 4px !important;
+}
+
+.en-markup-crop-options div div:first-of-type {
+ margin-left: 0px !important;
+}
+</style><link rel="stylesheet" type="text/css" href="chrome-extension://pkehgijcmpdhfbdbbnkijodmdjhbjlgp/skin/socialwidgets.css"></head><!--
+
+
+
+
+Oh, hello! Funny seeing you here.
+
+I appreciate your enthusiasm, but you aren't going to find much down here.
+There certainly aren't clues to any of the puzzles. You do risk spoiling a few
+surprises for yourself, though. Best to play the normal way and discover
+everything as it was intended, I think. The best surprises don't even appear
+in the source until you unlock them for real.
+
+Please be careful with automated requests; I'm not Google, and I can only take
+so much traffic. Please be considerate so that everyone gets to play.
+
+If you're curious about how Advent of Code works, it's running on some custom
+Perl code. Other than a few integrations (auth, analytics, ads, social media),
+I built the whole thing myself, including the design, animations, prose, and
+all of the puzzles.
+
+The puzzles probably took the longest; the easiest ones were around 45 minutes
+each, but the harder ones took 2-3 hours, some even longer than that. A lot of
+effort went into building this thing - I hope you're enjoying playing it as
+much as I enjoyed making it for you!
+
+If you'd like to hang out, I'm @ericwastl on Twitter.
+
+- Eric Wastl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-->
+<body>
+<header><h1><a href="http://adventofcode.com/">Advent of Code</a></h1><div class="user">Neil Smith <span class="star-count">30*</span></div><nav><ul><li><a href="http://adventofcode.com/about">[About]</a></li><li><a href="http://adventofcode.com/stats">[Stats]</a></li><li><a href="http://adventofcode.com/leaderboard">[Leaderboard]</a></li><li><a href="http://adventofcode.com/settings">[Settings]</a></li><li><a href="http://adventofcode.com/auth/logout">[Log out]</a></li></ul></nav></header>
+
+<div id="ad">
+<script async="" src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
+<!-- Advent of Code Wide Skyscraper -->
+<ins class="adsbygoogle" style="width: 160px; height: 600px;" data-ad-client="ca-pub-9420604735624631" data-ad-slot="8014013294"></ins>
+<script>
+(adsbygoogle = window.adsbygoogle || []).push({});
+</script>
+</div><!--/ad-->
+
+<main>
+<article class="day-desc"><h2>--- Day 15: Science for Hungry People ---</h2><p>Today, you set out on the task of perfecting your milk-dunking cookie recipe. All you have to do is find the right balance of ingredients.</p>
+<p>Your recipe leaves room for exactly <code>100</code> teaspoons of ingredients. You make a list of the <em>remaining ingredients you could use to finish the recipe</em> (your puzzle input) and their <em>properties per teaspoon</em>:</p>
+<ul>
+<li><code>capacity</code> (how well it helps the cookie absorb milk)</li>
+<li><code>durability</code> (how well it keeps the cookie intact when full of milk)</li>
+<li><code>flavor</code> (how tasty it makes the cookie)</li>
+<li><code>texture</code> (how it improves the feel of the cookie)</li>
+<li><code>calories</code> (how many calories it adds to the cookie)</li>
+</ul>
+<p>You can only measure ingredients in whole-teaspoon amounts accurately, and you have to be accurate so you can reproduce your results in the future. The <em>total score</em> of a cookie can be found by adding up each of the properties (negative totals become <code>0</code>) and then multiplying together everything except calories.</p>
+<p>For instance, suppose you have <span title="* I know what your preference is, but...">these two ingredients</span>:</p>
+<pre><code>Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8
+Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3
+</code></pre>
+<p>Then, choosing to use <code>44</code> teaspoons of butterscotch and <code>56</code> teaspoons of cinnamon (because the amounts of each ingredient must add up to <code>100</code>) would result in a cookie with the following properties:</p>
+<ul>
+<li>A <code>capacity</code> of <code>44*-1 + 56*2 = 68</code></li>
+<li>A <code>durability</code> of <code>44*-2 + 56*3 = 80</code></li>
+<li>A <code>flavor</code> of <code>44*6 + 56*-2 = 152</code></li>
+<li>A <code>texture</code> of <code>44*3 + 56*-1 = 76</code></li>
+</ul>
+<p>Multiplying these together (<code>68 * 80 * 152 * 76</code>, ignoring <code>calories</code> for now) results in a total score of <code>62842880</code>, which happens to be the best score possible given these ingredients. If any properties had produced a negative total, it would have instead become zero, causing the whole score to multiply to zero.</p>
+<p>Given the ingredients in your kitchen and their properties, what is the <em>total score</em> of the highest-scoring cookie you can make?</p>
+</article>
+<p>Your puzzle answer was <code>18965440</code>.</p><article class="day-desc"><h2>--- Part Two ---</h2><p>Your cookie recipe becomes wildly popular! Someone asks if you can make another recipe that has exactly <code>500</code> calories per cookie (so they can use it as a meal replacement). Keep the rest of your award-winning process the same (100 teaspoons, same ingredients, same scoring system).</p>
+<p>For example, given the ingredients above, if you had instead selected <code>40</code> teaspoons of butterscotch and <code>60</code> teaspoons of cinnamon (which still adds to <code>100</code>), the total calorie count would be <code>40*8 + 60*3 = 500</code>. The total score would go down, though: only <code>57600000</code>, the best you can do in such trying circumstances.</p>
+<p>Given the ingredients in your kitchen and their properties, what is the <em>total score</em> of the highest-scoring cookie you can make with a calorie total of <code>500</code>?</p>
+</article>
+<p>Your puzzle answer was <code>15862900</code>.</p><p class="day-success">Both parts of this puzzle are complete! They provide two gold stars: **</p>
+<p>At this point, you should <a href="http://adventofcode.com/">return to your advent calendar</a> and try another puzzle.</p>
+<p>If you still want to see it, you can <a href="http://adventofcode.com/day/15/input" target="_blank">get your puzzle input</a>.</p>
+<p>You can also <span class="share">[Share<span class="share-content">on
+ <a href="https://twitter.com/intent/tweet?text=I%27ve+completed+%22Science+for+Hungry+People%22+%2D+Day+15+%2D+Advent+of+Code&url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F15&related=ericwastl&hashtags=AdventOfCode" target="_blank" rel="noreferrer">Twitter</a>
+ <a href="https://plus.google.com/share?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F15" target="_blank" rel="noreferrer">Google+</a>
+ <a href="http://www.reddit.com/submit?url=http%3A%2F%2Fadventofcode%2Ecom%2Fday%2F15&title=I%27ve+completed+%22Science+for+Hungry+People%22+%2D+Day+15+%2D+Advent+of+Code" target="_blank" rel="noreferrer">Reddit</a></span>]</span>
+ this puzzle.</p>
+</main>
+
+<!-- ga -->
+<script>
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ga('create', 'UA-69522494-1', 'auto');
+ga('send', 'pageview');
+</script>
+<!-- /ga -->
+
+
+</body></html>
\ No newline at end of file
--- /dev/null
+/* latin-ext */
+@font-face {
+ font-family: 'Source Code Pro';
+ font-style: normal;
+ font-weight: 300;
+ src: local('Source Code Pro Light'), local('SourceCodePro-Light'), url(https://fonts.gstatic.com/s/sourcecodepro/v6/leqv3v-yTsJNC7nFznSMqTRVvBvQIc1z78c__uoBcyI.woff2) format('woff2');
+ unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
+}
+/* latin */
+@font-face {
+ font-family: 'Source Code Pro';
+ font-style: normal;
+ font-weight: 300;
+ src: local('Source Code Pro Light'), local('SourceCodePro-Light'), url(https://fonts.gstatic.com/s/sourcecodepro/v6/leqv3v-yTsJNC7nFznSMqeode0-EuMkY--TSyExeINg.woff2) format('woff2');
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
+}
--- /dev/null
+body {
+ background: #0f0f23; /*337 x 5*/
+ color: #cccccc;
+ font-family: "Source Code Pro", monospace;
+ font-size: 14pt;
+ min-width: 48em;
+}
+img { border:0; }
+a { outline:0; }
+main, figure, figcaption { display:block; }
+pre, code { font-family: "Source Code Pro", monospace; }
+header, main {
+ -webkit-text-size-adjust: none;
+}
+
+a {
+ text-decoration: none;
+ color: #009900;
+}
+a:hover {
+ color: #99ff99;
+}
+h1, h2 {
+ font-size: 1em;
+ font-weight: normal;
+}
+code {
+ border: 1px solid #333340;
+ background: #10101a;
+ display: inline-block;
+ margin: 1px -2px 1px -2px;
+ padding: 0 1px 0 1px;
+}
+
+#ad {
+ float: right;
+ margin: 0 15px 2em 2em;
+}
+
+header {
+ white-space: nowrap;
+ cursor: default;
+ z-index: 100;
+ margin-bottom: 1em;
+}
+header h1 {
+ display: inline-block;
+ margin: 0;
+ padding-right: 1em;
+}
+header h1 a {
+ display: inline-block;
+ text-decoration: none;
+ color: #00cc00;
+ text-shadow: 0 0 2px #00cc00, 0 0 5px #00cc00;
+}
+header h1 a:hover {
+ color: #99ff99;
+ text-shadow: 0 0 2px #99ff99, 0 0 5px #99ff99;
+}
+header .user {
+ display: inline-block;
+ padding: 0 .5em;
+}
+header .user .star-count {
+ color: #ffff66;
+}
+header nav {
+ display: inline-block;
+ margin-bottom: 1em;
+}
+header nav ul {
+ list-style-type: none;
+ padding: 0;
+ margin: 0;
+ display: inline-block;
+}
+header nav li {
+ display: inline-block;
+ padding: 0 .5em;
+}
+header nav a {
+ display: inline-block;
+ text-decoration: none;
+ outline: none;
+}
+
+input[type="text"] {
+ background: transparent;
+ color: inherit;
+ border: 1px solid #666666;
+ background: #10101a;
+ padding: 0 2px;
+ font-family: inherit;
+ font-size: inherit;
+ margin: 0;
+}
+
+input[type="submit"] {
+ background: transparent;
+ border: 0;
+ font-family: inherit;
+ font-size: inherit;
+ margin: 0;
+ padding: 0;
+ color: #009900;
+ cursor: pointer;
+}
+input[type="submit"]:hover {
+ color: #99ff99;
+}
+*::-moz-focus-inner {
+ padding: 0;
+ border: 0
+}
+
+article {
+ width: 45em;
+ margin-bottom: 2em;
+ margin-top: 2em;
+}
+article:first-child {
+ margin-top: 0;
+}
+article h2 {
+ color: #ffffff;
+ margin-top: 1em;
+ margin-bottom: 1em;
+ white-space: nowrap;
+}
+article h2 + * {
+ margin-top: 0;
+}
+article em {
+ color: #ffffff;
+ font-style: normal;
+ text-shadow: 0 0 5px #ffffff;
+}
+article em.star {
+ color: #ffff66;
+ font-style: normal;
+ text-shadow: 0 0 5px #ffff66;
+}
+article a {
+ white-space: nowrap;
+}
+article .aside {
+ opacity: .7;
+}
+article ul {
+ list-style-type: none;
+ padding: 0;
+}
+article li {
+ padding-left: 2.5em;
+ position: relative;
+}
+article li:before {
+ content: "\00a0\00a0-\00a0";
+ position: absolute;
+ left: 0em;
+ top: .15em;
+}
+.day-success {
+ color: #ffff66;
+ text-shadow: 0 0 5px #ffff66;
+}
+
+form#settings label img {
+ vertical-align: bottom;
+ position: relative;
+ top: -3px;
+ margin-right: .3em;
+}
+form#settings input[type="radio"] { display: none; }
+form#settings input[type="radio"] ~ span {
+ cursor: pointer;
+ display: inline-block;
+ min-width: 30em;
+}
+form#settings input[type="radio"] ~ span:before {
+ content: "( ) ";
+}
+form#settings input[type="radio"] ~ span:hover {
+ background-color: #19193b;
+}
+form#settings input[type="radio"]:checked ~ span {
+ color: #ffffff;
+}
+form#settings input[type="radio"]:checked ~ span:before {
+ content: "(O) ";
+}
+form#settings input[type="checkbox"] { display: none; }
+form#settings input[type="checkbox"] ~ span {
+ cursor: pointer;
+ display: inline-block;
+ min-width: 30em;
+}
+form#settings input[type="checkbox"] ~ span:before {
+ content: "[ ] ";
+}
+form#settings input[type="checkbox"] ~ span:hover {
+ background-color: #19193b;
+}
+form#settings input[type="checkbox"]:checked ~ span {
+ color: #ffffff;
+}
+form#settings input[type="checkbox"]:checked ~ span:before {
+ content: "[X] ";
+}
+form#settings input[type="checkbox"]:disabled ~ span {
+ opacity: .3;
+ cursor: default;
+}
+form#settings input[type="checkbox"]:disabled ~ span:before {
+ content: "[-] ";
+}
+form#settings input[type="checkbox"]:disabled ~ span:hover {
+ background-color: transparent;
+}
+
+.share {
+ color: #009900;
+ cursor: default;
+ transition: color .2s 1s;
+ /*position: relative;*/
+}
+.share:hover {
+ color: #aaffaa;
+ transition: color .2s 0s;
+}
+.share .share-content {
+ /*position: absolute; background: #0f0f23;*/
+ display: inline-block;
+ vertical-align: text-bottom;
+ white-space: nowrap;
+ overflow: hidden;
+ max-width: 0;
+ transition: max-width .2s 1s;
+}
+.share .share-content:before {
+ content: "\00a0";
+}
+.share .share-content:after {
+ /*content: "]";*/
+}
+.share:hover .share-content {
+ max-width: 45em;
+ transition: max-width .2s 0s;
+}
+
+.puzzle-input {
+ border: 1px solid #999999;
+ background: #333333;
+ color: #ffffff;
+ text-shadow: 0 0 5px #ffffff;
+}
+
+.tree {
+ cursor: default;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: -moz-none;
+ -o-user-select: none;
+ user-select: none;
+}
+.tree span {
+ color: #333333;
+}
+.tree .tree-trunk {
+ color: #cccccc;
+}
+.tree a {
+ text-decoration: none;
+ color: #666666;
+ outline: none;
+ cursor: default;
+}
+.tree a:hover {
+ background-color: #1e1e46;
+ background-color: rgba(119,119,165,.2);
+ cursor: pointer;
+}
+#tree-countdown {
+ padding-left: .5em;
+}
+.tree .tree-day { color: #666666; }
+.tree a .tree-day { color: #cccccc; }
+.tree a.tree-complete, .tree a.tree-verycomplete {
+ color: #009900;
+}
+.tree a .tree-mark-complete,
+.tree a .tree-mark-verycomplete { visibility: hidden; }
+.tree a.tree-complete .tree-mark-complete,
+.tree a.tree-verycomplete .tree-mark-complete { visibility: visible; color: #ffff66; }
+.tree a.tree-verycomplete .tree-mark-verycomplete { visibility: visible; color: #ffff66; }
+.tree a .tree-ornament0 { color: inherit; }
+.tree a .tree-ornament1 { color: inherit; }
+.tree a .tree-ornament2 { color: inherit; }
+.tree a .tree-ornament3 { color: inherit; }
+.tree a.tree-verycomplete .tree-ornament0 { color: #0066ff; text-shadow: 0 0 5px #0066ff; }
+.tree a.tree-verycomplete .tree-ornament1 { color: #ff9900; text-shadow: 0 0 5px #ff9900; }
+.tree a.tree-verycomplete .tree-ornament2 { color: #ff0000; text-shadow: 0 0 5px #ff0000; }
+.tree a.tree-verycomplete .tree-ornament3 { color: #ffff66; text-shadow: 0 0 5px #ffff66; }
+.tree .tree-lightbeam { visibility: hidden; color: #666666; }
+.tree a.tree-day25.tree-complete,
+.tree a.tree-day25.tree-verycomplete{ color: #ffff66; }
+.tree a.tree-day25.tree-verycomplete{ text-shadow: 0 0 5px #ffff66; }
+.tree a.tree-complete .tree-lightbeam,
+.tree a.tree-verycomplete .tree-lightbeam { visibility: visible; }
+.tree a.tree-verycomplete .tree-lightbeam { color: #ffff66; text-shadow: 0 0 5px #ffff66; }
+
+.tree.tree-beckon .tree-day1 { animation: anim-beckon 3s infinite -2.875s; }
+.tree.tree-beckon .tree-day2 { animation: anim-beckon 3s infinite -2.750s; }
+.tree.tree-beckon .tree-day3 { animation: anim-beckon 3s infinite -2.625s; }
+.tree.tree-beckon .tree-day4 { animation: anim-beckon 3s infinite -2.500s; }
+.tree.tree-beckon .tree-day5 { animation: anim-beckon 3s infinite -2.375s; }
+.tree.tree-beckon .tree-day6 { animation: anim-beckon 3s infinite -2.250s; }
+.tree.tree-beckon .tree-day7 { animation: anim-beckon 3s infinite -2.125s; }
+.tree.tree-beckon .tree-day8 { animation: anim-beckon 3s infinite -2.000s; }
+.tree.tree-beckon .tree-day9 { animation: anim-beckon 3s infinite -1.875s; }
+.tree.tree-beckon .tree-day10 { animation: anim-beckon 3s infinite -1.750s; }
+.tree.tree-beckon .tree-day11 { animation: anim-beckon 3s infinite -1.625s; }
+.tree.tree-beckon .tree-day12 { animation: anim-beckon 3s infinite -1.500s; }
+.tree.tree-beckon .tree-day13 { animation: anim-beckon 3s infinite -1.375s; }
+.tree.tree-beckon .tree-day14 { animation: anim-beckon 3s infinite -1.250s; }
+.tree.tree-beckon .tree-day15 { animation: anim-beckon 3s infinite -1.125s; }
+.tree.tree-beckon .tree-day16 { animation: anim-beckon 3s infinite -1.000s; }
+.tree.tree-beckon .tree-day17 { animation: anim-beckon 3s infinite -0.875s; }
+.tree.tree-beckon .tree-day18 { animation: anim-beckon 3s infinite -0.750s; }
+.tree.tree-beckon .tree-day19 { animation: anim-beckon 3s infinite -0.625s; }
+.tree.tree-beckon .tree-day20 { animation: anim-beckon 3s infinite -0.500s; }
+.tree.tree-beckon .tree-day21 { animation: anim-beckon 3s infinite -0.375s; }
+.tree.tree-beckon .tree-day22 { animation: anim-beckon 3s infinite -0.250s; }
+.tree.tree-beckon .tree-day23 { animation: anim-beckon 3s infinite -0.125s; }
+.tree.tree-beckon .tree-day24 { animation: anim-beckon 3s infinite -0.000s; }
+.tree.tree-beckon > span { animation-name: anim-beckon-dark ! important; }
+@keyframes anim-beckon {
+ 0% { color: #666666; }
+ 80% { color: #666666; }
+ 90% { color: #00ff00; }
+ 100% { color: #666666; }
+}
+@keyframes anim-beckon-dark {
+ 0% { color: #333333; }
+ 80% { color: #333333; }
+ 90% { color: #009900; }
+ 100% { color: #333333; }
+}
+.tree .tree-day-new { animation: anim-day-new 5s; }
+.tree .tree-day-new .tree-day { animation: anim-day-new-day 5s; }
+@keyframes anim-day-new {
+ 0% { color: #333333; text-shadow: 0 0 5px transparent; }
+ 25% { color: #ffffff; text-shadow: 0 0 5px #ffffff; }
+ 100% { color: #666666; text-shadow: 0 0 5px transparent; }
+}
+@keyframes anim-day-new-day {
+ 0% { color: #666666; text-shadow: 0 0 5px transparent; }
+ 25% { color: #ffffff; text-shadow: 0 0 5px #ffffff; }
+ 100% { color: #cccccc; text-shadow: 0 0 5px transparent; }
+}
+
+.tree-bkg {
+ position: fixed;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: -1;
+ color: #ffffff;
+ cursor: default;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: -moz-none;
+ -o-user-select: none;
+ user-select: none;
+}
+.tree-bkg div:nth-child(1) { opacity: .04; }
+.tree-bkg div:nth-child(2) { opacity: .08; }
+.tree-bkg div:nth-child(3) { opacity: .12; }
+.tree-bkg div:nth-child(4) { opacity: .16; }
+.tree-bkg div {
+ text-align: justify;
+ margin-bottom: -1.2em;
+}
+.tree-bkg div::after {
+ content: "_";
+ display: inline-block;
+ visibility: hidden;
+ width: 100%;
+}
+
+.stats > span, .stats > span .stats-firstonly, .stats > span .stats-both {
+ color: #666666;
+}
+.stats > a {
+ color: #cccccc;
+ min-width: 35em;
+ display: inline-block;
+}
+.stats > a:hover {
+ background-color: #1e1e46;
+}
+.stats-firstonly {
+ color: #666699;
+}
+.stats-both {
+ color: #ffff66;
+}
+
+.leaderboard-entry {
+ white-space: pre;
+}
+.leaderboard-entry .star-count {
+ color: #ffff66;
+}
+.leaderboard-anon {
+ opacity: .6;
+}
+.leaderboard-userphoto {
+ display: inline-block;
+ height: 20px;
+ width: 20px;
+ margin: 0 .5em;
+ text-align: center;
+}
+.leaderboard-userphoto img {
+ height: 20px;
+ max-width: 20px;
+ vertical-align: middle;
+ position: relative;
+ top: -2px;
+}
+.leaderboard-time {
+ opacity: .5;
+}
+
+.privboard-row {
+ white-space: pre;
+}
+.privboard-row .star-count {
+ color: #ffff66;
+}
+.privboard-name {
+ display: inline-block;
+ overflow-x: hidden;
+ vertical-align: text-bottom;
+ width: 14em;
+}
+.privboard-day-locked { color: #333333; }
+.privboard-star-locked { visibility: hidden; }
+.privboard-star-unlocked { color: #333333; }
+.privboard-star-firstonly { color: #666699; }
+.privboard-star-both { color: #ffff66; }
"cells": [
{
"cell_type": "code",
- "execution_count": 24,
+ "execution_count": 6,
"metadata": {
"collapsed": true
},
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 39,
"metadata": {
"collapsed": false
},
" 'Sugar: capacity 0, durability 0, flavor -2, texture 2, calories 1']"
]
},
- "execution_count": 1,
+ "execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 36,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "pi15 = ['Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8',\n",
+ "'Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 40,
"metadata": {
"collapsed": false
},
" 'texture': 2}}"
]
},
- "execution_count": 9,
+ "execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
- "execution_count": 33,
+ "execution_count": 31,
"metadata": {
"collapsed": false
},
" property_scores[p] += ingredients[ingredient][p] * quantity\n",
" total = 1\n",
" for p in property_scores:\n",
- " total *= max(property_scores[p], 0)\n",
+ " if p != 'calories':\n",
+ " total *= max(property_scores[p], 0)\n",
" return total"
]
},
{
"cell_type": "code",
- "execution_count": 34,
+ "execution_count": 12,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
- "9396000000"
+ "[(0, 0, 0, 3),\n",
+ " (0, 0, 1, 2),\n",
+ " (0, 0, 2, 1),\n",
+ " (0, 0, 3, 0),\n",
+ " (0, 1, 0, 2),\n",
+ " (0, 1, 1, 1),\n",
+ " (0, 1, 2, 0),\n",
+ " (0, 2, 0, 1),\n",
+ " (0, 2, 1, 0),\n",
+ " (0, 3, 0, 0),\n",
+ " (1, 0, 0, 2),\n",
+ " (1, 0, 1, 1),\n",
+ " (1, 0, 2, 0),\n",
+ " (1, 1, 0, 1),\n",
+ " (1, 1, 1, 0),\n",
+ " (1, 2, 0, 0),\n",
+ " (2, 0, 0, 1),\n",
+ " (2, 0, 1, 0),\n",
+ " (2, 1, 0, 0),\n",
+ " (3, 0, 0, 0)]"
]
},
- "execution_count": 34,
+ "execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
- "score([('Frosting', 30), ('Butterscotch', 30), ('Candy', 30), ('Sugar', 10)], ingredients)"
+ "capacity = 3\n",
+ "list((a,b,c,(capacity-(a+b+c))) for (a,b,c) in filter(lambda t: sum(t) <= capacity,\n",
+ " itertools.product(range(capacity+1), range(capacity+1), \n",
+ " range(capacity+1))))"
]
},
{
"cell_type": "code",
- "execution_count": 31,
+ "execution_count": 13,
"metadata": {
"collapsed": false,
"scrolled": true
" (3, 0, 0, 0)]"
]
},
- "execution_count": 31,
+ "execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
" range(capacity+1), range(capacity+1))))"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "metadata": {
+ "collapsed": false,
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "18965440"
+ ]
+ },
+ "execution_count": 32,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "capacity = 100\n",
+ "max(score([('Frosting', f), ('Butterscotch', b), ('Candy', c), ('Sugar', capacity-(f+b+c))], ingredients) \n",
+ " for b, c, f in filter(lambda t: sum(t) <= capacity,\n",
+ " itertools.product(range(capacity+1), range(capacity+1), \n",
+ " range(capacity+1))))"
+ ]
+ },
{
"cell_type": "code",
"execution_count": 38,
{
"data": {
"text/plain": [
- "10618782720"
+ "57600000"
]
},
"execution_count": 38,
],
"source": [
"capacity = 100\n",
- "max(score([('Frosting', f), ('Butterscotch', b), ('Candy', c), ('Sugar', s)], ingredients) \n",
- " for b, c, f, s in filter(lambda t: sum(t) == capacity,\n",
- " itertools.product(range(capacity+1), range(capacity+1), \n",
- " range(capacity+1), range(capacity+1))))"
+ "max(score([('Cinnamon', c), ('Butterscotch', (capacity-c))], ingredients) \n",
+ " for (c, ) in filter(lambda t: calories([('Cinnamon', t[0]), ('Butterscotch', (capacity-t[0]))], ingredients) == 500,\n",
+ " filter(lambda t: sum(t) <= capacity,\n",
+ " itertools.product(range(capacity+1)))))"
]
},
{
"cell_type": "code",
- "execution_count": 23,
+ "execution_count": 28,
"metadata": {
"collapsed": false
},
"outputs": [
{
- "ename": "TypeError",
- "evalue": "unhashable type: 'slice'",
- "output_type": "error",
- "traceback": [
- "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
- "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)",
- "\u001b[1;32m<ipython-input-23-95769c86abac>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mingredients\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
- "\u001b[1;31mTypeError\u001b[0m: unhashable type: 'slice'"
- ]
+ "data": {
+ "text/plain": [
+ "(defaultdict(<class 'int'>, {'flavor': 152, 'texture': 76, 'capacity': 68, 'calories': 520, 'durability': 80}),\n",
+ " 62842880)"
+ ]
+ },
+ "execution_count": 28,
+ "metadata": {},
+ "output_type": "execute_result"
}
],
- "source": []
+ "source": [
+ "score([('Cinnamon', 56), ('Butterscotch', 44)], ingredients)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "def calories(recipe, ingredients):\n",
+ " return sum(ingredients[i]['calories'] * quantity for i, quantity in recipe)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "320"
+ ]
+ },
+ "execution_count": 34,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "calories([('Sugar', 56), ('Butterscotch', 44)], ingredients)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 35,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "320"
+ ]
+ },
+ "execution_count": 35,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "56*1 + 44*6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 42,
+ "metadata": {
+ "collapsed": false,
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "15862900"
+ ]
+ },
+ "execution_count": 42,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "capacity = 100\n",
+ "max(score([('Frosting', f), ('Butterscotch', b), ('Candy', c), ('Sugar', capacity-(f+b+c))], ingredients) \n",
+ " for f, b, c in filter(lambda t: calories([('Frosting', t[0]), ('Butterscotch', t[1]), \n",
+ " ('Candy', t[2]), ('Sugar', capacity-sum(t))], ingredients) == 500,\n",
+ " filter(lambda t: sum(t) <= capacity,\n",
+ " itertools.product(range(capacity+1), range(capacity+1), \n",
+ " range(capacity+1)))))"
+ ]
},
{
"cell_type": "code",