File: /home/mmtprep/public_html/mathzen.mmtprep.com/assets/6N11-5-LUZeAJD3.js.map
{"version":3,"file":"6N11-5-LUZeAJD3.js","sources":["../../src/exercices/6e/6N11-5.js"],"sourcesContent":["import { choice, combinaisonListes } from '../../lib/outils/arrayOutils'\nimport { miseEnEvidence } from '../../lib/outils/embellissements'\nimport { texNombre } from '../../lib/outils/texNombre.js'\nimport Exercice from '../Exercice.js'\nimport { randint, listeQuestionsToContenu } from '../../modules/outils.js'\nexport const titre = 'Compare two integers'\n\nexport const dateDePublication = '07/08/2022'\n\n/**\n * Comparaison de deux nombres entiers avec deux niveaux de difficulté : avec un nombre de chiffres différents et avec le même nombre de chiffres\n * Dans le cas où les nombres ont le même nombre de chiffres, ils ont entre 1 et (max - 1) chiffres identiques\n * @author Guillaume Valmont\n * Référence 6N11-5\n*/\nexport const uuid = 'a7aa7'\nexport const ref = '6N11-5'\nexport default class ComparerDeuxNombresEntiers extends Exercice {\n constructor () {\n super()\n this.titre = titre\n this.consigne = 'Compare :'\n this.nbQuestions = 5\n\n this.besoinFormulaireNumerique = ['Difficulty', 3, '1: With a different number of digits\\n2: With the same number of digits\\n3: Mixture']\n this.sup = 3\n\n this.correctionDetailleeDisponible = true\n this.correctionDetaillee = true\n\n this.spacingCorr = 1.5\n }\n\n nouvelleVersion () {\n this.listeQuestions = []\n this.listeCorrections = []\n this.autoCorrection = []\n\n let typeDeQuestionsDisponibles\n switch (this.sup) {\n case 1:\n typeDeQuestionsDisponibles = ['differentNbOfDigits']\n break\n case 2:\n typeDeQuestionsDisponibles = ['memeNbOfDigits']\n break\n default:\n typeDeQuestionsDisponibles = ['memeNbOfDigits', 'differentNbOfDigits']\n break\n }\n\n const typesDeQuestions = combinaisonListes(typeDeQuestionsDisponibles, this.nbQuestions)\n const nombreDeChiffres = combinaisonListes([3, 4, 5, 8], this.nbQuestions)\n for (let i = 0, texte, texteCorr, a, b, cpt = 0; i < this.nbQuestions && cpt < 50;) {\n switch (typesDeQuestions[i]) {\n case 'differentNbOfDigits': {\n a = randint(10 ** (nombreDeChiffres[i] - 1), 10 ** nombreDeChiffres[i] - 1)\n b = a\n const enleveOuAjoute = choice(['remove', 'adds'])\n const indexEnleveOuAjoute = randint(Math.floor(nombreDeChiffres[i] / 2), nombreDeChiffres[i])\n const premiereMoitie = b.toString().slice(0, indexEnleveOuAjoute)\n const deuxiemeMoitie = b.toString().slice(indexEnleveOuAjoute)\n const chiffreInsere = ((parseInt(b.toString().slice(indexEnleveOuAjoute - 1, indexEnleveOuAjoute)) + 9) % 10).toString()\n b = parseInt(premiereMoitie + chiffreInsere + deuxiemeMoitie)\n if (enleveOuAjoute === 'remove') {\n const c = a\n a = b\n b = c\n }\n break\n }\n case 'memeNbOfDigits': {\n const nbChiffresIdentiques = randint(1, nombreDeChiffres[i] - 1)\n const partieIdentique = randint(10 ** (nbChiffresIdentiques - 1), 10 ** nbChiffresIdentiques - 1)\n const nbChiffresDifferentsPremierNombre = nombreDeChiffres[i] - nbChiffresIdentiques\n const nbChiffresDifferentsDeuxiemeNombre = nombreDeChiffres[i] - nbChiffresIdentiques\n a = partieIdentique * 10 ** nbChiffresDifferentsPremierNombre + randint(10 ** (nbChiffresDifferentsPremierNombre - 1), 10 ** nbChiffresDifferentsPremierNombre - 1)\n b = partieIdentique * 10 ** nbChiffresDifferentsDeuxiemeNombre + randint(10 ** (nbChiffresDifferentsDeuxiemeNombre - 1), 10 ** nbChiffresDifferentsDeuxiemeNombre - 1)\n while (b % 10 === a % 10) {\n b = b - b % 10 + randint(0, 9)\n }\n break\n }\n }\n texte = `$${texNombre(a, 0)}$ and $${texNombre(b, 0)}$`\n texteCorr = ''\n switch (typesDeQuestions[i]) {\n case 'differentNbOfDigits':\n if (this.correctionDetaillee) {\n texteCorr += `$${texNombre(a)}$ counts $${a.toString().length}$ numbers while $${texNombre(b)}$ counts $${b.toString().length}$.<br>`\n if (a > b) {\n texteCorr += `Since $${texNombre(a)}$ has more digits than $${texNombre(b)}$, then $${texNombre(a)}$ is larger than $${texNombre(b)}$.<br>`\n } else {\n texteCorr += `Since $${texNombre(a)}$ has fewer digits than $${texNombre(b)}$, then $${texNombre(a)}$ is smaller than $${texNombre(b)}$.<br>`\n }\n texteCorr += 'We can write it in mathematical language:<br>'\n }\n break\n case 'memeNbOfDigits':\n if (this.correctionDetaillee) {\n const miseEnEvidenceDesChiffresEnCommun = function (premierChiffre, deuxiemeChiffre) {\n let dernierChiffreCommunTrouve = false\n let dernierChiffreCommun\n for (let i = 0; i < premierChiffre.toString().length; i++) {\n if (premierChiffre.toString()[i] === deuxiemeChiffre.toString()[i] && !dernierChiffreCommunTrouve) {\n texteCorr += `$${miseEnEvidence(premierChiffre.toString()[i])}$`\n } else {\n if (!dernierChiffreCommunTrouve) dernierChiffreCommun = premierChiffre.toString()[i]\n dernierChiffreCommunTrouve = true\n texteCorr += `$${premierChiffre.toString()[i]}$`\n }\n }\n texteCorr += '<br>'\n return dernierChiffreCommun\n }\n texteCorr += `$${texNombre(a)}$ and $${texNombre(b)}$ have the same number of digits.<br>`\n texteCorr += 'We look for the first different digit from the left:<br>'\n const dernierChiffreEnCommunPremierNombre = miseEnEvidenceDesChiffresEnCommun(a, b)\n const dernierChiffreEnCommunDeuxiemeNombre = miseEnEvidenceDesChiffresEnCommun(b, a)\n if (a > b) {\n texteCorr += `As $${dernierChiffreEnCommunPremierNombre}$ is greater than $${dernierChiffreEnCommunDeuxiemeNombre}$, then $${texNombre(a)}$ is greater than $${texNombre(b)}$.<br>`\n } else {\n texteCorr += `As $${dernierChiffreEnCommunPremierNombre}$ is smaller than $${dernierChiffreEnCommunDeuxiemeNombre}$, then $${texNombre(a)}$ is smaller than $${texNombre(b)}$.<br>`\n }\n\n texteCorr += 'We can write it in mathematical language:<br>'\n }\n break\n }\n if (a > b) {\n texteCorr += `$${texNombre(a)}$ > $${texNombre(b)}$`\n } else {\n texteCorr += `$${texNombre(a)}$ < $${texNombre(b)}$`\n }\n if (this.correctionDetaillee) texteCorr += '.'\n if (this.questionJamaisPosee(i, texte)) {\n this.listeQuestions.push(texte)\n this.listeCorrections.push(texteCorr)\n i++\n }\n cpt++\n }\n listeQuestionsToContenu(this)\n }\n}\n"],"names":["titre","dateDePublication","uuid","ref","ComparerDeuxNombresEntiers","Exercice","typeDeQuestionsDisponibles","typesDeQuestions","combinaisonListes","nombreDeChiffres","i","texte","texteCorr","a","b","cpt","randint","enleveOuAjoute","choice","indexEnleveOuAjoute","premiereMoitie","deuxiemeMoitie","chiffreInsere","c","nbChiffresIdentiques","partieIdentique","nbChiffresDifferentsPremierNombre","nbChiffresDifferentsDeuxiemeNombre","texNombre","miseEnEvidenceDesChiffresEnCommun","premierChiffre","deuxiemeChiffre","dernierChiffreCommunTrouve","dernierChiffreCommun","miseEnEvidence","dernierChiffreEnCommunPremierNombre","dernierChiffreEnCommunDeuxiemeNombre","listeQuestionsToContenu"],"mappings":"mFAKY,MAACA,EAAQ,uBAERC,EAAoB,aAQpBC,EAAO,QACPC,EAAM,SACJ,MAAMC,UAAmCC,CAAS,CAC/D,aAAe,CACb,MAAO,EACP,KAAK,MAAQL,EACb,KAAK,SAAW,YAChB,KAAK,YAAc,EAEnB,KAAK,0BAA4B,CAAC,aAAc,EAAG;AAAA;AAAA,WAAqF,EACxI,KAAK,IAAM,EAEX,KAAK,8BAAgC,GACrC,KAAK,oBAAsB,GAE3B,KAAK,YAAc,GACpB,CAED,iBAAmB,CACjB,KAAK,eAAiB,CAAE,EACxB,KAAK,iBAAmB,CAAE,EAC1B,KAAK,eAAiB,CAAE,EAExB,IAAIM,EACJ,OAAQ,KAAK,IAAG,CACd,IAAK,GACHA,EAA6B,CAAC,qBAAqB,EACnD,MACF,IAAK,GACHA,EAA6B,CAAC,gBAAgB,EAC9C,MACF,QACEA,EAA6B,CAAC,iBAAkB,qBAAqB,EACrE,KACH,CAED,MAAMC,EAAmBC,EAAkBF,EAA4B,KAAK,WAAW,EACjFG,EAAmBD,EAAkB,CAAC,EAAG,EAAG,EAAG,CAAC,E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