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/5R12-1-fi4FjRSu.js.map
{"version":3,"file":"5R12-1-fi4FjRSu.js","sources":["../../src/exercices/5e/5R12-1.ts"],"sourcesContent":["import Exercice from '../deprecatedExercice.js'\nimport Figure from 'apigeom'\nimport figureApigeom from '../../lib/figureApigeom'\nimport { randint } from '../../modules/outils.js'\nimport type TextByPosition from 'apigeom/src/elements/text/TextByPosition.js'\nimport { context } from '../../modules/context'\n\nexport const titre = 'Place points on the graph'\nexport const dateDePublication = '27/10/2023'\nexport const interactifReady = true\nexport const interactifType = 'custom'\nexport const amcReady = true\nexport const amcType = 'AMCOpen'\n\n/**\n * Placer des points dans un repère\n * @author Rémi Angot\n */\nexport const uuid = '4dadb'\nexport const ref = '5R12-1'\n\n// Type simplifié pour la sauvegarde de la réponse\ntype Coords = { label: string, x: number, y: number }\n\nclass ReperagePointDuPlan extends Exercice {\n  // On déclare des propriétés supplémentaires pour cet exercice afin de pouvoir les réutiliser dans la correction\n  figure!: Figure\n  points: Coords[] = []\n  idApigeom!: string\n  constructor () {\n    super()\n    this.typeExercice = 'simple'\n    this.exoCustomResultat = true // Pour qu'une unique question puisse rapporter plusieurs points\n    this.nbQuestions = 1\n    this.nbQuestionsModifiable = false\n    // Pour un exercice de type simple qui n'utilise pas le champ de réponse\n    this.reponse = ''\n    this.formatChampTexte = 'none'\n  }\n\n  nouvelleVersion (numeroExercice: number): void {\n    this.idApigeom = `apigeomEx${numeroExercice}F0`\n    this.figure = new Figure({ snapGrid: true, xMin: -6.3, yMin: -6.3, width: 378, height: 378 })\n    // De -6.3 à 6.3 donc width = 12.6 * 30 = 378\n    this.figure.create('Grid')\n    this.figure.options.labelAutomaticBeginsWith = 'A' // Les points sont nommés par ordre alphabétique\n    this.figure.options.limitNumberOfElement.set('Point', 4) // On limite le nombre de points à 4\n    this.figure.options.pointDescriptionWithCoordinates = false\n\n    let x1 = randint(-6, -1)\n    let x2 = randint(1, 6, x1)\n    let x3 = randint(-6, 6, [0, x1, x2])\n    let x4 = 0\n    let y1 = randint(-6, -1)\n    let y2 = randint(1, 6, y1)\n    let y3 = randint(-6, 6, [0, y1, y2])\n    let y4 = 0\n    // On mélange en évitant le couple (0,0)\n    while ([[x1, y1], [x2, y2], [x3, y3], [x4, y4]].some(e => e[0] === 0 && e[1] === 0)) {\n      [x1, x2, x3, x4] = [x1, x2, x3, x4].sort(() => Math.random() - 0.5)\n      ;[y1, y2, y3, y4] = [y1, y2, y3, y4].sort(() => Math.random() - 0.5)\n    }\n    this.points = [\n      { label: 'A', x: x1, y: y1 },\n      { label: 'B', x: x2, y: y2 },\n      { label: 'C', x: x3, y: y3 },\n      { label: 'D', x: x4, y: y4 }\n    ]\n    const figureCorr = new Figure({ snapGrid: true, xMin: -7, yMin: -7, width: 420, height: 420, isDynamic: false })\n    figureCorr.create('Grid', { xMin: -6, yMin: -6, xMax: 6, yMax: 6 })\n    for (const coord of this.points) {\n      figureCorr.create('Point', { x: coord.x, y: coord.y, color: 'green', thickness: 3, label: coord.label })\n    }\n    let enonce = 'Place the following points : '\n    enonce += `$A(${x1}\\\\;;\\\\;${y1})$ ; $B(${x2}\\\\;;\\\\;${y2})$ ; $C(${x3}\\\\;;\\\\;${y3})$ et $D(${x4}\\\\;;\\\\;${y4})$.`\n    // this.figure.divButtons = this.figure.addButtons('POINT DRAG REMOVE')\n    this.figure.setToolbar({ tools: ['POINT', 'DRAG', 'REMOVE'], position: 'top' })\n    const emplacementPourFigure = figureApigeom({ exercice: this, idApigeom: this.idApigeom, figure: this.figure })\n    const texteCorr = figureCorr.getStaticHtml()\n\n    if (context.isHtml) {\n      this.question = enonce + emplacementPourFigure\n      this.correction = texteCorr\n    } else {\n      this.question = enonce + `\\n\\n\\\\bigskip\\n\\\\Reperage[Plan,AffichageNom,AffichageGrad,Unitex=0.75,Unitey=0.75]{%\n        -5/0/,0/-5/,5/0/,0/5/%\n        }`\n      this.correction = `\\\\Reperage[Plan,AffichageNom,AffichageGrad,Unitesx=0.75,Unitey=0.75]{%\n        -5/0/,0/-5/,5/0/,0/5/,${x1}/${y1}/A,${x2}/${y2}/B,${x3}/${y3}/C,${x4}/${y4}/D%\n        }`\n    }\n    if (context.isAmc) {\n      this.autoCorrection[0] = {\n        enonce: this.question,\n        propositions: [\n          {\n            texte: '',\n            statut: 1, // OBLIGATOIRE (ici c'est le nombre de lignes du cadre pour la réponse de l'élève sur AMC)\n            sanscadre: true // EE : ce champ est facultatif et permet (si true) de cacher le cadre et les lignes acceptant la réponse de l'élève\n          }\n        ]\n      }\n    }\n  }\n\n  correctionInteractive = () => {\n    this.answers = {}\n    // Sauvegarde de la réponse pour Capytale\n    this.answers[this.idApigeom] = this.figure.json\n    const resultat = [] // Tableau de 'OK' ou de'KO' pour le calcul du score\n    const divFeedback = document.querySelector(`#feedback${this.idApigeom}`)\n    for (const coord of this.points) {\n      const { points, isValid, message } = this.figure.checkCoords({ label: coord.label, x: coord.x, y: coord.y })\n      // Point par point, je vérifie que le label et les coordonnées correspondent\n      if (isValid) {\n        resultat.push('OK')\n      } else {\n        if (divFeedback != null) {\n          divFeedback.innerHTML += message + '<br>'\n        }\n        if (points[0] !== undefined) {\n          const point = points[0]\n          point.color = 'red'\n          point.thickness = 3\n          const textLabel = point.elementTextLabel as TextByPosition\n          // Là aussi je rajoute as TextByPosition car je suis sûr que ce point a un label\n          textLabel.color = 'red'\n        }\n        const pointCorr = this.figure.create('Point', { x: coord.x, y: coord.y, color: 'green', thickness: 3, label: coord.label })\n        const pointCorrLabel = pointCorr.elementTextLabel as TextByPosition\n        pointCorrLabel.color = 'green'\n        resultat.push('KO')\n      }\n    }\n    this.figure.isDynamic = false\n    this.figure.divButtons.style.display = 'none'\n    this.figure.divUserMessage.style.display = 'none'\n    return resultat\n  }\n}\n\nexport default ReperagePointDuPlan\n"],"names":["titre","dateDePublication","interactifReady","interactifType","amcReady","amcType","uuid","ref","ReperagePointDuPlan","Exercice","__publicField","resultat","divFeedback","coord","points","isValid","message","point","textLabel","pointCorrLabel","numeroExercice","Figure","x1","randint","x2","x3","x4","y1","y2","y3","y4","e","figureCorr","enonce","emplacementPourFigure","figureApigeom","texteCorr","context"],"mappings":"qTAOO,MAAMA,EAAQ,4BACRC,EAAoB,aACpBC,EAAkB,GAClBC,EAAiB,SACjBC,EAAW,GACXC,EAAU,UAMVC,EAAO,QACPC,EAAM,SAKnB,MAAMC,UAA4BC,CAAS,CAKzC,aAAe,CACP,QAJRC,EAAA,eACAA,EAAA,cAAmB,CAAA,GACnBA,EAAA,kBA6EAA,EAAA,6BAAwB,IAAM,CAC5B,KAAK,QAAU,GAEf,KAAK,QAAQ,KAAK,SAAS,EAAI,KAAK,OAAO,KAC3C,MAAMC,EAAW,CAAA,EACXC,EAAc,SAAS,cAAc,YAAY,KAAK,SAAS,EAAE,EAC5D,UAAAC,KAAS,KAAK,OAAQ,CAC/B,KAAM,CAAE,OAAAC,EAAQ,QAAAC,EAAS,QAAAC,CAAY,EAAA,KAAK,OAAO,YAAY,CAAE,MAAOH,EAAM,MAAO,EAAGA,EAAM,EAAG,EAAGA,EAAM,EAAG,EAE3G,GAAIE,EACFJ,EAAS,KAAK,IAAI,MACb,CAID,GAHAC,GAAe,OACjBA,EAAY,WAAaI,EAAU,QAEjCF,EAAO,CAAC,IAAM,OAAW,CACrB,MAAAG,EAAQH,EAAO,CAAC,EACtBG,EAAM,MAAQ,MACdA,EAAM,UAAY,EAClB,MAAMC,EAAYD,EAAM,iBAExBC,EAAU,MAAQ,KACpB,CAEA,MAAMC,EADY,KAAK,OAAO,OAAO,QAAS,CAAE,EAAGN,EAAM,EAAG,EAAGA,EAAM,EAAG,MAAO,QAAS,UAAW,EAAG,MAAOA,EAAM,MAAO,EACzF,iBACjCM,E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