math-exercises 3.0.53 → 3.0.54

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.
Files changed (131) hide show
  1. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.js +3 -5
  3. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts +8 -3
  4. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts.map +1 -1
  5. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +53 -28
  6. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
  7. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +3 -0
  8. package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.d.ts +2 -2
  9. package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.d.ts.map +1 -1
  10. package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.js +52 -25
  11. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.d.ts +2 -2
  12. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.d.ts.map +1 -1
  13. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.js +50 -33
  14. package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.d.ts +2 -1
  15. package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.d.ts.map +1 -1
  16. package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.js +37 -17
  17. package/lib/exercises/math/geometry/angles/recognizeAngleType.d.ts.map +1 -1
  18. package/lib/exercises/math/geometry/angles/recognizeAngleType.js +33 -12
  19. package/lib/exercises/math/geometry/areas/circleArea.d.ts.map +1 -1
  20. package/lib/exercises/math/geometry/areas/circleArea.js +45 -2
  21. package/lib/exercises/math/geometry/areas/squareArea.d.ts.map +1 -1
  22. package/lib/exercises/math/geometry/areas/squareArea.js +40 -7
  23. package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
  24. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.d.ts.map +1 -1
  25. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.js +52 -7
  26. package/lib/exercises/math/geometry/cartesian/cartesianFromTwoPoints.js +1 -1
  27. package/lib/exercises/math/geometry/cartesian/cartesianFromVectorAndPoint.js +1 -1
  28. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts.map +1 -1
  29. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.js +55 -11
  30. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts.map +1 -1
  31. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.js +20 -1
  32. package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.d.ts +9 -0
  33. package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.d.ts.map +1 -0
  34. package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.js +115 -0
  35. package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.d.ts +3 -2
  36. package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.d.ts.map +1 -1
  37. package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.js +36 -27
  38. package/lib/exercises/math/geometry/lines/drawLineFromPointAndVector.d.ts +10 -0
  39. package/lib/exercises/math/geometry/lines/drawLineFromPointAndVector.d.ts.map +1 -0
  40. package/lib/exercises/math/geometry/lines/drawLineFromPointAndVector.js +123 -0
  41. package/lib/exercises/math/geometry/lines/findParallelLineFromCartesianEquation.d.ts +12 -0
  42. package/lib/exercises/math/geometry/lines/findParallelLineFromCartesianEquation.d.ts.map +1 -0
  43. package/lib/exercises/math/geometry/lines/findParallelLineFromCartesianEquation.js +130 -0
  44. package/lib/exercises/math/geometry/lines/findParallelLineFromReductEquation.d.ts +10 -0
  45. package/lib/exercises/math/geometry/lines/findParallelLineFromReductEquation.d.ts.map +1 -0
  46. package/lib/exercises/math/geometry/lines/findParallelLineFromReductEquation.js +109 -0
  47. package/lib/exercises/math/geometry/lines/index.d.ts +5 -0
  48. package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
  49. package/lib/exercises/math/geometry/lines/index.js +5 -1
  50. package/lib/exercises/math/geometry/perimeters/circleCircumference.d.ts.map +1 -1
  51. package/lib/exercises/math/geometry/perimeters/circleCircumference.js +58 -9
  52. package/lib/exercises/math/geometry/perimeters/rectanglePerimeter.d.ts.map +1 -1
  53. package/lib/exercises/math/geometry/perimeters/rectanglePerimeter.js +39 -6
  54. package/lib/exercises/math/geometry/perimeters/squarePerimeter.d.ts.map +1 -1
  55. package/lib/exercises/math/geometry/perimeters/squarePerimeter.js +40 -5
  56. package/lib/exercises/math/geometry/perimeters/trianglePerimeter.d.ts.map +1 -1
  57. package/lib/exercises/math/geometry/perimeters/trianglePerimeter.js +34 -7
  58. package/lib/exercises/math/geometry/pythagore/pythagore.d.ts.map +1 -1
  59. package/lib/exercises/math/geometry/pythagore/pythagore.js +51 -15
  60. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts.map +1 -1
  61. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +109 -19
  62. package/lib/exercises/math/geometry/thales/thales.d.ts.map +1 -1
  63. package/lib/exercises/math/geometry/thales/thales.js +36 -5
  64. package/lib/exercises/math/geometry/triangles/triangleNature.d.ts.map +1 -1
  65. package/lib/exercises/math/geometry/triangles/triangleNature.js +45 -14
  66. package/lib/exercises/math/geometry/vectors/colinearity.d.ts +5 -4
  67. package/lib/exercises/math/geometry/vectors/colinearity.d.ts.map +1 -1
  68. package/lib/exercises/math/geometry/vectors/colinearity.js +82 -21
  69. package/lib/exercises/math/geometry/vectors/findCoordForAligment.d.ts +2 -0
  70. package/lib/exercises/math/geometry/vectors/findCoordForAligment.d.ts.map +1 -0
  71. package/lib/exercises/math/geometry/vectors/findCoordForAligment.js +92 -0
  72. package/lib/exercises/math/powers/calculatePower.d.ts.map +1 -1
  73. package/lib/exercises/math/powers/calculatePower.js +63 -6
  74. package/lib/exercises/math/powers/powerDefinition.d.ts.map +1 -1
  75. package/lib/exercises/math/powers/powerDefinition.js +39 -8
  76. package/lib/exercises/math/powers/powersOfTenToDecimal.d.ts.map +1 -1
  77. package/lib/exercises/math/powers/powersOfTenToDecimal.js +2 -1
  78. package/lib/exercises/math/powers/powersPower.d.ts +5 -2
  79. package/lib/exercises/math/powers/powersPower.d.ts.map +1 -1
  80. package/lib/exercises/math/powers/powersPower.js +59 -28
  81. package/lib/exercises/math/trigonometry/calculateCosSinAndTan.d.ts.map +1 -1
  82. package/lib/exercises/math/trigonometry/calculateCosSinAndTan.js +21 -0
  83. package/lib/exercises/math/trigonometry/mainRemarkableValues.d.ts.map +1 -1
  84. package/lib/exercises/math/trigonometry/mainRemarkableValues.js +1 -1
  85. package/lib/exercises/math/trigonometry/remarkableValues.d.ts.map +1 -1
  86. package/lib/exercises/math/trigonometry/remarkableValues.js +3 -0
  87. package/lib/index.d.ts +34 -13
  88. package/lib/index.d.ts.map +1 -1
  89. package/lib/math/geometry/angle.d.ts.map +1 -1
  90. package/lib/math/geometry/angle.js +12 -7
  91. package/lib/math/geometry/line.d.ts +2 -8
  92. package/lib/math/geometry/line.d.ts.map +1 -1
  93. package/lib/math/geometry/line.js +51 -29
  94. package/lib/math/geometry/point.d.ts +2 -1
  95. package/lib/math/geometry/point.d.ts.map +1 -1
  96. package/lib/math/geometry/point.js +3 -0
  97. package/lib/math/geometry/segment.js +1 -1
  98. package/lib/math/geometry/triangles/triangle.d.ts.map +1 -1
  99. package/lib/math/geometry/triangles/triangle.js +11 -11
  100. package/lib/math/geometry/vector.d.ts +1 -0
  101. package/lib/math/geometry/vector.d.ts.map +1 -1
  102. package/lib/math/geometry/vector.js +12 -3
  103. package/lib/math/systems/generalSystem.d.ts +12 -1
  104. package/lib/math/systems/generalSystem.d.ts.map +1 -1
  105. package/lib/math/systems/generalSystem.js +92 -55
  106. package/lib/math/trigonometry/remarkableValue.d.ts.map +1 -1
  107. package/lib/math/trigonometry/remarkableValue.js +1 -1
  108. package/lib/playground.d.ts.map +1 -1
  109. package/lib/playground.js +1 -15
  110. package/lib/server.js +1 -1
  111. package/lib/tree/nodes/algebraicNode.d.ts +0 -1
  112. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  113. package/lib/tree/nodes/equations/equalNode.d.ts +1 -1
  114. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  115. package/lib/tree/nodes/equations/equalNode.js +1 -1
  116. package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
  117. package/lib/tree/nodes/functions/cosNode.js +11 -5
  118. package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
  119. package/lib/tree/nodes/functions/sinNode.js +11 -5
  120. package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -1
  121. package/lib/tree/nodes/functions/tanNode.js +11 -5
  122. package/lib/tree/nodes/node.d.ts +8 -8
  123. package/lib/tree/nodes/node.d.ts.map +1 -1
  124. package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
  125. package/lib/tree/nodes/nodeConstructor.js +1 -1
  126. package/lib/tree/nodes/operators/fractionNode.js +2 -2
  127. package/lib/tree/nodes/operators/multiplyNode.js +1 -1
  128. package/lib/tree/nodes/operators/powerNode.d.ts +4 -4
  129. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  130. package/lib/tree/nodes/operators/powerNode.js +5 -5
  131. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"mentalAddAndSub.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalAddAndSub.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAkEF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAWjD,CAAC"}
1
+ {"version":3,"file":"mentalAddAndSub.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalAddAndSub.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA8DF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAWjD,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
3
4
  import { randint } from "../../../../math/utils/random/randint.js";
4
5
  import { round } from "../../../../math/utils/round.js";
5
6
  import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
@@ -50,11 +51,8 @@ const getPropositions = (n, { answer, numbers }) => {
50
51
  }
51
52
  return shuffle(propositions);
52
53
  };
53
- const isAnswerValid = (studentAns, { numbers }) => {
54
- const sum = numbers.reduce((acc, curr) => acc + curr);
55
- const answerTree = new NumberNode(round(sum, 2));
56
- const texs = answerTree.toAllValidTexs();
57
- return texs.includes(studentAns);
54
+ const isAnswerValid = (ans, { answer, numbers }) => {
55
+ return numberVEA(ans, answer);
58
56
  };
59
57
  export const mentalAddAndSub = {
60
58
  id: "mentalAddAndSub",
@@ -1,8 +1,13 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { EqualNodeIdentifiers } from "../../../../tree/nodes/equations/equalNode.js";
3
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
2
4
  type Identifiers = {
3
- solutionNodeIds: any;
4
- equationNodeIds: any;
5
+ solutionNodeIds: NodeIdentifiers;
6
+ equationNodeIds: EqualNodeIdentifiers;
5
7
  };
6
- export declare const binomialsTrinomialsProposedSolutions: Exercise<Identifiers>;
8
+ type Options = {
9
+ degree: string;
10
+ };
11
+ export declare const binomialsTrinomialsProposedSolutions: Exercise<Identifiers, Options>;
7
12
  export {};
8
13
  //# sourceMappingURL=binomialsTrinomialsProposedSolutions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"binomialsTrinomialsProposedSolutions.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,GAAG,CAAC;IACrB,eAAe,EAAE,GAAG,CAAC;CACtB,CAAC;AA0EF,eAAO,MAAM,oCAAoC,EAAE,QAAQ,CAAC,WAAW,CAYtE,CAAC"}
1
+ {"version":3,"file":"binomialsTrinomialsProposedSolutions.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAGL,oBAAoB,EACrB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,eAAe,CAAC;IACjC,eAAe,EAAE,oBAAoB,CAAC;CACvC,CAAC;AA2FF,KAAK,OAAO,GAAG;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAYF,eAAO,MAAM,oCAAoC,EAAE,QAAQ,CACzD,WAAW,EACX,OAAO,CAiBR,CAAC"}
@@ -1,12 +1,21 @@
1
- import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
1
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Affine } from "../../../../math/polynomials/affine.js";
4
4
  import { Trinom } from "../../../../math/polynomials/trinom.js";
5
5
  import { randint } from "../../../../math/utils/random/randint.js";
6
- import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
6
+ import { EqualNode, } from "../../../../tree/nodes/equations/equalNode.js";
7
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
8
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
7
9
  import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
8
- import { SubstractNode } from "../../../../tree/nodes/operators/substractNode.js";
10
+ import { substract, SubstractNode, } from "../../../../tree/nodes/operators/substractNode.js";
9
11
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
12
+ import { random } from "../../../../utils/alea/random.js";
13
+ const getInstruction = (identifiers) => {
14
+ const { solutionNodeIds, equationNodeIds } = identifiers;
15
+ const solution = reifyAlgebraic(solutionNodeIds, true);
16
+ const equation = reifyAlgebraic(equationNodeIds, true);
17
+ return `Le nombre $${solution.toTex()}$ est-il une solution de l'équation $${equation.toTex()}$ ?`;
18
+ };
10
19
  function generateTrinomialFromRoot(root, constante) {
11
20
  const a = randint(1, 5);
12
21
  const r2 = randint(-10, 10, [0]);
@@ -14,61 +23,77 @@ function generateTrinomialFromRoot(root, constante) {
14
23
  const c = root * r2;
15
24
  return new Trinom(a, a * b, a * c + constante);
16
25
  }
17
- const getBinomialsTrinomialsProposedSolutionsQuestion = () => {
18
- const degree = coinFlip();
26
+ const getBinomialsTrinomialsProposedSolutionsQuestion = (opts) => {
27
+ const degree = opts?.degree === "Second degré"
28
+ ? 2
29
+ : opts?.degree === "Premier degré"
30
+ ? 1
31
+ : random([1, 2]);
19
32
  const constante = randint(-10, 10);
20
33
  const root = randint(-10, 10, [0]);
21
34
  const trinomial = generateTrinomialFromRoot(root, constante);
22
35
  const a1 = randint(-10, 10, [0]);
23
36
  const b1 = randint(-10, 10);
24
- let a2;
25
- do {
26
- a2 = randint(-10, 10, [0]);
27
- } while (a2 === a1);
37
+ const a2 = randint(-10, 10, [0, a1]);
28
38
  const b2 = randint(-10, 10);
29
39
  const binomial1 = new Affine(a1, b1);
30
40
  const binomial2 = new Affine(a2, b2);
31
- const equation = degree
41
+ const equation = degree === 2
32
42
  ? new EqualNode(trinomial.toTree(), constante.toTree())
33
43
  : new EqualNode(binomial1.toTree(), binomial2.toTree());
34
- const ans = degree
44
+ const ans = degree === 2
35
45
  ? root.toTree()
36
46
  : new FractionNode(new SubstractNode(binomial2.b.toTree(), binomial1.b.toTree()), new SubstractNode(binomial1.a.toTree(), binomial2.a.toTree())).simplify();
37
- const answertype = coinFlip();
38
- const solution = answertype ? ans : randint(-10, 10).toTree();
39
- const answer = answertype ? "Oui" : "Non";
47
+ const isSol = coinFlip();
48
+ const solution = isSol ? ans : add(ans, randint(-2, 3, [0])).simplify();
49
+ const identifiers = {
50
+ equationNodeIds: equation.toIdentifiers(),
51
+ solutionNodeIds: solution.toIdentifiers(),
52
+ };
53
+ return getQuestionFromIdentifiers(identifiers, opts);
54
+ };
55
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
40
56
  const question = {
41
- answer: answer,
42
- instruction: `Le nombre $${solution.toTex()}$ est-il une solution de l'équation $${equation.toTex()}$ ?`,
43
- keys: [],
57
+ instruction: getInstruction(identifiers, opts),
44
58
  answerFormat: "raw",
45
- identifiers: {
46
- equationNodeIds: equation.toIdentifiers(),
47
- solutionNodeIds: solution.toIdentifiers(),
48
- },
59
+ identifiers,
49
60
  };
50
61
  return question;
51
62
  };
52
- const getPropositions = (n, { answer }) => {
63
+ const getPropositions = (n, { answer, ...identifiers }, opts) => {
53
64
  const propositions = [];
54
- addValidProp(propositions, answer, "raw");
65
+ const { solutionNodeIds, equationNodeIds } = identifiers;
66
+ const solution = reifyAlgebraic(solutionNodeIds, true);
67
+ const equation = reifyAlgebraic(equationNodeIds, true);
68
+ const allLeft = substract(equation.leftChild, equation.rightChild);
69
+ const ev = allLeft.toDetailedEvaluation({ x: solution }).simplify();
70
+ const isSol = ev.evaluate() === 0;
71
+ addValidProp(propositions, isSol ? "Oui" : "Non", "raw");
55
72
  tryToAddWrongProp(propositions, "Oui", "raw");
56
73
  tryToAddWrongProp(propositions, "Non", "raw");
57
74
  tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
58
75
  return shuffleProps(propositions, n);
59
76
  };
60
- const isAnswerValid = (ans, { answer }) => {
61
- return ans === answer;
62
- };
77
+ const options = [
78
+ {
79
+ id: "degree",
80
+ label: "Degré de l'équation",
81
+ target: GeneratorOptionTarget.generation,
82
+ type: GeneratorOptionType.select,
83
+ defaultValue: "Les deux",
84
+ values: ["Premier degré", "Second degré", "Les deux"],
85
+ },
86
+ ];
63
87
  export const binomialsTrinomialsProposedSolutions = {
64
88
  id: "binomialsTrinomialsProposedSolutions",
65
89
  label: "Vérifier si un nombre est solution d'une équation",
66
90
  isSingleStep: true,
67
- generator: (nb) => getDistinctQuestions(getBinomialsTrinomialsProposedSolutionsQuestion, nb),
91
+ generator: (nb, opts) => getDistinctQuestions(() => getBinomialsTrinomialsProposedSolutionsQuestion(opts), nb),
68
92
  answerType: "QCU",
69
93
  qcmTimer: 60,
70
94
  freeTimer: 60,
71
95
  getPropositions,
72
- isAnswerValid,
73
96
  subject: "Mathématiques",
97
+ getQuestionFromIdentifiers,
98
+ options,
74
99
  };
@@ -1 +1 @@
1
- {"version":3,"file":"multiplicationEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/multiplicationEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}
1
+ {"version":3,"file":"multiplicationEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/multiplicationEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8HF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}
@@ -67,6 +67,9 @@ const getMultiplicationEquation = () => {
67
67
  d = randint(-9, 10, [0]);
68
68
  } while (a / c === b / d);
69
69
  const identifiers = { a, b, c, d };
70
+ return getQuestionFromIdentifiers(identifiers);
71
+ };
72
+ const getQuestionFromIdentifiers = (identifiers) => {
70
73
  const question = {
71
74
  instruction: getInstruction(identifiers),
72
75
  startStatement: getStartStatement(identifiers),
@@ -1,7 +1,7 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
2
3
  type Identifiers = {
3
- coeffs: number[][];
4
- isXAsked: boolean;
4
+ coeffsIds: NodeIdentifiers[][];
5
5
  };
6
6
  export declare const basicNiceValuesSystemResolution: Exercise<Identifiers>;
7
7
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"basicNiceValuesSystemResolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAgDF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAcjE,CAAC"}
1
+ {"version":3,"file":"basicNiceValuesSystemResolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAKtE,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,eAAe,EAAE,EAAE,CAAC;CAIhC,CAAC;AA2EF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAgBjE,CAAC"}
@@ -1,44 +1,69 @@
1
1
  import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
- import { System, SystemConstructor } from "../../../../math/systems/system.js";
4
- import { randint } from "../../../../math/utils/random/randint.js";
5
- import { coinFlip } from "../../../../utils/alea/coinFlip.js";
3
+ import { Point, PointConstructor } from "../../../../math/geometry/point.js";
4
+ import { GeneralSystemConstructor, } from "../../../../math/systems/generalSystem.js";
5
+ import { pointParser } from "../../../../tree/parsers/pointParser.js";
6
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
6
7
  //{ a1x + b1y = c1 , a2x + b2y = c2}
7
- const getBasicNiceValuesSystemResolutionQuestion = () => {
8
- //need a1/b1 != a2/b2
9
- const sys = SystemConstructor.niceValues();
10
- const { x, y } = sys.solve();
11
- const isXAsked = coinFlip();
12
- const variable = isXAsked ? "x" : "y";
13
- const answer = isXAsked ? x.toTex() : y.toTex();
14
- const question = {
15
- answer,
16
- instruction: `Soit le système d'équations suivant :
17
-
8
+ const rebuildIdentifiers = (oldIds) => {
9
+ if (oldIds?.coeffsIds?.length)
10
+ return oldIds;
11
+ return {
12
+ coeffsIds: oldIds.coeffs.map((row) => row.map((e) => e.toTree())),
13
+ };
14
+ };
15
+ const getInstruction = (identifiers) => {
16
+ const sys = GeneralSystemConstructor.fromIdentifiers(identifiers);
17
+ return `Résoudre le système d'équations suivant :
18
+
18
19
  $$
19
20
  ${sys.toTex()}
20
21
  $$
21
-
22
- Que vaut $${variable}$ ?`,
22
+
23
+ *Donner le couple solution sous la forme $\\left(x;y\\right)$ : par exemple, si la solution est $x=2$ et $y=3$, alors on écrira $\\left(2;3\\right)$.*`;
24
+ };
25
+ const getAnswer = (identifiers) => {
26
+ const sys = GeneralSystemConstructor.fromIdentifiers(identifiers);
27
+ const { x, y } = sys.solve();
28
+ return new Point("A", x, y).toCoords();
29
+ };
30
+ const getBasicSystemResolutionQuestion = () => {
31
+ const sys = GeneralSystemConstructor.niceValues();
32
+ const identifiers = {
33
+ coeffsIds: sys.toIdentifiers().coeffsIds,
34
+ };
35
+ return getQuestionFromIdentifiers(identifiers);
36
+ };
37
+ const getQuestionFromIdentifiers = (identifiers) => {
38
+ const question = {
39
+ answer: getAnswer(identifiers),
40
+ instruction: getInstruction(identifiers),
23
41
  keys: [],
24
42
  answerFormat: "tex",
25
- identifiers: { coeffs: sys.coeffs, isXAsked },
43
+ identifiers,
26
44
  };
27
45
  return question;
28
46
  };
29
- const getPropositions = (n, { answer, coeffs, isXAsked }) => {
47
+ const getPropositions = (n, { answer, ...identifiers }) => {
30
48
  const propositions = [];
31
- const sys = new System(coeffs);
32
- const { x, y } = sys.solve();
33
49
  addValidProp(propositions, answer);
34
- tryToAddWrongProp(propositions, isXAsked ? y.toTex() : x.toTex());
50
+ // tryToAddWrongProp(propositions, isXAsked ? y.toTex() : x.toTex());
35
51
  while (propositions.length < n) {
36
- tryToAddWrongProp(propositions, randint(-10, 11) + "");
52
+ const point = PointConstructor.random("A");
53
+ tryToAddWrongProp(propositions, point.toCoords());
37
54
  }
38
55
  return shuffleProps(propositions, n);
39
56
  };
40
- const isAnswerValid = (ans, { answer, coeffs, isXAsked }) => {
41
- return ans === answer;
57
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
58
+ try {
59
+ const parsed = pointParser(ans);
60
+ if (!parsed)
61
+ return false;
62
+ return parsed.simplify().toCoords() === answer;
63
+ }
64
+ catch (err) {
65
+ return handleVEAError(err);
66
+ }
42
67
  };
43
68
  export const basicNiceValuesSystemResolution = {
44
69
  id: "basicNiceValuesSystemResolution",
@@ -47,10 +72,12 @@ export const basicNiceValuesSystemResolution = {
47
72
  levels: ["2nde", "1reSpé"],
48
73
  isSingleStep: true,
49
74
  sections: ["Systèmes"],
50
- generator: (nb) => getDistinctQuestions(getBasicNiceValuesSystemResolutionQuestion, nb),
75
+ generator: (nb) => getDistinctQuestions(getBasicSystemResolutionQuestion, nb),
51
76
  qcmTimer: 60,
52
77
  freeTimer: 60,
53
78
  getPropositions,
54
79
  isAnswerValid,
55
80
  subject: "Mathématiques",
81
+ getQuestionFromIdentifiers,
82
+ rebuildIdentifiers,
56
83
  };
@@ -1,7 +1,7 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
2
3
  type Identifiers = {
3
- coeffs: number[][];
4
- isXAsked: boolean;
4
+ coeffsIds: NodeIdentifiers[][];
5
5
  };
6
6
  export declare const basicSystemResolution: Exercise<Identifiers>;
7
7
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"basicSystemResolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/systems/basicSystemResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AA8DF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
1
+ {"version":3,"file":"basicSystemResolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/systems/basicSystemResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAKtE,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,eAAe,EAAE,EAAE,CAAC;CAIhC,CAAC;AA6EF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAgBvD,CAAC"}
@@ -1,56 +1,71 @@
1
1
  import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
- import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
4
- import { System, SystemConstructor } from "../../../../math/systems/system.js";
5
- import { coinFlip } from "../../../../utils/alea/coinFlip.js";
3
+ import { Point } from "../../../../math/geometry/point.js";
4
+ import { GeneralSystemConstructor, } from "../../../../math/systems/generalSystem.js";
5
+ import { pointParser } from "../../../../tree/parsers/pointParser.js";
6
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
6
7
  //{ a1x + b1y = c1 , a2x + b2y = c2}
7
- const getBasicSystemResolutionQuestion = () => {
8
- //need a1/b1 != a2/b2
9
- const sys = SystemConstructor.random();
10
- const { x, y } = sys.solve();
11
- const isXAsked = coinFlip();
12
- const variable = isXAsked ? "x" : "y";
13
- const answer = isXAsked ? x.toTex() : y.toTex();
14
- const identifiers = { coeffs: sys.coeffs, isXAsked };
15
- const question = {
16
- answer,
17
- instruction: `Soit le système d'équations suivant :
8
+ const rebuildIdentifiers = (oldIds) => {
9
+ if (oldIds?.coeffsIds?.length)
10
+ return oldIds;
11
+ return {
12
+ coeffsIds: oldIds.coeffs.map((row) => row.map((e) => e.toTree())),
13
+ };
14
+ };
15
+ const getInstruction = (identifiers) => {
16
+ const sys = GeneralSystemConstructor.fromIdentifiers(identifiers);
17
+ return `Résoudre le système d'équations suivant :
18
18
 
19
19
  $$
20
20
  ${sys.toTex()}
21
21
  $$
22
22
 
23
- Que vaut $${variable}$ ?`,
23
+ *Donner le couple solution sous la forme $\\left(x;y\\right)$ : par exemple, si la solution est $x=2$ et $y=3$, alors on écrira $\\left(2;3\\right)$.*`;
24
+ };
25
+ const getAnswer = (identifiers) => {
26
+ const sys = GeneralSystemConstructor.fromIdentifiers(identifiers);
27
+ const { x, y } = sys.solve();
28
+ return new Point("A", x, y).toCoords();
29
+ };
30
+ const getBasicSystemResolutionQuestion = () => {
31
+ const sys = GeneralSystemConstructor.random();
32
+ const identifiers = {
33
+ coeffsIds: sys.toIdentifiers().coeffsIds,
34
+ };
35
+ return getQuestionFromIdentifiers(identifiers);
36
+ };
37
+ const getQuestionFromIdentifiers = (identifiers) => {
38
+ const question = {
39
+ answer: getAnswer(identifiers),
40
+ instruction: getInstruction(identifiers),
24
41
  keys: [],
25
42
  answerFormat: "tex",
26
43
  identifiers,
27
44
  };
28
45
  return question;
29
46
  };
30
- const getPropositions = (n, { answer, coeffs, isXAsked }) => {
47
+ const getPropositions = (n, { answer, ...identifiers }) => {
31
48
  const propositions = [];
32
- const sys = new System(coeffs);
33
- const { x, y } = sys.solve();
34
49
  addValidProp(propositions, answer);
35
- tryToAddWrongProp(propositions, isXAsked ? y.toTex() : x.toTex());
50
+ // tryToAddWrongProp(propositions, isXAsked ? y.toTex() : x.toTex());
36
51
  while (propositions.length < n) {
37
- tryToAddWrongProp(propositions, RationalConstructor.randomIrreductible().toTree().toTex());
52
+ const sys = GeneralSystemConstructor.random();
53
+ const { x, y } = sys.solve();
54
+ const point = new Point("A", x, y);
55
+ tryToAddWrongProp(propositions, point.toCoords());
38
56
  }
39
57
  return shuffleProps(propositions, n);
40
58
  };
41
- const isAnswerValid = (ans, { answer, coeffs, isXAsked }) => {
42
- const sys = new System(coeffs);
43
- const { x, y } = sys.solve();
44
- const texs = isXAsked
45
- ? x.toAllValidTexs({
46
- allowFractionToDecimal: true,
47
- allowMinusAnywhereInFraction: true,
48
- })
49
- : y.toAllValidTexs({
50
- allowFractionToDecimal: true,
51
- allowMinusAnywhereInFraction: true,
52
- });
53
- return texs.includes(ans);
59
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
60
+ try {
61
+ const parsed = pointParser(ans);
62
+ if (!parsed)
63
+ return false;
64
+ return parsed.simplify().toCoords() === answer;
65
+ }
66
+ catch (err) {
67
+ return handleVEAError(err);
68
+ }
54
69
  };
55
70
  export const basicSystemResolution = {
56
71
  id: "basicSystemResolution",
@@ -65,4 +80,6 @@ export const basicSystemResolution = {
65
80
  getPropositions,
66
81
  isAnswerValid,
67
82
  subject: "Mathématiques",
83
+ getQuestionFromIdentifiers,
84
+ rebuildIdentifiers,
68
85
  };
@@ -1,6 +1,7 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { GeneralSystemIdentifiers } from "../../../../math/systems/generalSystem.js";
2
3
  type Identifiers = {
3
- sysCoeffs: number[][];
4
+ sysIds: GeneralSystemIdentifiers;
4
5
  x: number;
5
6
  y: number;
6
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"verifySystemSolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/systems/verifySystemSolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8CF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
1
+ {"version":3,"file":"verifySystemSolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/systems/verifySystemSolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IAGjB,MAAM,EAAE,wBAAwB,CAAC;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAuEF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
@@ -1,49 +1,68 @@
1
1
  import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
- import { SystemConstructor } from "../../../../math/systems/system.js";
3
+ import { GeneralSystem, GeneralSystemConstructor, } from "../../../../math/systems/generalSystem.js";
4
4
  import { randint } from "../../../../math/utils/random/randint.js";
5
5
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
6
+ const rebuildIdentifiers = (oldIds) => {
7
+ if (!!oldIds?.sysIds)
8
+ return oldIds;
9
+ const sys = new GeneralSystem(oldIds.sysCoeffs);
10
+ return {
11
+ sysIds: sys.toIdentifiers(),
12
+ x: oldIds.x,
13
+ y: oldIds.y,
14
+ };
15
+ };
16
+ const getInstruction = (identifiers) => {
17
+ const { sysIds, x, y } = identifiers;
18
+ const sys = GeneralSystemConstructor.fromIdentifiers(sysIds);
19
+ return `Soit le système d'équations suivant :
20
+
21
+ $$
22
+ ${sys.toTex()}
23
+ $$
24
+
25
+ Le couple $(${x};${y})$ est-il une solution de ce système ?`;
26
+ };
6
27
  const getVerifySystemSolutionQuestion = () => {
7
28
  let x;
8
29
  let y;
9
30
  const isSolution = coinFlip();
10
31
  let sys;
11
32
  if (isSolution) {
12
- sys = SystemConstructor.niceValues();
33
+ sys = GeneralSystemConstructor.niceValues();
13
34
  const sol = sys.solve();
14
35
  x = sol.x.evaluate({});
15
36
  y = sol.y.evaluate({});
16
37
  }
17
38
  else {
18
- sys = SystemConstructor.niceValues();
39
+ sys = GeneralSystemConstructor.niceValues();
19
40
  const sol = sys.solve();
20
41
  x = sol.x.evaluate({}) + randint(-5, 5);
21
42
  y = sol.y.evaluate({}) + randint(-5, 5, [0]);
22
43
  }
44
+ const identifiers = { sysIds: sys.toIdentifiers(), x, y };
45
+ return getQuestionFromIdentifiers(identifiers);
46
+ };
47
+ const getQuestionFromIdentifiers = (identifiers) => {
23
48
  const question = {
24
- answer: isSolution ? "Oui" : "Non",
25
- instruction: `Soit le système d'équations suivant :
26
-
27
- $${sys.toTex()}$
28
-
29
- Le couple $(${x};${y})$ est-il une solution de ce système ?`,
30
- keys: [],
49
+ instruction: getInstruction(identifiers),
31
50
  answerFormat: "raw",
32
- identifiers: { sysCoeffs: sys.coeffs, x, y },
51
+ identifiers,
33
52
  };
34
53
  return question;
35
54
  };
36
- const getPropositions = (n, { answer }) => {
55
+ const getPropositions = (n, { answer, ...identifiers }) => {
37
56
  const propositions = [];
38
- addValidProp(propositions, answer, "raw");
57
+ const { sysIds, x, y } = identifiers;
58
+ const sys = GeneralSystemConstructor.fromIdentifiers(sysIds);
59
+ const isSol = sys.checkCouple(x.toTree(), y.toTree());
60
+ addValidProp(propositions, isSol ? "Oui" : "Non", "raw");
39
61
  tryToAddWrongProp(propositions, "Oui", "raw");
40
62
  tryToAddWrongProp(propositions, "Non", "raw");
41
63
  tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
42
64
  return shuffleProps(propositions, n);
43
65
  };
44
- const isAnswerValid = (ans, { answer }) => {
45
- return ans === answer;
46
- };
47
66
  export const verifySystemSolution = {
48
67
  id: "verifySystemSolution",
49
68
  label: "Vérifier si un couple est solution d'un système",
@@ -54,7 +73,8 @@ export const verifySystemSolution = {
54
73
  qcmTimer: 60,
55
74
  freeTimer: 60,
56
75
  getPropositions,
57
- isAnswerValid,
58
76
  subject: "Mathématiques",
59
77
  answerType: "QCU",
78
+ getQuestionFromIdentifiers,
79
+ rebuildIdentifiers,
60
80
  };
@@ -1 +1 @@
1
- {"version":3,"file":"recognizeAngleType.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/recognizeAngleType.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAWtC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA8TF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}
1
+ {"version":3,"file":"recognizeAngleType.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/recognizeAngleType.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAWtC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAmVF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}
@@ -8,7 +8,6 @@ import { randfloat } from "../../../../math/utils/random/randfloat.js";
8
8
  import { randint } from "../../../../math/utils/random/randint.js";
9
9
  import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
10
10
  import { random } from "../../../../utils/alea/random.js";
11
- import { isLetter } from "../../../../utils/strings/isLetter.js";
12
11
  import { randomLetter } from "../../../../utils/strings/randomLetter.js";
13
12
  const getAngle = (identifiers) => {
14
13
  const indexes = getAnglePointsIndexes(identifiers.angleIndex, identifiers.apexIndex);
@@ -168,25 +167,47 @@ const isAnswerValid = (ans, { answer, angleIndex, angleType, apexIndex, points }
168
167
  if (ans.includes("widehat")) {
169
168
  formated = formated.replaceAll("\\widehat{", "").replaceAll("}", "");
170
169
  }
171
- const pointsNames = Array.from(new Set(formated.split("")));
172
- if (pointsNames.length !== 3 || pointsNames.some((char) => !isLetter(char)))
173
- return false;
174
- const studentPoints = pointsNames.map((char) => PointConstructor.fromIdentifiers(points.find((p) => p.name === char)));
175
- const answerAngle = getAngle({ angleIndex, apexIndex, points });
176
- const studentAngle = new Angle(studentPoints);
177
- //? on va accpter aussi des angles correspondants ou alternes-internes qui ne sont pas définis par les sécantes tracées
178
- //? c'est chelou mais dans le fond ça fait sens (c'est vrai mathémtiquement)
170
+ //TODO fix vea
171
+ return "\\widehat{" + formated + "}" === answer;
172
+ let validAngles = [answer];
179
173
  switch (angleType) {
180
174
  case "opposé par le sommet":
181
- return studentAngle.isSummitOpposite(answerAngle);
175
+ // return studentAngle.isSummitOpposite(answerAngle);
182
176
  case "alterne-interne":
183
- return studentAngle.isAlterneInterne(answerAngle);
177
+ // return studentAngle.isAlterneInterne(answerAngle);
184
178
  break;
185
179
  case "correspondant":
186
180
  default:
187
- return studentAngle.isCorrespondant(answerAngle);
181
+ // return studentAngle.isCorrespondant(answerAngle);
188
182
  break;
189
183
  }
184
+ return validAngles.includes(formated);
185
+ // console.log(angleIndex, angleType, apexIndex);
186
+ // let formated = ans;
187
+ // if (ans.includes("widehat")) {
188
+ // formated = formated.replaceAll("\\widehat{", "").replaceAll("}", "");
189
+ // }
190
+ // const pointsNames = Array.from(new Set(formated.split("")));
191
+ // if (pointsNames.length !== 3 || pointsNames.some((char) => !isLetter(char)))
192
+ // return false;
193
+ // const studentPoints = pointsNames.map((char) =>
194
+ // PointConstructor.fromIdentifiers(points.find((p) => p.name === char)!),
195
+ // );
196
+ // const answerAngle = getAngle({ angleIndex, apexIndex, points });
197
+ // const studentAngle = new Angle(studentPoints);
198
+ // //? on va accpter aussi des angles correspondants ou alternes-internes qui ne sont pas définis par les sécantes tracées
199
+ // //? c'est chelou mais dans le fond ça fait sens (c'est vrai mathémtiquement)
200
+ // switch (angleType) {
201
+ // case "opposé par le sommet":
202
+ // return studentAngle.isSummitOpposite(answerAngle);
203
+ // case "alterne-interne":
204
+ // return studentAngle.isAlterneInterne(answerAngle);
205
+ // break;
206
+ // case "correspondant":
207
+ // default:
208
+ // return studentAngle.isCorrespondant(answerAngle);
209
+ // break;
210
+ // }
190
211
  return false;
191
212
  };
192
213
  //deux paires de sécantes