@classytic/labs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +105 -0
- package/dist/biology/enzyme-rate/index.d.mts +1 -0
- package/dist/biology/enzyme-rate/preset.d.mts +25 -0
- package/dist/biology/enzyme-rate/preset.mjs +256 -0
- package/dist/biology/genetic-cross/core.d.mts +64 -0
- package/dist/biology/genetic-cross/core.mjs +147 -0
- package/dist/biology/genetic-cross/grid.mjs +239 -0
- package/dist/biology/genetic-cross/index.d.mts +3 -0
- package/dist/biology/genetic-cross/preset.d.mts +26 -0
- package/dist/biology/genetic-cross/preset.mjs +184 -0
- package/dist/biology/genetic-cross/sex-linked.d.mts +27 -0
- package/dist/biology/genetic-cross/sex-linked.mjs +226 -0
- package/dist/biology/index.d.mts +11 -0
- package/dist/biology/index.mjs +12 -0
- package/dist/biology/photosynthesis-factors/index.d.mts +1 -0
- package/dist/biology/photosynthesis-factors/preset.d.mts +25 -0
- package/dist/biology/photosynthesis-factors/preset.mjs +270 -0
- package/dist/biology/punnett-cross/index.d.mts +1 -0
- package/dist/biology/punnett-cross/preset.d.mts +27 -0
- package/dist/biology/punnett-cross/preset.mjs +21 -0
- package/dist/biology/respiration/index.d.mts +1 -0
- package/dist/biology/respiration/preset.d.mts +17 -0
- package/dist/biology/respiration/preset.mjs +179 -0
- package/dist/biology/sequence/central-dogma.d.mts +17 -0
- package/dist/biology/sequence/central-dogma.mjs +339 -0
- package/dist/biology/sequence/core.d.mts +38 -0
- package/dist/biology/sequence/core.mjs +178 -0
- package/dist/biology/sequence/index.d.mts +3 -0
- package/dist/biology/sequence/preset.d.mts +20 -0
- package/dist/biology/sequence/preset.mjs +235 -0
- package/dist/blocks/accounting.d.mts +142 -0
- package/dist/blocks/accounting.mjs +446 -0
- package/dist/blocks/authoring.d.mts +12 -0
- package/dist/blocks/authoring.mjs +705 -0
- package/dist/blocks/biology.d.mts +197 -0
- package/dist/blocks/biology.mjs +513 -0
- package/dist/blocks/chem.d.mts +128 -0
- package/dist/blocks/chem.mjs +486 -0
- package/dist/blocks/circuits.d.mts +86 -0
- package/dist/blocks/circuits.mjs +348 -0
- package/dist/blocks/discrete.d.mts +62 -0
- package/dist/blocks/discrete.mjs +314 -0
- package/dist/blocks/economics.d.mts +56 -0
- package/dist/blocks/economics.mjs +203 -0
- package/dist/blocks/geography.d.mts +58 -0
- package/dist/blocks/geography.mjs +115 -0
- package/dist/blocks/geometry.d.mts +28 -0
- package/dist/blocks/geometry.mjs +160 -0
- package/dist/blocks/ict.d.mts +65 -0
- package/dist/blocks/ict.mjs +197 -0
- package/dist/blocks/index.d.mts +4555 -0
- package/dist/blocks/index.mjs +120 -0
- package/dist/blocks/lab-block.d.mts +16 -0
- package/dist/blocks/lab-block.mjs +74 -0
- package/dist/blocks/lab-config.d.mts +23 -0
- package/dist/blocks/lab-config.mjs +200 -0
- package/dist/blocks/lab-gallery.d.mts +30 -0
- package/dist/blocks/lab-gallery.mjs +208 -0
- package/dist/blocks/language.d.mts +349 -0
- package/dist/blocks/language.mjs +750 -0
- package/dist/blocks/lesson.d.mts +43 -0
- package/dist/blocks/lesson.mjs +140 -0
- package/dist/blocks/math.d.mts +411 -0
- package/dist/blocks/math.mjs +1536 -0
- package/dist/blocks/ml.d.mts +84 -0
- package/dist/blocks/ml.mjs +146 -0
- package/dist/blocks/physics.d.mts +259 -0
- package/dist/blocks/physics.mjs +868 -0
- package/dist/blocks/statistics.d.mts +29 -0
- package/dist/blocks/statistics.mjs +123 -0
- package/dist/catalog/index.d.mts +3 -0
- package/dist/catalog/index.mjs +8 -0
- package/dist/catalog/registry.d.mts +46 -0
- package/dist/catalog/registry.mjs +56 -0
- package/dist/catalog/templates.d.mts +11 -0
- package/dist/catalog/templates.mjs +141 -0
- package/dist/chem/battery.d.mts +16 -0
- package/dist/chem/battery.mjs +311 -0
- package/dist/chem/bohr-atom.d.mts +16 -0
- package/dist/chem/bohr-atom.mjs +212 -0
- package/dist/chem/diffusion/asset.mjs +76 -0
- package/dist/chem/diffusion/index.d.mts +1 -0
- package/dist/chem/diffusion/preset.d.mts +15 -0
- package/dist/chem/diffusion/preset.mjs +188 -0
- package/dist/chem/electrochem/index.d.mts +1 -0
- package/dist/chem/electrochem/preset.d.mts +23 -0
- package/dist/chem/electrochem/preset.mjs +402 -0
- package/dist/chem/equilibrium/index.d.mts +1 -0
- package/dist/chem/equilibrium/preset.d.mts +36 -0
- package/dist/chem/equilibrium/preset.mjs +416 -0
- package/dist/chem/gas-box/index.d.mts +1 -0
- package/dist/chem/gas-box/preset.d.mts +27 -0
- package/dist/chem/gas-box/preset.mjs +395 -0
- package/dist/chem/index.d.mts +16 -0
- package/dist/chem/index.mjs +17 -0
- package/dist/chem/kinetics/index.d.mts +1 -0
- package/dist/chem/kinetics/preset.d.mts +31 -0
- package/dist/chem/kinetics/preset.mjs +478 -0
- package/dist/chem/periodic-trends/index.d.mts +1 -0
- package/dist/chem/periodic-trends/preset.d.mts +21 -0
- package/dist/chem/periodic-trends/preset.mjs +831 -0
- package/dist/chem/reaction-lab.d.mts +18 -0
- package/dist/chem/reaction-lab.mjs +165 -0
- package/dist/chem/reaction-profile.d.mts +21 -0
- package/dist/chem/reaction-profile.mjs +287 -0
- package/dist/chem/solution/dilution.d.mts +27 -0
- package/dist/chem/solution/dilution.mjs +199 -0
- package/dist/chem/solution/field.d.mts +30 -0
- package/dist/chem/solution/field.mjs +145 -0
- package/dist/chem/solution/index.d.mts +3 -0
- package/dist/chem/solution/solution-box.d.mts +28 -0
- package/dist/chem/solution/solution-box.mjs +140 -0
- package/dist/chem/stoichiometry/index.d.mts +1 -0
- package/dist/chem/stoichiometry/preset.d.mts +29 -0
- package/dist/chem/stoichiometry/preset.mjs +392 -0
- package/dist/chem/titration/index.d.mts +1 -0
- package/dist/chem/titration/preset.d.mts +29 -0
- package/dist/chem/titration/preset.mjs +436 -0
- package/dist/circuits/ac-dc/asset.mjs +295 -0
- package/dist/circuits/ac-dc/index.d.mts +1 -0
- package/dist/circuits/ac-dc/preset.d.mts +16 -0
- package/dist/circuits/ac-dc/preset.mjs +134 -0
- package/dist/circuits/capacitor-leak/index.d.mts +1 -0
- package/dist/circuits/capacitor-leak/preset.d.mts +32 -0
- package/dist/circuits/capacitor-leak/preset.mjs +271 -0
- package/dist/circuits/circuit/asset.d.mts +6 -0
- package/dist/circuits/circuit/asset.mjs +367 -0
- package/dist/circuits/circuit/index.d.mts +2 -0
- package/dist/circuits/circuit/preset.d.mts +46 -0
- package/dist/circuits/circuit/preset.mjs +235 -0
- package/dist/circuits/circuit-builder.d.mts +30 -0
- package/dist/circuits/circuit-builder.mjs +412 -0
- package/dist/circuits/circuit-lab.d.mts +20 -0
- package/dist/circuits/circuit-lab.mjs +400 -0
- package/dist/circuits/index.d.mts +7 -0
- package/dist/circuits/index.mjs +8 -0
- package/dist/commerce/accounting/core.d.mts +48 -0
- package/dist/commerce/accounting/core.mjs +57 -0
- package/dist/commerce/accounting/equation-balance.d.mts +35 -0
- package/dist/commerce/accounting/equation-balance.mjs +292 -0
- package/dist/commerce/accounting/index.d.mts +4 -0
- package/dist/commerce/accounting/journal-poster.d.mts +29 -0
- package/dist/commerce/accounting/journal-poster.mjs +472 -0
- package/dist/commerce/accounting/statement-sorter.d.mts +25 -0
- package/dist/commerce/accounting/statement-sorter.mjs +304 -0
- package/dist/commerce/economics/core.d.mts +33 -0
- package/dist/commerce/economics/core.mjs +26 -0
- package/dist/commerce/economics/demand-shift-vs-move.d.mts +35 -0
- package/dist/commerce/economics/demand-shift-vs-move.mjs +324 -0
- package/dist/commerce/economics/elasticity-revenue.d.mts +31 -0
- package/dist/commerce/economics/elasticity-revenue.mjs +253 -0
- package/dist/commerce/economics/index.d.mts +4 -0
- package/dist/commerce/economics/market-equilibrium.d.mts +33 -0
- package/dist/commerce/economics/market-equilibrium.mjs +340 -0
- package/dist/commerce/index.d.mts +9 -0
- package/dist/commerce/index.mjs +10 -0
- package/dist/core/easing.d.mts +28 -0
- package/dist/core/easing.mjs +66 -0
- package/dist/core/index.d.mts +10 -0
- package/dist/core/index.mjs +11 -0
- package/dist/core/numeric.d.mts +37 -0
- package/dist/core/numeric.mjs +75 -0
- package/dist/core/reactive.d.mts +24 -0
- package/dist/core/reactive.mjs +51 -0
- package/dist/core/rng.d.mts +21 -0
- package/dist/core/rng.mjs +39 -0
- package/dist/core/tex.d.mts +14 -0
- package/dist/core/tex.mjs +44 -0
- package/dist/core/timeline.d.mts +34 -0
- package/dist/core/timeline.mjs +77 -0
- package/dist/core/util.d.mts +19 -0
- package/dist/core/util.mjs +31 -0
- package/dist/discrete/arrangements/preset.d.mts +28 -0
- package/dist/discrete/arrangements/preset.mjs +304 -0
- package/dist/discrete/bayes/preset.d.mts +33 -0
- package/dist/discrete/bayes/preset.mjs +476 -0
- package/dist/discrete/binomial/preset.d.mts +25 -0
- package/dist/discrete/binomial/preset.mjs +333 -0
- package/dist/discrete/core/combinatorics.d.mts +23 -0
- package/dist/discrete/core/combinatorics.mjs +57 -0
- package/dist/discrete/core/inclusionExclusion.d.mts +19 -0
- package/dist/discrete/core/inclusionExclusion.mjs +30 -0
- package/dist/discrete/core/pigeonhole.d.mts +15 -0
- package/dist/discrete/core/pigeonhole.mjs +24 -0
- package/dist/discrete/core/probability.d.mts +29 -0
- package/dist/discrete/core/probability.mjs +43 -0
- package/dist/discrete/core/sets.d.mts +21 -0
- package/dist/discrete/core/sets.mjs +45 -0
- package/dist/discrete/counting-slots/preset.d.mts +30 -0
- package/dist/discrete/counting-slots/preset.mjs +553 -0
- package/dist/discrete/counting-tree/index.d.mts +1 -0
- package/dist/discrete/counting-tree/preset.d.mts +44 -0
- package/dist/discrete/counting-tree/preset.mjs +364 -0
- package/dist/discrete/expected-value/preset.d.mts +28 -0
- package/dist/discrete/expected-value/preset.mjs +352 -0
- package/dist/discrete/hypergeometric/preset.d.mts +25 -0
- package/dist/discrete/hypergeometric/preset.mjs +330 -0
- package/dist/discrete/index.d.mts +26 -0
- package/dist/discrete/index.mjs +27 -0
- package/dist/discrete/karnaugh/index.d.mts +1 -0
- package/dist/discrete/karnaugh/preset.d.mts +30 -0
- package/dist/discrete/karnaugh/preset.mjs +452 -0
- package/dist/discrete/lln/asset.mjs +206 -0
- package/dist/discrete/lln/index.d.mts +1 -0
- package/dist/discrete/lln/preset.d.mts +17 -0
- package/dist/discrete/lln/preset.mjs +152 -0
- package/dist/discrete/logic-circuit/index.d.mts +1 -0
- package/dist/discrete/logic-circuit/preset.d.mts +47 -0
- package/dist/discrete/logic-circuit/preset.mjs +307 -0
- package/dist/discrete/monte-carlo/index.d.mts +1 -0
- package/dist/discrete/monte-carlo/preset.d.mts +64 -0
- package/dist/discrete/monte-carlo/preset.mjs +446 -0
- package/dist/discrete/monty-hall/index.d.mts +1 -0
- package/dist/discrete/monty-hall/preset.d.mts +23 -0
- package/dist/discrete/monty-hall/preset.mjs +491 -0
- package/dist/discrete/outcome-builder/preset.d.mts +24 -0
- package/dist/discrete/outcome-builder/preset.mjs +283 -0
- package/dist/discrete/pascal/preset.d.mts +24 -0
- package/dist/discrete/pascal/preset.mjs +372 -0
- package/dist/discrete/sample-space/index.d.mts +1 -0
- package/dist/discrete/sample-space/preset.d.mts +42 -0
- package/dist/discrete/sample-space/preset.mjs +395 -0
- package/dist/discrete/selection/preset.d.mts +33 -0
- package/dist/discrete/selection/preset.mjs +406 -0
- package/dist/discrete/truth-table/index.d.mts +1 -0
- package/dist/discrete/truth-table/preset.d.mts +30 -0
- package/dist/discrete/truth-table/preset.mjs +456 -0
- package/dist/discrete/venn/index.d.mts +1 -0
- package/dist/discrete/venn/preset.d.mts +32 -0
- package/dist/discrete/venn/preset.mjs +461 -0
- package/dist/geography/cycle-lab/index.d.mts +1 -0
- package/dist/geography/cycle-lab/preset.d.mts +25 -0
- package/dist/geography/cycle-lab/preset.mjs +254 -0
- package/dist/geography/cycles.d.mts +21 -0
- package/dist/geography/cycles.mjs +205 -0
- package/dist/geography/index.d.mts +4 -0
- package/dist/geography/index.mjs +5 -0
- package/dist/geometry/board/index.d.mts +1 -0
- package/dist/geometry/board/preset.d.mts +71 -0
- package/dist/geometry/board/preset.mjs +148 -0
- package/dist/geometry/builder.d.mts +18 -0
- package/dist/geometry/builder.mjs +332 -0
- package/dist/geometry/index.d.mts +4 -0
- package/dist/geometry/index.mjs +5 -0
- package/dist/geometry/intersecting-circles.d.mts +17 -0
- package/dist/geometry/intersecting-circles.mjs +104 -0
- package/dist/ict/index.d.mts +5 -0
- package/dist/ict/index.mjs +6 -0
- package/dist/ict/number-systems/base-odometer.d.mts +34 -0
- package/dist/ict/number-systems/base-odometer.mjs +160 -0
- package/dist/ict/number-systems/bit-grouper.d.mts +32 -0
- package/dist/ict/number-systems/bit-grouper.mjs +190 -0
- package/dist/ict/number-systems/index.d.mts +4 -0
- package/dist/ict/number-systems/place-value-dial.d.mts +29 -0
- package/dist/ict/number-systems/place-value-dial.mjs +153 -0
- package/dist/ict/number-systems/wheel.d.mts +73 -0
- package/dist/ict/number-systems/wheel.mjs +279 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +11 -0
- package/dist/kit/anim.mjs +52 -0
- package/dist/kit/annotate.mjs +116 -0
- package/dist/kit/answer-check.d.mts +38 -0
- package/dist/kit/answer-check.mjs +65 -0
- package/dist/kit/asset-util.mjs +15 -0
- package/dist/kit/controls.mjs +77 -0
- package/dist/kit/cycle.d.mts +44 -0
- package/dist/kit/cycle.mjs +188 -0
- package/dist/kit/diagram.mjs +176 -0
- package/dist/kit/electronics.mjs +357 -0
- package/dist/kit/expr-analysis.d.mts +37 -0
- package/dist/kit/expr-analysis.mjs +111 -0
- package/dist/kit/frame.d.mts +70 -0
- package/dist/kit/frame.mjs +205 -0
- package/dist/kit/freq-tree.mjs +99 -0
- package/dist/kit/gameshow.mjs +315 -0
- package/dist/kit/index.d.mts +5 -0
- package/dist/kit/index.mjs +6 -0
- package/dist/kit/logic-gates.d.mts +6 -0
- package/dist/kit/logic-gates.mjs +210 -0
- package/dist/kit/molecules.mjs +178 -0
- package/dist/kit/pedagogy.d.mts +126 -0
- package/dist/kit/pedagogy.mjs +331 -0
- package/dist/kit/play.d.mts +21 -0
- package/dist/kit/play.mjs +52 -0
- package/dist/kit/probability.mjs +141 -0
- package/dist/kit/proportion.mjs +112 -0
- package/dist/kit/reaction.mjs +102 -0
- package/dist/kit/rich.d.mts +10 -0
- package/dist/kit/rich.mjs +21 -0
- package/dist/kit/scale.mjs +230 -0
- package/dist/kit/space.mjs +326 -0
- package/dist/kit/steps.d.mts +24 -0
- package/dist/kit/steps.mjs +57 -0
- package/dist/kit/thermal.mjs +289 -0
- package/dist/language/agreement/index.d.mts +1 -0
- package/dist/language/agreement/preset.d.mts +27 -0
- package/dist/language/agreement/preset.mjs +113 -0
- package/dist/language/article-lens/index.d.mts +1 -0
- package/dist/language/article-lens/preset.d.mts +31 -0
- package/dist/language/article-lens/preset.mjs +125 -0
- package/dist/language/deck.d.mts +45 -0
- package/dist/language/deck.mjs +61 -0
- package/dist/language/icon.d.mts +40 -0
- package/dist/language/icon.mjs +73 -0
- package/dist/language/index.d.mts +10 -0
- package/dist/language/index.mjs +11 -0
- package/dist/language/preposition-scene/index.d.mts +1 -0
- package/dist/language/preposition-scene/preset.d.mts +34 -0
- package/dist/language/preposition-scene/preset.mjs +234 -0
- package/dist/language/sentence-builder/index.d.mts +1 -0
- package/dist/language/sentence-builder/preset.d.mts +32 -0
- package/dist/language/sentence-builder/preset.mjs +122 -0
- package/dist/language/transform/index.d.mts +1 -0
- package/dist/language/transform/preset.d.mts +31 -0
- package/dist/language/transform/preset.mjs +137 -0
- package/dist/language/ui.d.mts +53 -0
- package/dist/language/ui.mjs +88 -0
- package/dist/language/word-match/index.d.mts +1 -0
- package/dist/language/word-match/preset.d.mts +22 -0
- package/dist/language/word-match/preset.mjs +148 -0
- package/dist/math/area-model/asset.d.mts +6 -0
- package/dist/math/area-model/asset.mjs +270 -0
- package/dist/math/area-model/index.d.mts +2 -0
- package/dist/math/area-model/preset.d.mts +29 -0
- package/dist/math/area-model/preset.mjs +243 -0
- package/dist/math/balance-algebra/asset.d.mts +6 -0
- package/dist/math/balance-algebra/asset.mjs +150 -0
- package/dist/math/balance-algebra/index.d.mts +2 -0
- package/dist/math/balance-algebra/preset.d.mts +30 -0
- package/dist/math/balance-algebra/preset.mjs +228 -0
- package/dist/math/derivation.d.mts +22 -0
- package/dist/math/derivation.mjs +113 -0
- package/dist/math/derivative-explorer/index.d.mts +1 -0
- package/dist/math/derivative-explorer/preset.d.mts +19 -0
- package/dist/math/derivative-explorer/preset.mjs +227 -0
- package/dist/math/function-machine/index.d.mts +1 -0
- package/dist/math/function-machine/preset.d.mts +21 -0
- package/dist/math/function-machine/preset.mjs +177 -0
- package/dist/math/gradient-descent.d.mts +23 -0
- package/dist/math/gradient-descent.mjs +473 -0
- package/dist/math/grapher/index.d.mts +1 -0
- package/dist/math/grapher/preset.d.mts +40 -0
- package/dist/math/grapher/preset.mjs +313 -0
- package/dist/math/harmonic-form/index.d.mts +1 -0
- package/dist/math/harmonic-form/preset.d.mts +21 -0
- package/dist/math/harmonic-form/preset.mjs +387 -0
- package/dist/math/index.d.mts +25 -0
- package/dist/math/index.mjs +26 -0
- package/dist/math/integral-explorer/index.d.mts +1 -0
- package/dist/math/integral-explorer/preset.d.mts +23 -0
- package/dist/math/integral-explorer/preset.mjs +217 -0
- package/dist/math/interactive/index.d.mts +1 -0
- package/dist/math/interactive/preset.d.mts +72 -0
- package/dist/math/interactive/preset.mjs +202 -0
- package/dist/math/limit-explorer/index.d.mts +1 -0
- package/dist/math/limit-explorer/preset.d.mts +19 -0
- package/dist/math/limit-explorer/preset.mjs +216 -0
- package/dist/math/linear-system/index.d.mts +1 -0
- package/dist/math/linear-system/preset.d.mts +28 -0
- package/dist/math/linear-system/preset.mjs +164 -0
- package/dist/math/mystery-bucket/asset.d.mts +6 -0
- package/dist/math/mystery-bucket/asset.mjs +145 -0
- package/dist/math/mystery-bucket/index.d.mts +2 -0
- package/dist/math/mystery-bucket/preset.d.mts +36 -0
- package/dist/math/mystery-bucket/preset.mjs +116 -0
- package/dist/math/number-line/index.d.mts +1 -0
- package/dist/math/number-line/preset.d.mts +24 -0
- package/dist/math/number-line/preset.mjs +142 -0
- package/dist/math/parabola/index.d.mts +1 -0
- package/dist/math/parabola/preset.d.mts +13 -0
- package/dist/math/parabola/preset.mjs +79 -0
- package/dist/math/pattern/asset.d.mts +6 -0
- package/dist/math/pattern/asset.mjs +102 -0
- package/dist/math/pattern/index.d.mts +2 -0
- package/dist/math/pattern/preset.d.mts +32 -0
- package/dist/math/pattern/preset.mjs +294 -0
- package/dist/math/triangle-trig/index.d.mts +1 -0
- package/dist/math/triangle-trig/preset.d.mts +47 -0
- package/dist/math/triangle-trig/preset.mjs +245 -0
- package/dist/math/trig-explorer.d.mts +18 -0
- package/dist/math/trig-explorer.mjs +209 -0
- package/dist/ml/boundary/index.d.mts +1 -0
- package/dist/ml/boundary/preset.d.mts +24 -0
- package/dist/ml/boundary/preset.mjs +385 -0
- package/dist/ml/classifier/index.d.mts +1 -0
- package/dist/ml/classifier/preset.d.mts +25 -0
- package/dist/ml/classifier/preset.mjs +315 -0
- package/dist/ml/index.d.mts +6 -0
- package/dist/ml/index.mjs +7 -0
- package/dist/ml/kmeans/index.d.mts +1 -0
- package/dist/ml/kmeans/preset.d.mts +33 -0
- package/dist/ml/kmeans/preset.mjs +236 -0
- package/dist/ml/knn/index.d.mts +1 -0
- package/dist/ml/knn/preset.d.mts +28 -0
- package/dist/ml/knn/preset.mjs +279 -0
- package/dist/ml/regression/index.d.mts +1 -0
- package/dist/ml/regression/preset.d.mts +32 -0
- package/dist/ml/regression/preset.mjs +394 -0
- package/dist/physics/atwood/index.d.mts +1 -0
- package/dist/physics/atwood/preset.d.mts +23 -0
- package/dist/physics/atwood/preset.mjs +312 -0
- package/dist/physics/bullet-walls/index.d.mts +1 -0
- package/dist/physics/bullet-walls/preset.d.mts +28 -0
- package/dist/physics/bullet-walls/preset.mjs +373 -0
- package/dist/physics/carnot/index.d.mts +1 -0
- package/dist/physics/carnot/preset.d.mts +27 -0
- package/dist/physics/carnot/preset.mjs +427 -0
- package/dist/physics/circular-motion/index.d.mts +1 -0
- package/dist/physics/circular-motion/preset.d.mts +25 -0
- package/dist/physics/circular-motion/preset.mjs +293 -0
- package/dist/physics/collision-track/index.d.mts +1 -0
- package/dist/physics/collision-track/preset.d.mts +27 -0
- package/dist/physics/collision-track/preset.mjs +352 -0
- package/dist/physics/efficiency/index.d.mts +1 -0
- package/dist/physics/efficiency/preset.d.mts +33 -0
- package/dist/physics/efficiency/preset.mjs +343 -0
- package/dist/physics/electric-field/index.d.mts +1 -0
- package/dist/physics/electric-field/preset.d.mts +15 -0
- package/dist/physics/electric-field/preset.mjs +306 -0
- package/dist/physics/energy-skate/index.d.mts +1 -0
- package/dist/physics/energy-skate/preset.d.mts +25 -0
- package/dist/physics/energy-skate/preset.mjs +254 -0
- package/dist/physics/entropy/index.d.mts +1 -0
- package/dist/physics/entropy/preset.d.mts +18 -0
- package/dist/physics/entropy/preset.mjs +416 -0
- package/dist/physics/expansion/index.d.mts +1 -0
- package/dist/physics/expansion/preset.d.mts +26 -0
- package/dist/physics/expansion/preset.mjs +609 -0
- package/dist/physics/exponential/asset.mjs +221 -0
- package/dist/physics/exponential/index.d.mts +1 -0
- package/dist/physics/exponential/preset.d.mts +17 -0
- package/dist/physics/exponential/preset.mjs +182 -0
- package/dist/physics/gas-process/index.d.mts +1 -0
- package/dist/physics/gas-process/preset.d.mts +30 -0
- package/dist/physics/gas-process/preset.mjs +384 -0
- package/dist/physics/gravitation/index.d.mts +1 -0
- package/dist/physics/gravitation/preset.d.mts +24 -0
- package/dist/physics/gravitation/preset.mjs +345 -0
- package/dist/physics/gravity-drop.d.mts +9 -0
- package/dist/physics/gravity-drop.mjs +187 -0
- package/dist/physics/heat-transfer/index.d.mts +1 -0
- package/dist/physics/heat-transfer/preset.d.mts +27 -0
- package/dist/physics/heat-transfer/preset.mjs +626 -0
- package/dist/physics/impulse/index.d.mts +1 -0
- package/dist/physics/impulse/preset.d.mts +29 -0
- package/dist/physics/impulse/preset.mjs +453 -0
- package/dist/physics/index.d.mts +43 -0
- package/dist/physics/index.mjs +44 -0
- package/dist/physics/kepler/index.d.mts +1 -0
- package/dist/physics/kepler/preset.d.mts +27 -0
- package/dist/physics/kepler/preset.mjs +257 -0
- package/dist/physics/lever/asset.d.mts +6 -0
- package/dist/physics/lever/asset.mjs +220 -0
- package/dist/physics/lever/index.d.mts +2 -0
- package/dist/physics/lever/preset.d.mts +31 -0
- package/dist/physics/lever/preset.mjs +261 -0
- package/dist/physics/lorentz/index.d.mts +1 -0
- package/dist/physics/lorentz/preset.d.mts +29 -0
- package/dist/physics/lorentz/preset.mjs +367 -0
- package/dist/physics/magnetism/index.d.mts +1 -0
- package/dist/physics/magnetism/preset.d.mts +15 -0
- package/dist/physics/magnetism/preset.mjs +334 -0
- package/dist/physics/optics/asset.d.mts +6 -0
- package/dist/physics/optics/asset.mjs +234 -0
- package/dist/physics/optics/index.d.mts +2 -0
- package/dist/physics/optics/preset.d.mts +14 -0
- package/dist/physics/optics/preset.mjs +202 -0
- package/dist/physics/orbit-lab.d.mts +6 -0
- package/dist/physics/orbit-lab.mjs +222 -0
- package/dist/physics/projectile-lab.d.mts +10 -0
- package/dist/physics/projectile-lab.mjs +354 -0
- package/dist/physics/rain-relative/index.d.mts +1 -0
- package/dist/physics/rain-relative/preset.d.mts +19 -0
- package/dist/physics/rain-relative/preset.mjs +358 -0
- package/dist/physics/ramp-forces/index.d.mts +1 -0
- package/dist/physics/ramp-forces/preset.d.mts +36 -0
- package/dist/physics/ramp-forces/preset.mjs +550 -0
- package/dist/physics/river-boat.d.mts +22 -0
- package/dist/physics/river-boat.mjs +498 -0
- package/dist/physics/shm/index.d.mts +1 -0
- package/dist/physics/shm/preset.d.mts +33 -0
- package/dist/physics/shm/preset.mjs +554 -0
- package/dist/physics/stopping-distance/index.d.mts +1 -0
- package/dist/physics/stopping-distance/preset.d.mts +29 -0
- package/dist/physics/stopping-distance/preset.mjs +662 -0
- package/dist/physics/temperature-scales/index.d.mts +1 -0
- package/dist/physics/temperature-scales/preset.d.mts +15 -0
- package/dist/physics/temperature-scales/preset.mjs +353 -0
- package/dist/physics/terminal-velocity/index.d.mts +1 -0
- package/dist/physics/terminal-velocity/preset.d.mts +26 -0
- package/dist/physics/terminal-velocity/preset.mjs +404 -0
- package/dist/physics/thermal/index.d.mts +1 -0
- package/dist/physics/thermal/preset.d.mts +44 -0
- package/dist/physics/thermal/preset.mjs +373 -0
- package/dist/physics/vector-board/index.d.mts +1 -0
- package/dist/physics/vector-board/preset.d.mts +65 -0
- package/dist/physics/vector-board/preset.mjs +273 -0
- package/dist/physics/vector-board/view.d.mts +49 -0
- package/dist/physics/vector-board/view.mjs +58 -0
- package/dist/physics/vector-scene.d.mts +41 -0
- package/dist/physics/vector-scene.mjs +211 -0
- package/dist/physics/vector-types/index.d.mts +1 -0
- package/dist/physics/vector-types/preset.d.mts +27 -0
- package/dist/physics/vector-types/preset.mjs +192 -0
- package/dist/physics/water-density/index.d.mts +1 -0
- package/dist/physics/water-density/preset.d.mts +18 -0
- package/dist/physics/water-density/preset.mjs +439 -0
- package/dist/physics/waves/core.mjs +33 -0
- package/dist/physics/waves/doppler.d.mts +23 -0
- package/dist/physics/waves/doppler.mjs +260 -0
- package/dist/physics/waves/index.d.mts +4 -0
- package/dist/physics/waves/preset.d.mts +30 -0
- package/dist/physics/waves/preset.mjs +488 -0
- package/dist/physics/waves/ripple.d.mts +26 -0
- package/dist/physics/waves/ripple.mjs +234 -0
- package/dist/physics/waves/string.d.mts +29 -0
- package/dist/physics/waves/string.mjs +289 -0
- package/dist/physics/work-energy/index.d.mts +1 -0
- package/dist/physics/work-energy/preset.d.mts +17 -0
- package/dist/physics/work-energy/preset.mjs +341 -0
- package/dist/schemas/index.d.mts +235 -0
- package/dist/schemas/index.mjs +145 -0
- package/dist/statistics/center-spread/preset.d.mts +34 -0
- package/dist/statistics/center-spread/preset.mjs +323 -0
- package/dist/statistics/core/descriptive.d.mts +35 -0
- package/dist/statistics/core/descriptive.mjs +64 -0
- package/dist/statistics/core/normal.d.mts +21 -0
- package/dist/statistics/core/normal.mjs +37 -0
- package/dist/statistics/core/sequences.d.mts +27 -0
- package/dist/statistics/core/sequences.mjs +35 -0
- package/dist/statistics/galton/preset.d.mts +27 -0
- package/dist/statistics/galton/preset.mjs +331 -0
- package/dist/statistics/histogram/preset.d.mts +27 -0
- package/dist/statistics/histogram/preset.mjs +385 -0
- package/dist/statistics/index.d.mts +11 -0
- package/dist/statistics/index.mjs +12 -0
- package/dist/statistics/normal/preset.d.mts +30 -0
- package/dist/statistics/normal/preset.mjs +400 -0
- package/dist/statistics/sampling/preset.d.mts +32 -0
- package/dist/statistics/sampling/preset.mjs +406 -0
- package/dist/statistics/sequence/preset.d.mts +28 -0
- package/dist/statistics/sequence/preset.mjs +302 -0
- package/dist/statistics/z-table/preset.d.mts +28 -0
- package/dist/statistics/z-table/preset.mjs +348 -0
- package/package.json +266 -0
- package/styles.css +267 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { binomial, factorial, gcd, lcm, multinomial, nCr, nPr, starsAndBars } from "./core/combinatorics.mjs";
|
|
2
|
+
import { Elem, cartesian, complement, difference, intersection, isSubset, powerset, setEqual, symmetricDifference, union } from "./core/sets.mjs";
|
|
3
|
+
import { IEResult, IETerm, inclusionExclusion } from "./core/inclusionExclusion.mjs";
|
|
4
|
+
import { atLeastOne, bayes, complement as complement$1, conditional, expectedValue, independent, probability } from "./core/probability.mjs";
|
|
5
|
+
import { guaranteedOccupancy, minForOccupancy, minToGuaranteePair } from "./core/pigeonhole.mjs";
|
|
6
|
+
import { Rng, mulberry32, randInt, sample, shuffle } from "../core/rng.mjs";
|
|
7
|
+
import { TruthTableLab, TruthTableMode, TruthTableProps } from "./truth-table/preset.mjs";
|
|
8
|
+
import { CountAsk, CountingTreeLab, CountingTreeProps, TreeBranch, TreeStage } from "./counting-tree/preset.mjs";
|
|
9
|
+
import { VennMode, VennSet, VennSetBoardLab, VennSetBoardProps } from "./venn/preset.mjs";
|
|
10
|
+
import { Cmp, Reduce, SampleEvent, SampleSpaceBoardLab, SampleSpaceProps } from "./sample-space/preset.mjs";
|
|
11
|
+
import { BooleanCircuitLab, BooleanCircuitProps, CircuitGate, CircuitInput, CircuitOutput } from "./logic-circuit/preset.mjs";
|
|
12
|
+
import { KMapMode, KMapProps, KarnaughMapLab } from "./karnaugh/preset.mjs";
|
|
13
|
+
import { ExperimentSpec, MCSeries, MonteCarloLab, MonteCarloProps } from "./monte-carlo/preset.mjs";
|
|
14
|
+
import { MontyHallLab, MontyHallProps } from "./monty-hall/preset.mjs";
|
|
15
|
+
import { OutcomeBuilderLab, OutcomeBuilderProps } from "./outcome-builder/preset.mjs";
|
|
16
|
+
import { BayesLab, BayesProps } from "./bayes/preset.mjs";
|
|
17
|
+
import { LawOfLargeNumbersLab, LlnProps } from "./lln/preset.mjs";
|
|
18
|
+
import { CountingSlotsLab, CountingSlotsProps, SlotMode } from "./counting-slots/preset.mjs";
|
|
19
|
+
import { SelectionGroup, SelectionLab, SelectionMode, SelectionProps } from "./selection/preset.mjs";
|
|
20
|
+
import { ArrangeItem, ArrangementsLab, ArrangementsProps } from "./arrangements/preset.mjs";
|
|
21
|
+
import { PascalProps, PascalTriangleLab, PascalView } from "./pascal/preset.mjs";
|
|
22
|
+
import { BinomialDistributionLab, BinomialProps } from "./binomial/preset.mjs";
|
|
23
|
+
import { HypergeometricLab, HypergeometricProps } from "./hypergeometric/preset.mjs";
|
|
24
|
+
import { EVOutcome, ExpectedValueLab, ExpectedValueProps } from "./expected-value/preset.mjs";
|
|
25
|
+
import { Classification, CompiledLogic, Cube, LNode, LogicResult, Minimization, TruthRow, TruthTable, classify, compileLogic, cubeCovers, cubeOfSelection, cubeTerm, equivalent, evalBool, logicToLatex, minimalCover, minimize, parseLogic, primeImplicants, toCNF, toDNF, truthTable } from "@classytic/stage";
|
|
26
|
+
export { type ArrangeItem, ArrangementsLab, type ArrangementsProps, BayesLab, type BayesProps, BinomialDistributionLab, type BinomialProps, BooleanCircuitLab, type BooleanCircuitProps, type CircuitGate, type CircuitInput, type CircuitOutput, type Classification, type Cmp, type CompiledLogic, type CountAsk, CountingSlotsLab, type CountingSlotsProps, CountingTreeLab, type CountingTreeProps, type Cube, type EVOutcome, type Elem, ExpectedValueLab, type ExpectedValueProps, type ExperimentSpec, HypergeometricLab, type HypergeometricProps, type IEResult, type IETerm, type KMapMode, type KMapProps, KarnaughMapLab, type LNode, LawOfLargeNumbersLab, type LlnProps, type LogicResult, type MCSeries, type Minimization, MonteCarloLab, type MonteCarloProps, MontyHallLab, type MontyHallProps, OutcomeBuilderLab, type OutcomeBuilderProps, type PascalProps, PascalTriangleLab, type PascalView, type Reduce, type Rng, type SampleEvent, SampleSpaceBoardLab, type SampleSpaceProps, type SelectionGroup, SelectionLab, type SelectionMode, type SelectionProps, type SlotMode, type TreeBranch, type TreeStage, type TruthRow, type TruthTable, TruthTableLab, type TruthTableMode, type TruthTableProps, type VennMode, type VennSet, VennSetBoardLab, type VennSetBoardProps, atLeastOne, bayes, binomial, cartesian, classify, compileLogic, complement, conditional, cubeCovers, cubeOfSelection, cubeTerm, difference, equivalent, evalBool, expectedValue, factorial, gcd, guaranteedOccupancy, inclusionExclusion, independent, intersection, isSubset, lcm, logicToLatex, minForOccupancy, minToGuaranteePair, minimalCover, minimize, mulberry32, multinomial, nCr, nPr, parseLogic, powerset, primeImplicants, complement$1 as probComplement, probability, randInt, sample, setEqual, shuffle, starsAndBars, symmetricDifference, toCNF, toDNF, truthTable, union };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { mulberry32, randInt, sample, shuffle } from "../core/rng.mjs";
|
|
2
|
+
import { binomial, factorial, gcd, lcm, multinomial, nCr, nPr, starsAndBars } from "./core/combinatorics.mjs";
|
|
3
|
+
import { cartesian, complement, difference, intersection, isSubset, powerset, setEqual, symmetricDifference, union } from "./core/sets.mjs";
|
|
4
|
+
import { inclusionExclusion } from "./core/inclusionExclusion.mjs";
|
|
5
|
+
import { atLeastOne, bayes, complement as complement$1, conditional, expectedValue, independent, probability } from "./core/probability.mjs";
|
|
6
|
+
import { guaranteedOccupancy, minForOccupancy, minToGuaranteePair } from "./core/pigeonhole.mjs";
|
|
7
|
+
import { TruthTableLab } from "./truth-table/preset.mjs";
|
|
8
|
+
import { CountingTreeLab } from "./counting-tree/preset.mjs";
|
|
9
|
+
import { VennSetBoardLab } from "./venn/preset.mjs";
|
|
10
|
+
import { SampleSpaceBoardLab } from "./sample-space/preset.mjs";
|
|
11
|
+
import { BooleanCircuitLab } from "./logic-circuit/preset.mjs";
|
|
12
|
+
import { KarnaughMapLab } from "./karnaugh/preset.mjs";
|
|
13
|
+
import { MonteCarloLab } from "./monte-carlo/preset.mjs";
|
|
14
|
+
import { MontyHallLab } from "./monty-hall/preset.mjs";
|
|
15
|
+
import { OutcomeBuilderLab } from "./outcome-builder/preset.mjs";
|
|
16
|
+
import { BayesLab } from "./bayes/preset.mjs";
|
|
17
|
+
import { LawOfLargeNumbersLab } from "./lln/preset.mjs";
|
|
18
|
+
import { CountingSlotsLab } from "./counting-slots/preset.mjs";
|
|
19
|
+
import { SelectionLab } from "./selection/preset.mjs";
|
|
20
|
+
import { ArrangementsLab } from "./arrangements/preset.mjs";
|
|
21
|
+
import { PascalTriangleLab } from "./pascal/preset.mjs";
|
|
22
|
+
import { BinomialDistributionLab } from "./binomial/preset.mjs";
|
|
23
|
+
import { HypergeometricLab } from "./hypergeometric/preset.mjs";
|
|
24
|
+
import { ExpectedValueLab } from "./expected-value/preset.mjs";
|
|
25
|
+
import { classify, compileLogic, cubeCovers, cubeOfSelection, cubeTerm, equivalent, evalBool, logicToLatex, minimalCover, minimize, parseLogic, primeImplicants, toCNF, toDNF, truthTable } from "@classytic/stage";
|
|
26
|
+
|
|
27
|
+
export { ArrangementsLab, BayesLab, BinomialDistributionLab, BooleanCircuitLab, CountingSlotsLab, CountingTreeLab, ExpectedValueLab, HypergeometricLab, KarnaughMapLab, LawOfLargeNumbersLab, MonteCarloLab, MontyHallLab, OutcomeBuilderLab, PascalTriangleLab, SampleSpaceBoardLab, SelectionLab, TruthTableLab, VennSetBoardLab, atLeastOne, bayes, binomial, cartesian, classify, compileLogic, complement, conditional, cubeCovers, cubeOfSelection, cubeTerm, difference, equivalent, evalBool, expectedValue, factorial, gcd, guaranteedOccupancy, inclusionExclusion, independent, intersection, isSubset, lcm, logicToLatex, minForOccupancy, minToGuaranteePair, minimalCover, minimize, mulberry32, multinomial, nCr, nPr, parseLogic, powerset, primeImplicants, complement$1 as probComplement, probability, randInt, sample, setEqual, shuffle, starsAndBars, symmetricDifference, toCNF, toDNF, truthTable, union };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { KMapMode, KMapProps, KarnaughMapLab } from "./preset.mjs";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/discrete/karnaugh/preset.d.ts
|
|
4
|
+
type KMapMode = 'show' | 'simplify';
|
|
5
|
+
interface KMapProps {
|
|
6
|
+
formula?: string;
|
|
7
|
+
minterms?: number[];
|
|
8
|
+
dontCares?: number[];
|
|
9
|
+
vars?: string[];
|
|
10
|
+
mode?: KMapMode;
|
|
11
|
+
title?: string;
|
|
12
|
+
prompt?: string;
|
|
13
|
+
objectives?: string[];
|
|
14
|
+
hints?: string[];
|
|
15
|
+
controlId?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function KarnaughMapLab({
|
|
18
|
+
formula,
|
|
19
|
+
minterms: mtIn,
|
|
20
|
+
dontCares: dcIn,
|
|
21
|
+
vars: varsIn,
|
|
22
|
+
mode,
|
|
23
|
+
title,
|
|
24
|
+
prompt,
|
|
25
|
+
objectives,
|
|
26
|
+
hints: hintList,
|
|
27
|
+
controlId
|
|
28
|
+
}: KMapProps): ReactNode;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { KMapMode, KMapProps, KarnaughMapLab };
|
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Tex as Tex$1 } from "../../core/tex.mjs";
|
|
4
|
+
import { Chip } from "../../kit/controls.mjs";
|
|
5
|
+
import { LabFrame } from "../../kit/frame.mjs";
|
|
6
|
+
import { HintLadder, RevealSolution, useCheckpoint, useHints } from "../../kit/pedagogy.mjs";
|
|
7
|
+
import { useMemo, useState } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { compileLogic, cubeCovers, cubeOfSelection, cubeTerm, logicToLatex, minimize, useControlSurface } from "@classytic/stage";
|
|
10
|
+
|
|
11
|
+
//#region src/discrete/karnaugh/preset.tsx
|
|
12
|
+
/**
|
|
13
|
+
* KarnaughMapLab — the GENERAL "simplify boolean by eye" tool. A K-map is just a
|
|
14
|
+
* truth table re-laid in GRAY-CODE order so that adjacent cells differ in ONE
|
|
15
|
+
* variable; circling a power-of-two block of 1s drops the variable that changes
|
|
16
|
+
* across it. That is the same "overcount, then correct" move as the rest of the
|
|
17
|
+
* pack — a group merges redundant minterms the way ÷k! merges redundant orderings.
|
|
18
|
+
*
|
|
19
|
+
* Creator declares a `formula` (any 2–4 variable expression) OR explicit
|
|
20
|
+
* `minterms` (+ optional `dontCares`). Two modes:
|
|
21
|
+
* • show — the kernel's minimal cover is drawn as coloured loops + the SOP.
|
|
22
|
+
* • simplify — the learner taps 1-cells to draw their own groups; each is
|
|
23
|
+
* live-validated (legal sub-cube? all ones?) and its product term
|
|
24
|
+
* shown; solved when every 1 is covered, with a "minimal!" bonus.
|
|
25
|
+
*
|
|
26
|
+
* Minimisation is Quine–McCluskey in the stage logic kernel (`minimize` /
|
|
27
|
+
* `cubeOfSelection`) — the map only RENDERS what the kernel computes. Groups that
|
|
28
|
+
* wrap the map edges render as two (or four) loops, exactly as on paper.
|
|
29
|
+
*/
|
|
30
|
+
const CS = 50;
|
|
31
|
+
const LH = 50, TH = 46;
|
|
32
|
+
const PALETTE = [
|
|
33
|
+
"#2f9e44",
|
|
34
|
+
"#1c7ed6",
|
|
35
|
+
"#e8590c",
|
|
36
|
+
"#9c36b5",
|
|
37
|
+
"#1098ad",
|
|
38
|
+
"#e03131"
|
|
39
|
+
];
|
|
40
|
+
const gray = (i) => i ^ i >> 1;
|
|
41
|
+
const bits = (v, n) => v.toString(2).padStart(n, "0");
|
|
42
|
+
/** Maximal consecutive runs of sorted indices (wrap shows as two runs — desired). */
|
|
43
|
+
function runs(idx) {
|
|
44
|
+
const s = [...idx].sort((a, b) => a - b);
|
|
45
|
+
const out = [];
|
|
46
|
+
let start = s[0], prev = s[0];
|
|
47
|
+
for (let i = 1; i < s.length; i++) {
|
|
48
|
+
if (s[i] === prev + 1) {
|
|
49
|
+
prev = s[i];
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
out.push([start, prev]);
|
|
53
|
+
start = s[i];
|
|
54
|
+
prev = s[i];
|
|
55
|
+
}
|
|
56
|
+
out.push([start, prev]);
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
function KarnaughMapLab({ formula, minterms: mtIn, dontCares: dcIn = [], vars: varsIn, mode = "show", title = "Karnaugh map", prompt, objectives, hints: hintList, controlId }) {
|
|
60
|
+
const model = useMemo(() => {
|
|
61
|
+
let vars;
|
|
62
|
+
let minterms;
|
|
63
|
+
let dontCares = dcIn;
|
|
64
|
+
if (formula) {
|
|
65
|
+
const c = compileLogic(formula);
|
|
66
|
+
if (!c.ok) return { error: c.error };
|
|
67
|
+
vars = c.vars;
|
|
68
|
+
const total = 1 << vars.length;
|
|
69
|
+
minterms = [];
|
|
70
|
+
for (let m = 0; m < total; m++) {
|
|
71
|
+
const env = {};
|
|
72
|
+
vars.forEach((v, i) => {
|
|
73
|
+
env[v] = (m & 1 << vars.length - 1 - i) !== 0;
|
|
74
|
+
});
|
|
75
|
+
if (c.eval(env)) minterms.push(m);
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
vars = varsIn ?? ["a", "b"];
|
|
79
|
+
minterms = (mtIn ?? []).slice();
|
|
80
|
+
}
|
|
81
|
+
const n = vars.length;
|
|
82
|
+
if (n < 2 || n > 4) return { error: "K-map supports 2–4 variables" };
|
|
83
|
+
const result = minimize({
|
|
84
|
+
minterms,
|
|
85
|
+
vars,
|
|
86
|
+
dontCares
|
|
87
|
+
});
|
|
88
|
+
return {
|
|
89
|
+
vars,
|
|
90
|
+
n,
|
|
91
|
+
minterms,
|
|
92
|
+
dontCares,
|
|
93
|
+
result
|
|
94
|
+
};
|
|
95
|
+
}, [
|
|
96
|
+
formula,
|
|
97
|
+
mtIn,
|
|
98
|
+
dcIn,
|
|
99
|
+
varsIn
|
|
100
|
+
]);
|
|
101
|
+
const hints = useHints(hintList);
|
|
102
|
+
const [selected, setSelected] = useState([]);
|
|
103
|
+
const [groups, setGroups] = useState([]);
|
|
104
|
+
const [revealed, setRevealed] = useState(false);
|
|
105
|
+
if ("error" in model) return /* @__PURE__ */ jsx(LabFrame, {
|
|
106
|
+
title,
|
|
107
|
+
children: /* @__PURE__ */ jsxs("p", {
|
|
108
|
+
style: { color: "var(--stage-bad)" },
|
|
109
|
+
children: ["⚠ ", model.error]
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
const { vars, n, minterms, dontCares, result } = model;
|
|
113
|
+
const rowBits = n <= 2 ? 1 : n === 3 ? 1 : 2;
|
|
114
|
+
const colBits = n - rowBits;
|
|
115
|
+
const nRows = 1 << rowBits, nCols = 1 << colBits;
|
|
116
|
+
const oneSet = new Set(minterms);
|
|
117
|
+
const dcSet = new Set(dontCares);
|
|
118
|
+
const rowVars = vars.slice(0, rowBits), colVars = vars.slice(rowBits);
|
|
119
|
+
const mintermAt = (gr, gc) => gray(gr) << colBits | gray(gc);
|
|
120
|
+
const cellOf = (m) => {
|
|
121
|
+
for (let gr = 0; gr < nRows; gr++) for (let gc = 0; gc < nCols; gc++) if (mintermAt(gr, gc) === m) return {
|
|
122
|
+
gr,
|
|
123
|
+
gc
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
gr: 0,
|
|
127
|
+
gc: 0
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
const gridW = nCols * CS, gridH = nRows * CS;
|
|
131
|
+
const W = LH + gridW + 16, H = TH + gridH + 16;
|
|
132
|
+
const cellX = (gc) => LH + gc * CS;
|
|
133
|
+
const cellY = (gr) => TH + gr * CS;
|
|
134
|
+
const loopsFor = (cube) => {
|
|
135
|
+
const cells = cubeCovers(cube, n).map(cellOf);
|
|
136
|
+
const rowRuns = runs([...new Set(cells.map((c) => c.gr))]);
|
|
137
|
+
const colRuns = runs([...new Set(cells.map((c) => c.gc))]);
|
|
138
|
+
const out = [];
|
|
139
|
+
for (const [r0, r1] of rowRuns) for (const [c0, c1] of colRuns) out.push({
|
|
140
|
+
x: cellX(c0),
|
|
141
|
+
y: cellY(r0),
|
|
142
|
+
w: (c1 - c0 + 1) * CS,
|
|
143
|
+
h: (r1 - r0 + 1) * CS
|
|
144
|
+
});
|
|
145
|
+
return out;
|
|
146
|
+
};
|
|
147
|
+
const shownGroups = mode === "simplify" ? (revealed ? result.cover : groups).map((cube, i) => ({
|
|
148
|
+
cube,
|
|
149
|
+
color: PALETTE[i % PALETTE.length]
|
|
150
|
+
})) : result.cover.map((cube, i) => ({
|
|
151
|
+
cube,
|
|
152
|
+
color: PALETTE[i % PALETTE.length]
|
|
153
|
+
}));
|
|
154
|
+
const tapCell = (m) => {
|
|
155
|
+
if (mode !== "simplify" || revealed) return;
|
|
156
|
+
if (!oneSet.has(m) && !dcSet.has(m)) return;
|
|
157
|
+
setSelected((s) => s.includes(m) ? s.filter((x) => x !== m) : [...s, m]);
|
|
158
|
+
};
|
|
159
|
+
const currentCube = selected.length ? cubeOfSelection(selected, n) : null;
|
|
160
|
+
const currentValid = currentCube !== null && cubeCovers(currentCube, n).every((m) => oneSet.has(m) || dcSet.has(m));
|
|
161
|
+
const addGroup = () => {
|
|
162
|
+
if (currentValid && currentCube) {
|
|
163
|
+
setGroups((g) => [...g, currentCube]);
|
|
164
|
+
setSelected([]);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const covered = /* @__PURE__ */ new Set();
|
|
168
|
+
for (const g of groups) for (const m of cubeCovers(g, n)) covered.add(m);
|
|
169
|
+
const allCovered = minterms.every((m) => covered.has(m));
|
|
170
|
+
const minimal = allCovered && groups.length === result.cover.length;
|
|
171
|
+
useCheckpoint({
|
|
172
|
+
solved: mode === "simplify" ? allCovered : false,
|
|
173
|
+
activity: `kmap:${title}`,
|
|
174
|
+
hintsUsed: hints.count,
|
|
175
|
+
score: {
|
|
176
|
+
raw: minimal ? 1 : .85,
|
|
177
|
+
max: 1
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
useControlSurface(controlId, {
|
|
181
|
+
reveal: {
|
|
182
|
+
type: "action",
|
|
183
|
+
label: "reveal minimal cover",
|
|
184
|
+
invoke: () => setRevealed(true)
|
|
185
|
+
},
|
|
186
|
+
reset: {
|
|
187
|
+
type: "action",
|
|
188
|
+
label: "clear groups",
|
|
189
|
+
invoke: () => {
|
|
190
|
+
setGroups([]);
|
|
191
|
+
setSelected([]);
|
|
192
|
+
setRevealed(false);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
const TexExpr = ({ expr }) => {
|
|
197
|
+
if (expr === "0" || expr === "1") return /* @__PURE__ */ jsx("b", {
|
|
198
|
+
style: { fontSize: 18 },
|
|
199
|
+
children: expr
|
|
200
|
+
});
|
|
201
|
+
const c = compileLogic(expr.replace(/¬/g, "~"));
|
|
202
|
+
return c.ok ? /* @__PURE__ */ jsx(Tex$1, { tex: logicToLatex(c.ast) }) : /* @__PURE__ */ jsx("span", { children: expr });
|
|
203
|
+
};
|
|
204
|
+
const figure = /* @__PURE__ */ jsxs("svg", {
|
|
205
|
+
viewBox: `0 0 ${W} ${H}`,
|
|
206
|
+
style: {
|
|
207
|
+
width: "100%",
|
|
208
|
+
maxWidth: W,
|
|
209
|
+
height: "auto"
|
|
210
|
+
},
|
|
211
|
+
role: "img",
|
|
212
|
+
"aria-label": `Karnaugh map of ${vars.join(",")}, ${minterms.length} ones`,
|
|
213
|
+
children: [
|
|
214
|
+
/* @__PURE__ */ jsx("text", {
|
|
215
|
+
x: LH + gridW / 2,
|
|
216
|
+
y: 16,
|
|
217
|
+
textAnchor: "middle",
|
|
218
|
+
fontSize: 13,
|
|
219
|
+
fontWeight: 700,
|
|
220
|
+
fill: "var(--stage-muted)",
|
|
221
|
+
children: colVars.join("")
|
|
222
|
+
}),
|
|
223
|
+
/* @__PURE__ */ jsx("text", {
|
|
224
|
+
x: 14,
|
|
225
|
+
y: TH + gridH / 2,
|
|
226
|
+
textAnchor: "middle",
|
|
227
|
+
fontSize: 13,
|
|
228
|
+
fontWeight: 700,
|
|
229
|
+
fill: "var(--stage-muted)",
|
|
230
|
+
transform: `rotate(-90 14 ${TH + gridH / 2})`,
|
|
231
|
+
children: rowVars.join("")
|
|
232
|
+
}),
|
|
233
|
+
Array.from({ length: nCols }, (_, gc) => /* @__PURE__ */ jsx("text", {
|
|
234
|
+
x: cellX(gc) + CS / 2,
|
|
235
|
+
y: TH - 8,
|
|
236
|
+
textAnchor: "middle",
|
|
237
|
+
fontSize: 13,
|
|
238
|
+
fontWeight: 700,
|
|
239
|
+
fill: "var(--stage-fg)",
|
|
240
|
+
fontFamily: "ui-monospace, monospace",
|
|
241
|
+
children: bits(gray(gc), colBits)
|
|
242
|
+
}, `ch${gc}`)),
|
|
243
|
+
Array.from({ length: nRows }, (_, gr) => /* @__PURE__ */ jsx("text", {
|
|
244
|
+
x: LH - 10,
|
|
245
|
+
y: cellY(gr) + CS / 2,
|
|
246
|
+
textAnchor: "end",
|
|
247
|
+
dominantBaseline: "central",
|
|
248
|
+
fontSize: 13,
|
|
249
|
+
fontWeight: 700,
|
|
250
|
+
fill: "var(--stage-fg)",
|
|
251
|
+
fontFamily: "ui-monospace, monospace",
|
|
252
|
+
children: bits(gray(gr), rowBits)
|
|
253
|
+
}, `rh${gr}`)),
|
|
254
|
+
Array.from({ length: nRows }, (_, gr) => Array.from({ length: nCols }, (_, gc) => {
|
|
255
|
+
const m = mintermAt(gr, gc);
|
|
256
|
+
const isOne = oneSet.has(m), isDC = dcSet.has(m);
|
|
257
|
+
const sel = mode === "simplify" && selected.includes(m);
|
|
258
|
+
const val = isOne ? "1" : isDC ? "X" : "0";
|
|
259
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
260
|
+
onClick: () => tapCell(m),
|
|
261
|
+
style: { cursor: mode === "simplify" && (isOne || isDC) && !revealed ? "pointer" : "default" },
|
|
262
|
+
children: [
|
|
263
|
+
/* @__PURE__ */ jsx("rect", {
|
|
264
|
+
x: cellX(gc),
|
|
265
|
+
y: cellY(gr),
|
|
266
|
+
width: CS,
|
|
267
|
+
height: CS,
|
|
268
|
+
fill: sel ? "color-mix(in oklab, var(--stage-good) 24%, transparent)" : isOne ? "color-mix(in oklab, var(--stage-good) 9%, transparent)" : "var(--stage-bg)",
|
|
269
|
+
stroke: "var(--stage-grid)",
|
|
270
|
+
strokeWidth: 1
|
|
271
|
+
}),
|
|
272
|
+
/* @__PURE__ */ jsx("text", {
|
|
273
|
+
x: cellX(gc) + CS / 2,
|
|
274
|
+
y: cellY(gr) + CS / 2,
|
|
275
|
+
textAnchor: "middle",
|
|
276
|
+
dominantBaseline: "central",
|
|
277
|
+
fontSize: 17,
|
|
278
|
+
fontWeight: 800,
|
|
279
|
+
fill: isOne ? "var(--stage-good)" : isDC ? "var(--stage-warn)" : "var(--stage-muted)",
|
|
280
|
+
style: { pointerEvents: "none" },
|
|
281
|
+
children: val
|
|
282
|
+
}),
|
|
283
|
+
/* @__PURE__ */ jsx("text", {
|
|
284
|
+
x: cellX(gc) + CS - 4,
|
|
285
|
+
y: cellY(gr) + 11,
|
|
286
|
+
textAnchor: "end",
|
|
287
|
+
fontSize: 8.5,
|
|
288
|
+
fill: "var(--stage-muted)",
|
|
289
|
+
style: { pointerEvents: "none" },
|
|
290
|
+
fontFamily: "ui-monospace, monospace",
|
|
291
|
+
children: m
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
}, `c${gr}-${gc}`);
|
|
295
|
+
})),
|
|
296
|
+
shownGroups.map(({ cube, color }, gi) => loopsFor(cube).map((r, ri) => {
|
|
297
|
+
const inset = 4 + gi % 3 * 4;
|
|
298
|
+
return /* @__PURE__ */ jsx("rect", {
|
|
299
|
+
x: r.x + inset,
|
|
300
|
+
y: r.y + inset,
|
|
301
|
+
width: r.w - inset * 2,
|
|
302
|
+
height: r.h - inset * 2,
|
|
303
|
+
rx: 12,
|
|
304
|
+
fill: "none",
|
|
305
|
+
stroke: color,
|
|
306
|
+
strokeWidth: 3,
|
|
307
|
+
opacity: .95
|
|
308
|
+
}, `g${gi}-${ri}`);
|
|
309
|
+
})),
|
|
310
|
+
mode === "simplify" && currentCube && currentValid && loopsFor(currentCube).map((r, ri) => /* @__PURE__ */ jsx("rect", {
|
|
311
|
+
x: r.x + 3,
|
|
312
|
+
y: r.y + 3,
|
|
313
|
+
width: r.w - 6,
|
|
314
|
+
height: r.h - 6,
|
|
315
|
+
rx: 12,
|
|
316
|
+
fill: "none",
|
|
317
|
+
stroke: "var(--stage-fg)",
|
|
318
|
+
strokeWidth: 2.5,
|
|
319
|
+
strokeDasharray: "6 5"
|
|
320
|
+
}, `cur${ri}`))
|
|
321
|
+
]
|
|
322
|
+
});
|
|
323
|
+
return /* @__PURE__ */ jsx(LabFrame, {
|
|
324
|
+
title,
|
|
325
|
+
prompt,
|
|
326
|
+
objectives,
|
|
327
|
+
aside: /* @__PURE__ */ jsx(Fragment$1, { children: mode === "show" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
328
|
+
/* @__PURE__ */ jsx("p", {
|
|
329
|
+
style: {
|
|
330
|
+
fontWeight: 700,
|
|
331
|
+
margin: "0 0 6px"
|
|
332
|
+
},
|
|
333
|
+
children: "Minimal form"
|
|
334
|
+
}),
|
|
335
|
+
/* @__PURE__ */ jsx("div", {
|
|
336
|
+
style: {
|
|
337
|
+
fontSize: 18,
|
|
338
|
+
padding: "8px 12px",
|
|
339
|
+
borderRadius: 10,
|
|
340
|
+
background: "color-mix(in oklab, var(--stage-good) 10%, transparent)"
|
|
341
|
+
},
|
|
342
|
+
children: /* @__PURE__ */ jsx(TexExpr, { expr: result.expression })
|
|
343
|
+
}),
|
|
344
|
+
/* @__PURE__ */ jsxs("p", {
|
|
345
|
+
style: {
|
|
346
|
+
fontSize: 13,
|
|
347
|
+
color: "var(--stage-muted)",
|
|
348
|
+
marginTop: 8
|
|
349
|
+
},
|
|
350
|
+
children: [
|
|
351
|
+
result.cover.length,
|
|
352
|
+
" group",
|
|
353
|
+
result.cover.length === 1 ? "" : "s",
|
|
354
|
+
" cover",
|
|
355
|
+
result.cover.length === 1 ? "s" : "",
|
|
356
|
+
" ",
|
|
357
|
+
minterms.length,
|
|
358
|
+
" one",
|
|
359
|
+
minterms.length === 1 ? "" : "s",
|
|
360
|
+
". Each loop drops the variable that flips across it."
|
|
361
|
+
]
|
|
362
|
+
})
|
|
363
|
+
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
364
|
+
/* @__PURE__ */ jsx("p", {
|
|
365
|
+
style: {
|
|
366
|
+
fontWeight: 700,
|
|
367
|
+
margin: "0 0 6px"
|
|
368
|
+
},
|
|
369
|
+
children: "Your groups"
|
|
370
|
+
}),
|
|
371
|
+
groups.length === 0 && /* @__PURE__ */ jsx("p", {
|
|
372
|
+
style: {
|
|
373
|
+
fontSize: 13,
|
|
374
|
+
color: "var(--stage-muted)"
|
|
375
|
+
},
|
|
376
|
+
children: "Tap adjacent 1s to draw a group (size 1, 2, 4, 8…). Wrapping around edges is allowed."
|
|
377
|
+
}),
|
|
378
|
+
/* @__PURE__ */ jsx("ul", {
|
|
379
|
+
style: {
|
|
380
|
+
margin: "4px 0",
|
|
381
|
+
paddingLeft: 18
|
|
382
|
+
},
|
|
383
|
+
children: groups.map((g, i) => /* @__PURE__ */ jsx("li", {
|
|
384
|
+
style: { color: PALETTE[i % PALETTE.length] },
|
|
385
|
+
children: /* @__PURE__ */ jsx(TexExpr, { expr: cubeTerm(g, vars) })
|
|
386
|
+
}, i))
|
|
387
|
+
}),
|
|
388
|
+
selected.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
389
|
+
style: {
|
|
390
|
+
fontSize: 13,
|
|
391
|
+
marginTop: 6
|
|
392
|
+
},
|
|
393
|
+
children: ["Selection: ", currentValid ? /* @__PURE__ */ jsxs(Fragment$1, { children: ["valid group → ", /* @__PURE__ */ jsx("b", { children: /* @__PURE__ */ jsx(TexExpr, { expr: cubeTerm(currentCube, vars) }) })] }) : /* @__PURE__ */ jsx("span", {
|
|
394
|
+
style: { color: "var(--stage-bad)" },
|
|
395
|
+
children: "not a legal group (need a power-of-two block of 1s)"
|
|
396
|
+
})]
|
|
397
|
+
}),
|
|
398
|
+
/* @__PURE__ */ jsxs("div", {
|
|
399
|
+
className: "lab-bar",
|
|
400
|
+
style: {
|
|
401
|
+
gap: 8,
|
|
402
|
+
marginTop: 8
|
|
403
|
+
},
|
|
404
|
+
children: [
|
|
405
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
406
|
+
selected: false,
|
|
407
|
+
onClick: addGroup,
|
|
408
|
+
children: "add group"
|
|
409
|
+
}),
|
|
410
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
411
|
+
selected: false,
|
|
412
|
+
onClick: () => setSelected([]),
|
|
413
|
+
children: "clear pick"
|
|
414
|
+
}),
|
|
415
|
+
/* @__PURE__ */ jsx(Chip, {
|
|
416
|
+
selected: false,
|
|
417
|
+
onClick: () => {
|
|
418
|
+
setGroups([]);
|
|
419
|
+
setSelected([]);
|
|
420
|
+
setRevealed(false);
|
|
421
|
+
},
|
|
422
|
+
children: "reset"
|
|
423
|
+
})
|
|
424
|
+
]
|
|
425
|
+
}),
|
|
426
|
+
allCovered && /* @__PURE__ */ jsx("p", {
|
|
427
|
+
className: "lab-pill",
|
|
428
|
+
"data-state": "ok",
|
|
429
|
+
style: { marginTop: 8 },
|
|
430
|
+
children: minimal ? "✓ all ones covered — minimal!" : `✓ covered, but minimal is ${result.cover.length} group${result.cover.length === 1 ? "" : "s"}`
|
|
431
|
+
})
|
|
432
|
+
] }) }),
|
|
433
|
+
footer: /* @__PURE__ */ jsxs(Fragment$1, { children: [mode === "simplify" && /* @__PURE__ */ jsx(RevealSolution, {
|
|
434
|
+
available: !allCovered || !minimal,
|
|
435
|
+
buttonLabel: "Show minimal cover",
|
|
436
|
+
solution: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
437
|
+
"The minimal SOP is ",
|
|
438
|
+
/* @__PURE__ */ jsx(TexExpr, { expr: result.expression }),
|
|
439
|
+
" — ",
|
|
440
|
+
result.cover.length,
|
|
441
|
+
" group",
|
|
442
|
+
result.cover.length === 1 ? "" : "s",
|
|
443
|
+
"."
|
|
444
|
+
] }),
|
|
445
|
+
onReveal: () => setRevealed(true)
|
|
446
|
+
}), /* @__PURE__ */ jsx(HintLadder, { hints })] }),
|
|
447
|
+
children: figure
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
//#endregion
|
|
452
|
+
export { KarnaughMapLab };
|