Public

Versions

  • v2

    11/16/2023
    Open: Version
    Changes from v1 to v2
    +3
    -0
    export function sort(recipes: Map<string, Recipe>, materials: Material[]) {
    const have = new Set(materials.map((m) => m.name));
    ⦚ 12 unchanged lines ⦚
    import { Material } from "https://esm.town/v/tmcw/Material";
    import { Recipe } from "https://esm.town/v/tmcw/Recipe";

    export function sort(recipes: Map<string, Recipe>, materials: Material[]) {
    const have = new Set(materials.map((m) => m.name));
    ⦚ 12 unchanged lines ⦚
  • v1

    11/16/2023
    Open: Version
    Changes from v0 to v1
    +13
    -3
    import _ from "npm:lodash-es";

    let numbers = _.range(10);
    export const untitled_bronzeSpider = numbers.map(n => n * 2);
    export function sort(recipes: Map<string, Recipe>, materials: Material[]) {
    const have = new Set(materials.map((m) => m.name));

    return Array.from(recipes.values()).map((recipe) => {
    return {
    recipe,
    weight: recipe.ingredients.filter((ingredient) => {
    return have.has(ingredient.material.name);
    }).length,
    };
    }).sort((a, b) => {
    return b.weight - a.weight;
    }).map((r) => r.recipe);
    }
  • v0

    11/16/2023
    Open: Version
    +4
    -0

    import _ from "npm:lodash-es";

    let numbers = _.range(10);
    export const untitled_bronzeSpider = numbers.map(n => n * 2);
1
Next
Updated: November 16, 2023