{
  "schemaVersion": 1,
  "slug": "minecraft-enchantment-calculator",
  "category": "gaming",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "4011770424db1f8c2b3c7ad06fb9a27e8abc5045de4ada3fc6af974bb5e305a2",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/minecraft-enchantment-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "L = min(30, 2 × min(15, B)); O = (L, max(1, 2L ÷ 3), max(1, L ÷ 3)); c = {3, L = 30; 2, 15 ≤ L < 30; 1, L < 15}",
    "vars": [
      [
        "L",
        "top enchantment level"
      ],
      [
        "B",
        "bookshelves"
      ],
      [
        "O",
        "level options (top, middle, bottom)"
      ],
      [
        "c",
        "lapis & level cost"
      ]
    ],
    "note": "Estimates the bookshelf-based level cap up to 15 effective shelves and level 30. Offer affordability counts up to three slots from available player levels and lapis; actual offers are randomized and edition/item dependent."
  },
  "externalEvidence": {
    "reviewedAt": "2026-09-25",
    "sources": [
      {
        "name": "Minecraft Wiki — Enchanting mechanics",
        "url": "https://minecraft.wiki/w/Enchanting_mechanics"
      }
    ]
  },
  "contract": {
    "compute": "const shelves=Math.max(0,Math.min(15,Math.floor(bookshelves))),maxLevel=Math.min(30,shelves*2),affordableSlots=Math.min(3,Math.floor(playerLevels),Math.floor(lapis));return{maxLevel,effectiveShelves:shelves,affordableSlots}",
    "inputs": [
      {
        "name": "bookshelves",
        "type": "number",
        "default": 15,
        "min": 0,
        "max": 30,
        "step": 1,
        "slider": true
      },
      {
        "name": "playerLevels",
        "type": "number",
        "default": 30,
        "min": 0,
        "max": 100,
        "step": 1,
        "slider": true
      },
      {
        "name": "lapis",
        "type": "number",
        "default": 3,
        "min": 0,
        "max": 64,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "maxLevel",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "effectiveShelves",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "affordableSlots",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
