HEX
Server: Apache
System: Linux vps.mmtprep.com 4.18.0-477.21.1.el8_8.x86_64 #1 SMP Thu Aug 10 13:51:50 EDT 2023 x86_64
User: mmtprep (1001)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/mmtprep/public_html/mathzen.mmtprep.com/assets/6G43-BC29bY0V.js.map
{"version":3,"file":"6G43-BC29bY0V.js","sources":["../../src/exercices/6e/6G43.js"],"sourcesContent":["import { combinaisonListes } from '../../lib/outils/arrayOutils'\nimport Exercice from '../Exercice.js'\nimport { mathalea2d } from '../../modules/2dGeneralites.js'\nimport { listeQuestionsToContenu, randint } from '../../modules/outils.js'\n\nimport { cube } from '../../modules/3d.js'\nimport { ajouteChampTexteMathLive } from '../../lib/interactif/questionMathLive.js'\nimport { setReponse } from '../../lib/interactif/gestionInteractif.js'\nimport { deuxColonnes } from '../../lib/format/miseEnPage.js'\n\nexport const titre = 'Count the missing cubes or not'\nexport const interactifReady = true\nexport const interactifType = 'mathLive'\nexport const amcType = 'AMCNum'\nexport const amcReady = true\n\n/**\n * Compter des cubes\n * @author Erwan DUPLESSY\n * 6G43\n * mars 2021\n * Source : http://cache.media.education.gouv.fr/file/Geometrie_et_espace/47/1/RA16_C4_MATH_geo_espace_flash_567471.pdf\n * Compter des cubes dans un empilement de cubes\n */\n\nexport const uuid = '5f115'\nexport const ref = '6G43'\nexport default function DenombrerCubes () {\n  Exercice.call(this)\n  this.titre = titre\n  this.nbQuestions = 3 // Ici le nombre de questions\n  this.nbQuestionsModifiable = true // Active le formulaire nombre de questions\n  this.nbCols = 1 // Le nombre de colonnes dans l'énoncé LaTeX\n  this.nbColsCorr = 1// Le nombre de colonne pour la correction LaTeX\n  this.pasDeVersionLatex = false // mettre à true si on ne veut pas de l'exercice dans le générateur LaTeX\n  this.pas_de_version_HMTL = false // mettre à true si on ne veut pas de l'exercice en ligne\n  this.sup = 1 // A décommenter : valeur par défaut d'un premier paramètre\n  this.sup2 = 1 // A décommenter : valeur par défaut d'un deuxième paramètre\n  // this is where the exercise code begins this function creates a copy of the exercise\n  this.nouvelleVersion = function () {\n    this.listeQuestions = [] // tableau contenant la liste des questions\n    this.listeCorrections = []\n    this.autoCorrection = []\n    let typesDeQuestionsDisponibles = [] // tableau à compléter par valeurs possibles des types de questions\n    switch (parseInt(this.sup)) {\n      case 1:\n        typesDeQuestionsDisponibles = [1]\n        break\n      case 2:\n        typesDeQuestionsDisponibles = [2]\n        break\n      case 3:\n        typesDeQuestionsDisponibles = [1, 2]\n        break\n    }\n\n    function empilementCubes (long, larg, hmax) {\n      const tabHauteurs = new Array(larg)\n      for (let i = 0; i < larg; i++) {\n        tabHauteurs[i] = new Array(long)\n      }\n      // First line\n      for (let i = 0; i < larg; i++) {\n        tabHauteurs[i][0] = randint(0, 1)\n      }\n      // second line and following\n      for (let i = 0; i < larg; i++) {\n        for (let j = 1; j < long; j++) {\n          tabHauteurs[i][j] = Math.min(tabHauteurs[i][j - 1] + randint(1, 2), hmax)\n        }\n      }\n      // Last Line Check: not empty.\n      for (let i = 0; i < larg; i++) {\n        tabHauteurs[i][long - 1] = Math.max(2, tabHauteurs[i][long - 1])\n      }\n      // Add the cubes to a one-dimensional array\n      // you have to sort the cubes: x decreasing then y decreasing, then z increasing\n      const lstCoordonneesCubes = []\n      for (let i = larg - 1; i > -1; i = i - 1) {\n        for (let j = long - 1; j > -1; j = j - 1) {\n          for (let k = 0; k < tabHauteurs[i][j]; k++) {\n            lstCoordonneesCubes.push([i, j, k])\n          }\n        }\n      }\n      return lstCoordonneesCubes\n    }\n\n    const listeTypeDeQuestions = combinaisonListes(typesDeQuestionsDisponibles, this.nbQuestions)\n    const longueur = 2 + parseInt(this.sup2) // longueur de l'empilement\n    const largeur = longueur // largeur de l'empilement\n    const hauteur = longueur // hauteur de l'empilement\n\n    for (let q = 0, texte, texteCorr, cpt = 0; q < this.nbQuestions && cpt < 50;) {\n      const objetsCorrection = [] // Idem pour la correction\n      const objetsEnonce = []\n      const objetsEnonce2 = []\n      texte = 'A stack of cubes is shown below from two different angles. <br>' // Nous utilisons souvent cette variable pour construire le texte de la question.\n      texteCorr = '' // Idem pour le texte de la correction.\n\n      let cosa, cosb, sina, sinb\n      const L = empilementCubes(longueur, largeur, hauteur) // crée un empilement aléatoire\n      const alpha1 = 10 // choix de la projection\n      const beta1 = -40// choix de la projection\n      const alpha2 = 35// choix de la projection\n      const beta2 = -20 // choix de la projection\n      for (let i = 0; i < L.length; i++) {\n        objetsEnonce.push(...cube(L[i][0], L[i][1], L[i][2], alpha1, beta1, {}).c2d)\n      }\n\n      for (let i = 0; i < L.length; i++) {\n        objetsEnonce2.push(...cube(L[i][0], L[i][1], L[i][2], alpha2, beta2, {}).c2d)\n      }\n      for (let i = 0; i < L.length; i++) {\n        objetsCorrection.push(...cube(3 * L[i][0], L[i][1], L[i][2], alpha2, beta2, {}).c2d)\n      }\n      cosa = Math.cos(alpha1 * Math.PI / 180)\n      sina = Math.sin(alpha1 * Math.PI / 180)\n      cosb = Math.cos(beta1 * Math.PI / 180)\n      sinb = Math.sin(beta1 * Math.PI / 180)\n      const paramsEnonce = {\n        xmin: -sina * largeur - 0.5,\n        ymin: -0.5,\n        xmax: cosa * longueur + 0.5,\n        ymax: -sina * sinb * longueur - cosa * sinb * largeur + cosb * hauteur + 0.5,\n        pixelsParCm: 20,\n        scale: 0.6,\n        mainlevee: false,\n        style: 'display: inline'\n      }\n\n      cosa = Math.cos(alpha2 * Math.PI / 180)\n      sina = Math.sin(alpha2 * Math.PI / 180)\n      cosb = Math.cos(beta2 * Math.PI / 180)\n      sinb = Math.sin(beta2 * Math.PI / 180)\n      const paramsEnonce2 = {\n        xmin: -sina * largeur - 0.5,\n        ymin: -0.5,\n        xmax: cosa * longueur + 0.5,\n        ymax: -sina * sinb * longueur - cosa * sinb * largeur + cosb * hauteur + 0.5,\n        pixelsParCm: 20,\n        scale: 0.6,\n        mainlevee: false,\n        style: 'display: inline'\n      }\n      const paramsCorrection = {\n        xmin: -sina * largeur - 0.5,\n        ymin: -0.5,\n        xmax: cosa * longueur * 3 + 0.5,\n        ymax: -sina * sinb * longueur * 1.5 - cosa * sinb * largeur + cosb * hauteur * 1.5 + 0.5,\n        pixelsParCm: 20,\n        scale: 0.6,\n        mainlevee: false,\n        style: 'display: inline'\n      }\n      // start of the exercise\n      switch (listeTypeDeQuestions[q]) {\n        case 1:\n          texte += 'How many small cubes does this stack of cubes contain?' + ajouteChampTexteMathLive(this, q, 'width10 inline')\n          texte += '<br>' + deuxColonnes(mathalea2d(paramsEnonce, objetsEnonce), mathalea2d(paramsEnonce2, objetsEnonce2))\n          // correction :\n          texteCorr += 'We can represent the stacking by slices: <br>'\n          texteCorr += mathalea2d(paramsCorrection, objetsCorrection) + '<br>'\n          texteCorr += `There are total ${L.length} cubes.`\n          setReponse(this, q, L.length)\n          break\n        case 2:\n          texte += `How many small cubes are missing to reconstruct a large cube of side ${longueur}?` + ajouteChampTexteMathLive(this, q, 'width10 inline')\n          texte += '<br>' + deuxColonnes(mathalea2d(paramsEnonce, objetsEnonce), mathalea2d(paramsEnonce, objetsEnonce2)) + '<br>'\n          // correction :\n          texteCorr += 'We can, for example, represent the stacking by slices: <br>'\n          texteCorr += mathalea2d(paramsCorrection, objetsCorrection) + '<br>'\n          texteCorr += `There are total $${L.length}$ cubes. We want $${longueur}\\\\times ${largeur} \\\\times ${hauteur} = ${longueur * largeur * hauteur}$. <br>`\n          texteCorr += `$${longueur * largeur * hauteur - L.length}$ cubes are missing.`\n          setReponse(this, q, longueur * largeur * hauteur - L.length)\n          break\n      }\n      if (this.listeQuestions.indexOf(texte) === -1) {\n        // If the question has never been asked, we store it in the list of questions\n        this.listeQuestions.push(texte)\n        this.listeCorrections.push(texteCorr)\n        q++\n      }\n      cpt++\n    }\n    listeQuestionsToContenu(this) // On envoie l'exercice à la fonction de mise en page\n  }\n  // If the following variables are defined, they cause the corresponding parameter forms to be displayed\n  // They can be of 3 types: _numeric, _checkbox_or _text.\n  // They are associated respectively with the sup, sup2 and sup3 parameters.\n\n  this.besoinFormulaireNumerique = ['Type of questions', 3, '1: Count the cubes\\n2: Count the missing cubes\\n3: Mix']\n  this.besoinFormulaire2Numerique = ['Stack Size', 5, 'Size 3\\nSize 4\\nSize 5\\nSize 6\\nSize 7']\n  // this.needForm3BoxCheck =['freehand figure',true]\n} // Fin de l'exercice.\n"],"names":["titre","interactifReady","interactifType","amcType","amcReady","uuid","ref","DenombrerCubes","Exercice","typesDeQuestionsDisponibles","empilementCubes","long","larg","hmax","tabHauteurs","i","randint","j","lstCoordonneesCubes","k","listeTypeDeQuestions","combinaisonListes","longueur","largeur","hauteur","q","texte","texteCorr","cpt","objetsCorrection","objetsEnonce","objetsEnonce2","cosa","cosb","sina","sinb","L","alpha1","beta1","alpha2","beta2","cube","paramsEnonce","paramsEnonce2","paramsCorrection","ajouteChampTexteMathLive","deuxColonnes","mathalea2d","setReponse","listeQuestionsToContenu"],"mappings":"qMAUY,MAACA,EAAQ,iCACRC,EAAkB,GAClBC,EAAiB,WACjBC,EAAU,SACVC,EAAW,GAWXC,EAAO,QACPC,EAAM,OACJ,SAASC,GAAkB,CACxCC,EAAS,KAAK,IAAI,EAClB,KAAK,MAAQR,EACb,KAAK,YAAc,EACnB,KAAK,sBAAwB,GAC7B,KAAK,OAAS,EACd,KAAK,WAAa,EAClB,KAAK,kBAAoB,GACzB,KAAK,oBAAsB,GAC3B,KAAK,IAAM,EACX,KAAK,KAAO,EAEZ,KAAK,gBAAkB,UAAY,CACjC,KAAK,eAAiB,CAAE,EACxB,KAAK,iBAAmB,CAAE,EAC1B,KAAK,eAAiB,CAAE,EACxB,IAAIS,EAA8B,CAAE,EACpC,OAAQ,SAAS,KAAK,GAAG,EAAC,CACxB,IAAK,GACHA,EAA8B,CAAC,CAAC,EAChC,MACF,IAAK,GACHA,EAA8B,CAAC,CAAC,EAChC,MACF,IAAK,GACHA,EAA8B,CAAC,EAAG,CAAC,EACnC,KACH,CAED,SAASC,EAAiBC,EAAMC,EAAMC,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