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/P020-JFGIA79w.js.map
{"version":3,"file":"P020-JFGIA79w.js","sources":["../../src/exercices/profs/P020.js"],"sourcesContent":["import { choice, shuffle } from '../../lib/outils/arrayOutils'\nimport Exercice from '../Exercice.js'\nimport { contraindreValeur, listeQuestionsToContenu } from '../../modules/outils.js'\nimport { tableauColonneLigne } from '../../lib/2d/tableau.js'\nexport const titre = 'Text encoder'\nexport const ref = 'P020'\nexport const uuid = 'de353'\nexport default function EncodeurTexte (type = 'générateur') {\n  Exercice.call(this)\n  this.introduction = 'Generator inspired by the DefiTableTexte command from Christophe Poulain\\'s ProfCollege package.'\n  this.consigne = 'Choose a text to encode in the form as a parameter.'\n  this.besoinFormulaireTexte = ['Text to encode (list of words or sentences separated by /']\n  this.besoinFormulaire2CaseACocher = ['Different grid for each piece', false]\n  this.sup = 'mathematics'\n  this.sup2 = false\n  this.nbQuestions = 1\n  this.besoinCorrection = false\n\n  const tableauDesCaracteres = Array.from('-xçwjè,k~:aq«rlgdmftbéocsà.êeipzhu\\'ynvî»â!')\n  tableauDesCaracteres[2] = 'ç'\n  const enteteColonnes = ['×', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']\n  for (let i = 0; i < enteteColonnes.length; i++) {\n    enteteColonnes[i] = `\\\\colorbox{lightgrey}{${enteteColonnes[i]}}`\n  }\n  const enteteLignes = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']\n  for (let i = 0; i < enteteLignes.length; i++) {\n    enteteLignes[i] = `\\\\colorbox{lightgrey}{${enteteLignes[i]}}`\n  }\n  function produitPourCaractere (car, map) {\n    const liste = map.entries()\n    for (const paire of liste) {\n      if (paire[1] === car) return paire[0]\n    }\n    return NaN\n  }\n  this.nouvelleVersion = function () {\n    const listeDeMots = ['mathematics', 'divider', 'multiple', 'mediator', 'medium', 'parallel', 'perpendicular', 'multiplication', 'addition',\n      'substraction', 'division', 'addition', 'circle', 'histogram', 'diagram', 'numeration', 'fraction', 'equality', 'property', 'counter-example']\n    const listeDePhrases = ['Mathematics\\'s fantastic', 'multiply and divide/is done before/add or subtract',\n      'to be greater/than a number means/to be greater than this number', 'It is always necessary to/check the consistency/of its results',\n      'To draw / lines or segments / we use a ruler', 'To draw perpendicular lines/use your square']\n    this.sup3 = contraindreValeur(1, 3, this.sup3, 1)\n    this.listeQuestions = []\n    this.listeCorrections = []\n    if (type === 'exo') {\n      switch (this.sup3) {\n        case 1:\n          this.sup = choice(listeDeMots)\n          break\n        case 2:\n          this.sup = choice(listeDePhrases).replaceAll('/', ' ')\n          this.sup2 = false\n          break\n        case 3:\n          this.sup = choice(listeDePhrases)\n          this.sup2 = true\n          break\n      }\n    }\n    const texteAEncoder = this.sup.replaceAll(' ', '~').split('/') // On récupère la saisie du formulaire ou du choix aléatoire si c'est un exo\n    this.nbQuestions = texteAEncoder.length\n    for (let j = 0; j < this.nbQuestions; j++) {\n      texteAEncoder[j] = texteAEncoder[j].toLowerCase()\n    }\n    for (let i = 0, texte, associations, table, positionCourante, tabCar, cpt = 0; i < this.nbQuestions && cpt < 50;) {\n      if (i === 0 || this.sup2) { // on mélange les caractères pour la première question ou à chaque question si sup2=true\n        associations = new Map() // objet qui contiendra des associations : '12' : 'a'\n        table = []\n        positionCourante = 0\n        tabCar = shuffle(tableauDesCaracteres) // On mélange les caractères à disposition pour changer de grille à chaque fois\n        // We initialize the grid (table) of 100 boxes which will contain the characters.\n        for (let j = 0; j < 10; j++) {\n          table[j] = []\n          for (let k = 0, produit; k < 10; k++) {\n            produit = (j + 1) * (k + 1) // La table js est indicée de 0 à 9 donc on ajoute 1 pour avoir le facteur correspondant.\n            if (!associations.has(produit)) { // Ce produit n'est pas déjà associé\n              associations.set(produit, tabCar[positionCourante]) // on lui associe le caractère courant\n              positionCourante++ // On se positionne sur le caractère suivant n'ayant pas encore été assigné\n            }\n            table[j][k] = associations.get(produit) // on ajoute le caractère dans la table.\n          }\n        }\n        texte = `${tableauColonneLigne(enteteColonnes, enteteLignes, table.flat(), 1.3, false)}`\n      } else {\n        texte = ''\n      }\n      texte += '<br><br>Using the table above, decode the following message :<br>'\n      for (let j = 0; j < texteAEncoder[i].length; j++) {\n        texte += `${produitPourCaractere(texteAEncoder[i][j], associations)} `\n      }\n      texte += '<br><br>'\n\n      if (this.questionJamaisPosee(i, texteAEncoder[i], table)) {\n        this.listeQuestions.push(texte)\n        this.listeCorrections.push(texteAEncoder[i].replaceAll('~', ' ').replaceAll('/', ' '))\n        i++\n      }\n      cpt++\n    }\n    listeQuestionsToContenu(this)\n  }\n}\n"],"names":["titre","ref","uuid","EncodeurTexte","type","Exercice","tableauDesCaracteres","enteteColonnes","i","enteteLignes","produitPourCaractere","car","map","liste","paire","listeDeMots","listeDePhrases","contraindreValeur","choice","texteAEncoder","j","texte","associations","table","positionCourante","tabCar","cpt","shuffle","k","produit","tableauColonneLigne","listeQuestionsToContenu"],"mappings":"gHAIY,MAACA,EAAQ,eACRC,EAAM,OACNC,EAAO,QACL,SAASC,EAAeC,EAAO,aAAc,CAC1DC,EAAS,KAAK,IAAI,EAClB,KAAK,aAAe,kGACpB,KAAK,SAAW,sDAChB,KAAK,sBAAwB,CAAC,2DAA2D,EACzF,KAAK,6BAA+B,CAAC,gCAAiC,EAAK,EAC3E,KAAK,IAAM,cACX,KAAK,KAAO,GACZ,KAAK,YAAc,EACnB,KAAK,iBAAmB,GAExB,MAAMC,EAAuB,MAAM,KAAK,4CAA6C,EACrFA,EAAqB,CAAC,EAAI,IAC1B,MAAMC,EAAiB,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAI,EAC9E,QAASC,EAAI,EAAGA,EAAID,EAAe,OAAQC,IACzCD,EAAeC,C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