math-exercises 3.0.151 → 3.0.153

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 (199) hide show
  1. package/lib/exercises/exercise.d.ts +7 -0
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts +5 -1
  4. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +92 -38
  6. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
  7. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +5 -1
  8. package/lib/exercises/math/calcul/proportionality/isTableProportional.d.ts.map +1 -1
  9. package/lib/exercises/math/calcul/proportionality/isTableProportional.js +7 -1
  10. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
  11. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +5 -1
  12. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  13. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +5 -1
  14. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
  15. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +8 -2
  16. package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -1
  17. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  18. package/lib/exercises/math/calculLitteral/equation/index.js +1 -1
  19. package/lib/exercises/math/calculLitteral/equation/square/equationSimpleSquare.d.ts +10 -0
  20. package/lib/exercises/math/calculLitteral/equation/square/equationSimpleSquare.d.ts.map +1 -0
  21. package/lib/exercises/math/calculLitteral/equation/square/equationSimpleSquare.js +183 -0
  22. package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.d.ts +10 -0
  23. package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.d.ts.map +1 -0
  24. package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.js +173 -0
  25. package/lib/exercises/math/calculLitteral/equation/square/index.d.ts +3 -0
  26. package/lib/exercises/math/calculLitteral/equation/square/index.d.ts.map +1 -0
  27. package/lib/exercises/math/calculLitteral/equation/square/index.js +2 -0
  28. package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts.map +1 -1
  29. package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.js +7 -0
  30. package/lib/exercises/math/dataRepresentations/tableReading.d.ts.map +1 -1
  31. package/lib/exercises/math/dataRepresentations/tableReading.js +7 -0
  32. package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
  33. package/lib/exercises/math/functions/affines/affineAdjustment.js +7 -1
  34. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
  35. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +7 -1
  36. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts.map +1 -1
  37. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +7 -1
  38. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
  39. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +7 -1
  40. package/lib/exercises/math/functions/basics/placePointsFromValueTable.d.ts.map +1 -1
  41. package/lib/exercises/math/functions/basics/placePointsFromValueTable.js +7 -0
  42. package/lib/exercises/math/functions/sqrt/squareRootCalculation.d.ts.map +1 -1
  43. package/lib/exercises/math/functions/sqrt/squareRootCalculation.js +4 -2
  44. package/lib/exercises/math/geometry/euclidian/homothetyFactorFromPoints.d.ts +15 -0
  45. package/lib/exercises/math/geometry/euclidian/homothetyFactorFromPoints.d.ts.map +1 -0
  46. package/lib/exercises/math/geometry/euclidian/homothetyFactorFromPoints.js +301 -0
  47. package/lib/exercises/math/geometry/euclidian/index.d.ts +7 -0
  48. package/lib/exercises/math/geometry/euclidian/index.d.ts.map +1 -1
  49. package/lib/exercises/math/geometry/euclidian/index.js +7 -0
  50. package/lib/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.d.ts +21 -0
  51. package/lib/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.d.ts.map +1 -0
  52. package/lib/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.js +406 -0
  53. package/lib/exercises/math/geometry/euclidian/pinPointFromRotation.d.ts +18 -0
  54. package/lib/exercises/math/geometry/euclidian/pinPointFromRotation.d.ts.map +1 -0
  55. package/lib/exercises/math/geometry/euclidian/pinPointFromRotation.js +315 -0
  56. package/lib/exercises/math/geometry/euclidian/pinPointFromTranslation.d.ts +20 -0
  57. package/lib/exercises/math/geometry/euclidian/pinPointFromTranslation.d.ts.map +1 -0
  58. package/lib/exercises/math/geometry/euclidian/pinPointFromTranslation.js +314 -0
  59. package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.d.ts +18 -0
  60. package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.d.ts.map +1 -0
  61. package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.js +387 -0
  62. package/lib/exercises/math/geometry/euclidian/recognizeAngleFromRotation.d.ts +18 -0
  63. package/lib/exercises/math/geometry/euclidian/recognizeAngleFromRotation.d.ts.map +1 -0
  64. package/lib/exercises/math/geometry/euclidian/recognizeAngleFromRotation.js +309 -0
  65. package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.d.ts +17 -0
  66. package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.d.ts.map +1 -0
  67. package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.js +301 -0
  68. package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromAxialSymetry.d.ts.map +1 -1
  69. package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromAxialSymetry.js +22 -8
  70. package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.d.ts +11 -0
  71. package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.d.ts.map +1 -0
  72. package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.js +169 -0
  73. package/lib/exercises/math/geometry/euclidianConstructions/index.d.ts +2 -0
  74. package/lib/exercises/math/geometry/euclidianConstructions/index.d.ts.map +1 -1
  75. package/lib/exercises/math/geometry/euclidianConstructions/index.js +2 -0
  76. package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.d.ts +16 -0
  77. package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.d.ts.map +1 -0
  78. package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.js +309 -0
  79. package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts.map +1 -1
  80. package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.js +7 -0
  81. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.d.ts.map +1 -1
  82. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.js +7 -0
  83. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.d.ts +9 -0
  84. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.d.ts.map +1 -0
  85. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.js +120 -0
  86. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +2 -0
  87. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
  88. package/lib/exercises/math/probaStat/basicProbas/index.js +2 -0
  89. package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.d.ts +12 -0
  90. package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.d.ts.map +1 -0
  91. package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.js +374 -0
  92. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  93. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +7 -0
  94. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  95. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +7 -0
  96. package/lib/exercises/math/probaStat/stats1var/averageWithClasses.d.ts +9 -0
  97. package/lib/exercises/math/probaStat/stats1var/averageWithClasses.d.ts.map +1 -0
  98. package/lib/exercises/math/probaStat/stats1var/averageWithClasses.js +140 -0
  99. package/lib/exercises/math/probaStat/stats1var/averageWithTable.d.ts.map +1 -1
  100. package/lib/exercises/math/probaStat/stats1var/averageWithTable.js +7 -1
  101. package/lib/exercises/math/probaStat/stats1var/averageWithTableWithContext.d.ts +8 -0
  102. package/lib/exercises/math/probaStat/stats1var/averageWithTableWithContext.d.ts.map +1 -0
  103. package/lib/exercises/math/probaStat/stats1var/averageWithTableWithContext.js +113 -0
  104. package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.d.ts.map +1 -1
  105. package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.js +7 -0
  106. package/lib/exercises/math/probaStat/stats1var/cumulativeSum.d.ts.map +1 -1
  107. package/lib/exercises/math/probaStat/stats1var/cumulativeSum.js +7 -0
  108. package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts.map +1 -1
  109. package/lib/exercises/math/probaStat/stats1var/etendueTable.js +7 -1
  110. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.d.ts.map +1 -1
  111. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.js +7 -0
  112. package/lib/exercises/math/probaStat/stats1var/index.d.ts +2 -0
  113. package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
  114. package/lib/exercises/math/probaStat/stats1var/index.js +2 -0
  115. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -1
  116. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +5 -1
  117. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
  118. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +7 -0
  119. package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts +2 -0
  120. package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
  121. package/lib/exercises/math/probaStat/stats1var/medianWithList.js +67 -14
  122. package/lib/exercises/math/probaStat/stats1var/medianWithTable.d.ts.map +1 -1
  123. package/lib/exercises/math/probaStat/stats1var/medianWithTable.js +7 -1
  124. package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
  125. package/lib/exercises/math/probaStat/stats1var/quartiles.js +7 -1
  126. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.d.ts.map +1 -1
  127. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +5 -1
  128. package/lib/exercises/math/probaStat/stats1var/varianceTable.d.ts.map +1 -1
  129. package/lib/exercises/math/probaStat/stats1var/varianceTable.js +5 -1
  130. package/lib/exercises/math/probaStat/stats2var/averagePoint.d.ts.map +1 -1
  131. package/lib/exercises/math/probaStat/stats2var/averagePoint.js +7 -1
  132. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts +7 -0
  133. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts.map +1 -0
  134. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.js +171 -0
  135. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.d.ts +7 -0
  136. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.d.ts.map +1 -0
  137. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.js +155 -0
  138. package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts +3 -0
  139. package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts.map +1 -1
  140. package/lib/exercises/math/probaStat/twoStepExperiments/index.js +3 -0
  141. package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.d.ts +7 -0
  142. package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.d.ts.map +1 -0
  143. package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.js +189 -0
  144. package/lib/exercises/math/scratch/index.d.ts +3 -0
  145. package/lib/exercises/math/scratch/index.d.ts.map +1 -1
  146. package/lib/exercises/math/scratch/index.js +3 -0
  147. package/lib/exercises/math/scratch/scratchListElemAtIndex.d.ts +13 -0
  148. package/lib/exercises/math/scratch/scratchListElemAtIndex.d.ts.map +1 -0
  149. package/lib/exercises/math/scratch/scratchListElemAtIndex.js +189 -0
  150. package/lib/exercises/math/scratch/scratchListElemAtIndex2.d.ts +23 -0
  151. package/lib/exercises/math/scratch/scratchListElemAtIndex2.d.ts.map +1 -0
  152. package/lib/exercises/math/scratch/scratchListElemAtIndex2.js +207 -0
  153. package/lib/exercises/math/scratch/scratchListFilter.d.ts +13 -0
  154. package/lib/exercises/math/scratch/scratchListFilter.d.ts.map +1 -0
  155. package/lib/exercises/math/scratch/scratchListFilter.js +397 -0
  156. package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.d.ts +14 -0
  157. package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.d.ts.map +1 -0
  158. package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.js +347 -0
  159. package/lib/exercises/math/spaceGeometry/basis/index.d.ts +1 -0
  160. package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -1
  161. package/lib/exercises/math/spaceGeometry/basis/index.js +1 -0
  162. package/lib/exercises/math/spaceGeometry/index.d.ts +2 -0
  163. package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -1
  164. package/lib/exercises/math/spaceGeometry/index.js +2 -0
  165. package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.js +3 -3
  166. package/lib/exercises/math/spaceGeometry/solids/index.d.ts +3 -0
  167. package/lib/exercises/math/spaceGeometry/solids/index.d.ts.map +1 -0
  168. package/lib/exercises/math/spaceGeometry/solids/index.js +2 -0
  169. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFrom3D.d.ts +15 -0
  170. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFrom3D.d.ts.map +1 -0
  171. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFrom3D.js +440 -0
  172. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.d.ts +11 -0
  173. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.d.ts.map +1 -0
  174. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.js +1089 -0
  175. package/lib/exercises/math/spaceGeometry/sphere/index.d.ts +3 -0
  176. package/lib/exercises/math/spaceGeometry/sphere/index.d.ts.map +1 -0
  177. package/lib/exercises/math/spaceGeometry/sphere/index.js +2 -0
  178. package/lib/exercises/math/spaceGeometry/sphere/pickIsPointInSphereOrBall.d.ts +9 -0
  179. package/lib/exercises/math/spaceGeometry/sphere/pickIsPointInSphereOrBall.d.ts.map +1 -0
  180. package/lib/exercises/math/spaceGeometry/sphere/pickIsPointInSphereOrBall.js +127 -0
  181. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.d.ts +14 -0
  182. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.d.ts.map +1 -0
  183. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.js +390 -0
  184. package/lib/geogebra/geogebraConstructor.d.ts +2 -0
  185. package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
  186. package/lib/geogebra/geogebraConstructor.js +6 -0
  187. package/lib/index.d.ts +198 -6
  188. package/lib/index.d.ts.map +1 -1
  189. package/lib/math/geometry/point.d.ts +6 -0
  190. package/lib/math/geometry/point.d.ts.map +1 -1
  191. package/lib/math/geometry/point.js +28 -0
  192. package/lib/tree/nodes/equations/equalNode.d.ts +1 -1
  193. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  194. package/lib/tree/nodes/equations/equalNode.js +0 -1
  195. package/lib/tree/utilities/nodeSimplifier.d.ts +1 -1
  196. package/lib/utils/arrays/arrayZip.d.ts +2 -0
  197. package/lib/utils/arrays/arrayZip.d.ts.map +1 -0
  198. package/lib/utils/arrays/arrayZip.js +12 -0
  199. package/package.json +1 -1
@@ -6,13 +6,20 @@ import { parseGGBPoints } from "../../../../geogebra/parsers/parseGGBPoints.js";
6
6
  import { Circle } from "../../../../math/geometry/circle.js";
7
7
  import { Line, LineConstructor, } from "../../../../math/geometry/line.js";
8
8
  import { Point, PointConstructor, } from "../../../../math/geometry/point.js";
9
+ import { Segment } from "../../../../math/geometry/segment.js";
9
10
  const getInstruction = () => {
10
11
  return `Placer le point $A'$, symétrique du point $A$ par rapport à la droite $d$.`;
11
12
  };
12
- // const getHint : GetHint<Identifiers> = (identifiers)=>{
13
- // }
14
- // const getCorrection : GetCorrection<Identifiers> = (identifiers)=>{
15
- // }
13
+ const getHint = () => {
14
+ return `La droite $d$ est la médiatrice de $[AA']$. Comment est la droite $(AA')$ par rapport à $d$ ?`;
15
+ };
16
+ const getCorrection = () => {
17
+ return `$A$ n'est pas sur $d$ donc $A$ et $A'$ sont de part et d'autre de $d$.
18
+ Il y a plusieurs façons de construire $A'$.
19
+ Une d'entre elles consiste à tracer la perpendiculaire à $d$ passant par $A$.
20
+ Cette perpendiculaire contient $A'$. Elle coupe $d$ en $I$ : C'est le milieu de $AA'$.
21
+ On reporte donc la longueur $AI$ de l'autre côté en traçant le cercle de centre $I$ passant par $A$, et on a $A'$.`;
22
+ };
16
23
  const getSolutionPoint = (identifiers) => {
17
24
  const point = PointConstructor.fromIdentifiers(identifiers.point);
18
25
  const line = LineConstructor.fromIdentifiers(identifiers.line);
@@ -21,10 +28,16 @@ const getSolutionPoint = (identifiers) => {
21
28
  const getGGBAnswer = (identifiers) => {
22
29
  const point = PointConstructor.fromIdentifiers(identifiers.point);
23
30
  const sol = getSolutionPoint(identifiers);
31
+ const midPoint = ((pointA, pointB) => {
32
+ const midPoint = new Segment(pointA, pointB).getMidpoint();
33
+ midPoint.name = "I";
34
+ return midPoint;
35
+ })(point, sol);
24
36
  const perp = new Line(point, sol);
25
37
  const center = point.midpoint(sol);
26
38
  const circle = new Circle(center, point, "C");
27
39
  return [
40
+ ...midPoint.toGGBCommand(),
28
41
  ...sol.toGGBCommand(),
29
42
  ...perp.toGGBCommands(false, { color: "black" }),
30
43
  ...circle.toGGBCommands(false),
@@ -86,8 +99,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
86
99
  instruction: getInstruction(identifiers),
87
100
  studentGgbOptions: getStudentGGBOptions(identifiers),
88
101
  identifiers,
89
- // hint: getHint(identifiers),
90
- // correction: getCorrection(identifiers)
102
+ hint: getHint(identifiers),
103
+ correction: getCorrection(identifiers),
91
104
  };
92
105
  return question;
93
106
  };
@@ -99,9 +112,10 @@ export const buildPointFromAxialSymetry = {
99
112
  ggbTimer: 60,
100
113
  isGGBAnswerValid,
101
114
  subject: "Mathématiques",
102
- // getHint,
103
115
  getInstruction,
104
- // getCorrection,
116
+ getHint,
117
+ getCorrection,
118
+ hasHintAndCorrection: true,
105
119
  getGGBAnswer,
106
120
  getStudentGGBOptions,
107
121
  answerType: "GGB",
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { PointIdentifiers } from "../../../../math/geometry/point.js";
3
+ type Identifiers = {
4
+ pointsDict: Record<string, PointIdentifiers>;
5
+ namePointSrc: string;
6
+ namePointCenter: string;
7
+ instructionIndex: number;
8
+ };
9
+ export declare const buildPointFromCentralSymmetry: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=buildPointFromCentralSymmetry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildPointFromCentralSymmetry.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAMtC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AA6MF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAe/D,CAAC"}
@@ -0,0 +1,169 @@
1
+ import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { greenDark } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { ggbPointToCoords } from "../../../../geogebra/parsers/ggbPointToCoords.js";
6
+ import { parseGGBPoints } from "../../../../geogebra/parsers/parseGGBPoints.js";
7
+ import { Point, PointConstructor, } from "../../../../math/geometry/point.js";
8
+ import { VectorConstructor } from "../../../../math/geometry/vector.js";
9
+ import { probaLawFlip } from "../../../../utils/alea/probaLawFlip.js";
10
+ import { randomMany } from "../../../../utils/alea/random.js";
11
+ import { doWhile } from "../../../../utils/doWhile.js";
12
+ const getInstruction = (identifiers) => {
13
+ const { namePointSrc, namePointCenter, instructionIndex } = identifiers;
14
+ switch (instructionIndex) {
15
+ case 1:
16
+ return `Avec les outils disponibles, construire l'image, par la symétrie de centre $${namePointCenter}$, du point $${namePointSrc}$.`;
17
+ case 0:
18
+ default:
19
+ return `Avec les outils disponibles, construire l'image du point $${namePointSrc}$ par la symétrie de centre $${namePointCenter}$.`;
20
+ }
21
+ };
22
+ const getHint = () => {
23
+ return `Tu peux commencer par tracer un cercle dont le centre est le centre de symétrie.`;
24
+ };
25
+ const getCorrection = (identifiers) => {
26
+ const { namePointSrc, namePointCenter } = identifiers;
27
+ return `On trace le cercle $\\mathcal C$ de centre $${namePointCenter}$ passant par $${namePointSrc}$.
28
+ On trace la droite $(${namePointCenter}${namePointSrc})$.
29
+ Les deux points d'intersection de $(${namePointCenter}${namePointSrc})$ avec $\\mathcal C$ sont $${namePointSrc}$ et son symétrique.`;
30
+ };
31
+ const getAnswerPoint = (identifiers) => {
32
+ const { namePointSrc, namePointCenter, pointsDict } = identifiers;
33
+ const [pointSrc, pointCenter] = [namePointSrc, namePointCenter].map((pointName) => PointConstructor.fromIdentifiers(pointsDict[pointName]));
34
+ const vec = VectorConstructor.fromPoints(pointSrc, pointCenter);
35
+ return vec.getEndPoint(pointCenter, `${pointSrc}'`);
36
+ };
37
+ const getGGBAnswer = (identifiers) => {
38
+ const { namePointSrc, namePointCenter, pointsDict } = identifiers;
39
+ const [pointSrc, pointCenter] = [namePointSrc, namePointCenter].map((pointName) => PointConstructor.fromIdentifiers(pointsDict[pointName]));
40
+ const ggbAnswer = [
41
+ ...pointSrc.toGGBCommand(),
42
+ ...pointCenter.toGGBCommand(),
43
+ `L_1 = Line(${pointSrc.name},${pointCenter.name})`,
44
+ `C_1 = Circle(${pointCenter.name},${pointSrc.name})`,
45
+ `I_2 = Intersect(L_1, C_1,2)`,
46
+ `SetColor(I_2, "${greenDark}")`,
47
+ `SetCaption(I_2, "${pointSrc.name}'")`,
48
+ `ShowLabel(I_2, true)`,
49
+ ];
50
+ return ggbAnswer;
51
+ };
52
+ const getCorrectionGGBOptions = (identifiers) => {
53
+ const points = Object.values(identifiers.pointsDict).map((p) => PointConstructor.fromIdentifiers(p));
54
+ const ggb = new GeogebraConstructor({
55
+ hideAxes: true,
56
+ isGridSimple: true,
57
+ commands: getGGBAnswer(identifiers),
58
+ fontSize: 16,
59
+ });
60
+ return ggb.getOptions({
61
+ coords: ggb.getCoordsForPoints([...points, getAnswerPoint(identifiers)]),
62
+ });
63
+ };
64
+ const getStudentGGBOptions = (identifiers) => {
65
+ const { namePointSrc, namePointCenter, pointsDict } = identifiers;
66
+ const [pointSrc, pointCenter] = [namePointSrc, namePointCenter].map((pointName) => PointConstructor.fromIdentifiers(pointsDict[pointName]));
67
+ const studentGGB = new GeogebraConstructor({
68
+ commands: [pointSrc, pointCenter].flatMap((point) => point.toGGBCommand()),
69
+ hideGrid: true,
70
+ hideAxes: true,
71
+ customToolBar: toolBarConstructor({
72
+ join: true,
73
+ circleTwoPoints: true,
74
+ intersect: true,
75
+ }),
76
+ });
77
+ const length = VectorConstructor.fromPoints(pointSrc, pointCenter)
78
+ .getNorm()
79
+ .evaluate();
80
+ const [xMin1, xMax1, yMin1, yMax1] = studentGGB.getCoordsForPoints([
81
+ pointSrc,
82
+ pointCenter,
83
+ ]);
84
+ const xMin = xMin1 - length;
85
+ const xMax = xMax1 + length;
86
+ const yMin = yMin1 - length;
87
+ const yMax = yMax1 + length;
88
+ return studentGGB.getOptions({
89
+ coords: [xMin, xMax, yMin, yMax],
90
+ });
91
+ };
92
+ const isGGBAnswerValid = (ans, { ggbAnswer, ...identifiers }) => {
93
+ const { namePointSrc, namePointCenter } = identifiers;
94
+ const isLineValid = () => {
95
+ const regexs = [
96
+ [namePointCenter, namePointSrc],
97
+ [namePointSrc, namePointCenter],
98
+ ].map(([namePointA, namePointB]) => new RegExp(`Line\\[${namePointA},\\s${namePointB}\\]`));
99
+ return (ans.filter((cmd) => regexs.some((regex) => regex.test(cmd))).length > 0);
100
+ };
101
+ const isCircleValid = () => {
102
+ const regexs = [[namePointCenter, namePointSrc]].map(([namePointA, namePointB]) => new RegExp(`Circle\\[${namePointA},\\s${namePointB}\\]`));
103
+ return (ans.filter((cmd) => regexs.some((regex) => regex.test(cmd))).length > 0);
104
+ };
105
+ const isPointValid = () => {
106
+ const points = parseGGBPoints(ans)
107
+ .map((p) => ggbPointToCoords(p))
108
+ .map((coords, i) => new Point(`K_${i}`, coords.x, coords.y));
109
+ const answerPoint = getAnswerPoint(identifiers);
110
+ return points.some((point) => point.distanceTo(answerPoint) < 0.0000001);
111
+ };
112
+ return isLineValid() && isCircleValid() && isPointValid();
113
+ };
114
+ const getBuildPointFromCentralSymmetryQuestion = () => {
115
+ const [namePointSrc, namePointCenter] = randomMany("ABCDEFGHIJKLMNOPQRST".split(""), 2);
116
+ function createRandomPoints(names) {
117
+ const points = [];
118
+ for (let i = 0; i < names.length; i++) {
119
+ const name = names[i];
120
+ const newPoint = doWhile(() => PointConstructor.random(name, -3, 4), (p) => points.some((p2) => p.distanceTo(p2) < 2));
121
+ points.push(newPoint);
122
+ }
123
+ return points;
124
+ }
125
+ const pointsDict = Object.fromEntries(createRandomPoints([namePointSrc, namePointCenter]).map((point) => [
126
+ point.name,
127
+ point.toIdentifiers(),
128
+ ]));
129
+ const instructionIndex = probaLawFlip([
130
+ [0, 0.7],
131
+ [1, 0.3],
132
+ ]);
133
+ const identifiers = {
134
+ pointsDict,
135
+ namePointSrc,
136
+ namePointCenter,
137
+ instructionIndex,
138
+ };
139
+ return getQuestionFromIdentifiers(identifiers);
140
+ };
141
+ const getQuestionFromIdentifiers = (identifiers) => {
142
+ const question = {
143
+ ggbAnswer: getGGBAnswer(identifiers),
144
+ instruction: getInstruction(identifiers),
145
+ keys: [],
146
+ answerFormat: "tex",
147
+ identifiers,
148
+ studentGgbOptions: getStudentGGBOptions(identifiers),
149
+ hint: getHint(identifiers),
150
+ correction: getCorrection(identifiers),
151
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers),
152
+ };
153
+ return question;
154
+ };
155
+ export const buildPointFromCentralSymmetry = {
156
+ id: "buildPointFromCentralSymmetry",
157
+ connector: "=",
158
+ label: "Construire l'image d'un point par symétrie centrale",
159
+ isSingleStep: true,
160
+ generator: (nb) => getDistinctQuestions(getBuildPointFromCentralSymmetryQuestion, nb),
161
+ ggbTimer: 60,
162
+ isGGBAnswerValid,
163
+ subject: "Mathématiques",
164
+ answerType: "GGB",
165
+ getQuestionFromIdentifiers,
166
+ getHint,
167
+ getCorrection,
168
+ hasHintAndCorrection: true,
169
+ };
@@ -4,4 +4,6 @@ export * from "./pointImageFromTranslation.js";
4
4
  export * from "./buildPointFromAxialSymetry.js";
5
5
  export * from "./pointImageFromHomothety.js";
6
6
  export * from "./segmentImageFromHomothety.js";
7
+ export * from "./buildPointFromCentralSymmetry.js";
8
+ export * from "./placeHomothetyCenter.js";
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC"}
@@ -4,3 +4,5 @@ export * from "./pointImageFromTranslation.js";
4
4
  export * from "./buildPointFromAxialSymetry.js";
5
5
  export * from "./pointImageFromHomothety.js";
6
6
  export * from "./segmentImageFromHomothety.js";
7
+ export * from "./buildPointFromCentralSymmetry.js";
8
+ export * from "./placeHomothetyCenter.js";
@@ -0,0 +1,16 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { PointIdentifiers } from "../../../../math/geometry/point.js";
3
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
4
+ type Identifiers = {
5
+ pointsDict: Record<string, PointIdentifiers>;
6
+ nameSrcPoint: string;
7
+ nameDstPoint: string;
8
+ factor: NodeIdentifiers;
9
+ };
10
+ type Options = {
11
+ isPositiveFactorOnly: boolean;
12
+ factorTypes: string[];
13
+ };
14
+ export declare const placeHomothetyCenter: Exercise<Identifiers, Options>;
15
+ export {};
16
+ //# sourceMappingURL=placeHomothetyCenter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeHomothetyCenter.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAgE7C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AAuSF,KAAK,OAAO,GAAG;IACb,oBAAoB,EAAE,OAAO,CAAC;IAC9B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAyBF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB/D,CAAC"}
@@ -0,0 +1,309 @@
1
+ import { GeneratorOptionType, GeneratorOptionTarget, } from "../../../../exercises/exercise.js";
2
+ import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
3
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
4
+ import { greenMain } from "../../../../geogebra/colors.js";
5
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
6
+ import { approxEqual } from "../../../../geogebra/parsers/approxEqual.js";
7
+ import { ggbPointToCoords } from "../../../../geogebra/parsers/ggbPointToCoords.js";
8
+ import { Point, PointConstructor, } from "../../../../math/geometry/point.js";
9
+ import { VectorConstructor } from "../../../../math/geometry/vector.js";
10
+ import { randint } from "../../../../math/utils/random/randint.js";
11
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
12
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
13
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
14
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
15
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
16
+ import { random, randomMany } from "../../../../utils/alea/random.js";
17
+ import { doWhile } from "../../../../utils/doWhile.js";
18
+ const getHomothetyCenterPoint = (pointSrc, pointDst, nodeFactor, pointName) => {
19
+ const nodeX = frac(substract(multiply(nodeFactor, pointSrc.x), pointDst.x), substract(nodeFactor, 1)).simplify();
20
+ const nodeY = frac(substract(multiply(nodeFactor, pointSrc.y), pointDst.y), substract(nodeFactor, 1)).simplify();
21
+ return new Point(pointName, nodeX, nodeY);
22
+ };
23
+ const getDivisorsOfVector = (vec) => {
24
+ return [2, 3, 4, 5, 7, 8, 9].filter((n) => [vec.x, vec.y].every((z) => z.evaluate() % n === 0));
25
+ };
26
+ const getRandomFactorNodeForVector = (vec, isPositiveFactorOnly = false, excludes = [], factorType) => {
27
+ let factorNode;
28
+ switch (factorType) {
29
+ case "fraction":
30
+ {
31
+ const divisorsOfVec = getDivisorsOfVector(vec);
32
+ if (divisorsOfVec.length > 0) {
33
+ const den = random(divisorsOfVec);
34
+ const num = randint(1, 3 * den, [den, 2 * den]);
35
+ factorNode = frac(num, den);
36
+ }
37
+ else {
38
+ throw new Error("can't find frac for vec");
39
+ }
40
+ }
41
+ break;
42
+ default:
43
+ case "entier":
44
+ {
45
+ factorNode = randint(1, 5, excludes).toTree();
46
+ }
47
+ break;
48
+ }
49
+ return multiply(isPositiveFactorOnly ? 1 : coinFlip() ? 1 : -1, factorNode);
50
+ };
51
+ const getInstruction = (identifiers) => {
52
+ const { nameSrcPoint, nameDstPoint, factor } = identifiers;
53
+ const nodeFactor = NodeConstructor.fromIdentifiers(factor);
54
+ return `Placer le centre de l'homothétie de rapport $${nodeFactor.toTex()}$ qui transforme $${nameSrcPoint}$ en $${nameDstPoint}$.`;
55
+ };
56
+ const getAnswerPoint = (identifiers) => {
57
+ const { nameSrcPoint, nameDstPoint, pointsDict, factor } = identifiers;
58
+ const nodeFactor = NodeConstructor.fromIdentifiers(factor);
59
+ // dst.x - center.x = factor * (src.x - center.x)
60
+ // (factor - 1) * center.x = factor * src.x - dst.x
61
+ //center.x = (factor * src.x - dst.x) / (factor - 1)
62
+ const [pointSrc, pointDst] = [nameSrcPoint, nameDstPoint].map((pointName) => PointConstructor.fromIdentifiers(pointsDict[pointName]));
63
+ return getHomothetyCenterPoint(pointSrc, pointDst, nodeFactor, "P");
64
+ };
65
+ const getWrongPoints = (identifiers) => {
66
+ const { nameSrcPoint, nameDstPoint, pointsDict, factor } = identifiers;
67
+ const nodeFactor = NodeConstructor.fromIdentifiers(factor);
68
+ const [pointSrc, pointDst] = [nameSrcPoint, nameDstPoint].map((pointName) => PointConstructor.fromIdentifiers(pointsDict[pointName]));
69
+ const wrongFactorNodes = [
70
+ multiply(-1, nodeFactor).simplify(),
71
+ ...(() => {
72
+ const invNode = frac(1, nodeFactor).simplify();
73
+ return [invNode, multiply(-1, invNode).simplify()];
74
+ })(),
75
+ ];
76
+ return wrongFactorNodes
77
+ .flatMap((wrongFactorNode, i) => [
78
+ getHomothetyCenterPoint(pointSrc, pointDst, wrongFactorNode, `W_{N${i}}`),
79
+ getHomothetyCenterPoint(pointDst, pointSrc, wrongFactorNode, `W_{R${i}}`),
80
+ ])
81
+ .filter((point) => {
82
+ const isIntegerPoint = () => point.x.evaluate() % 1 === 0 && point.y.evaluate() % 1 === 0;
83
+ const isCloseEnough = () => [pointSrc, pointDst].every((pointMain) => point.distanceTo(pointMain) < 15);
84
+ return isIntegerPoint() && isCloseEnough();
85
+ });
86
+ };
87
+ const getGGBAnswer = (identifiers) => {
88
+ const answerPoint = getAnswerPoint(identifiers);
89
+ return [...answerPoint.toGGBCommand()];
90
+ };
91
+ const getHint = (identifiers) => {
92
+ const { nameSrcPoint, nameDstPoint, factor } = identifiers;
93
+ const nodeFactor = NodeConstructor.fromIdentifiers(factor);
94
+ return `Le centre de l'homothétie appartient à la droite $(${nameSrcPoint}${nameDstPoint})$.
95
+ Si on l'appelle $P$, il faut chercher $P$ tel que :
96
+
97
+ $$
98
+ \\frac{\\overline{P${nameDstPoint}}}{\\overline{P${nameSrcPoint}}} = ${nodeFactor.toTex()}
99
+ $$
100
+
101
+ `;
102
+ };
103
+ const getCorrection = (identifiers) => {
104
+ const { nameSrcPoint, nameDstPoint, factor } = identifiers;
105
+ const nodeFactor = NodeConstructor.fromIdentifiers(factor);
106
+ const isAboveZero = nodeFactor.evaluate() > 0;
107
+ const isAbsBelowOne = Math.abs(nodeFactor.evaluate()) < 1;
108
+ return `L'homothétie transforme $${nameSrcPoint}$ en $${nameDstPoint}$.
109
+ ${(() => {
110
+ if (isAboveZero) {
111
+ return `Le rapport d'homothétie est positif
112
+ donc le centre est donc à l'extérieur du segment $[${nameSrcPoint}${nameDstPoint}]$.`;
113
+ }
114
+ else {
115
+ return `Le rapport d'homothétie est négatif
116
+ donc le centre est donc à l'intérieur du segment $[${nameSrcPoint}${nameDstPoint}]$.`;
117
+ }
118
+ })()}${(() => {
119
+ if (isAbsBelowOne) {
120
+ return `Le rapport est inférieur à $1$ en valeur absolue
121
+ donc le centre est donc plus proche de $${nameDstPoint}$ que de $${nameSrcPoint}$.`;
122
+ }
123
+ else {
124
+ return `Le rapport est supérieur à $1$ en valeur absolue
125
+ donc le centre est donc plus proche de $${nameSrcPoint}$ que de $${nameDstPoint}$.`;
126
+ }
127
+ })()}
128
+
129
+ Si on l'appelle $P$, il faut chercher $P$ tel que :
130
+
131
+ $$
132
+ \\frac{\\overline{P${nameDstPoint}}}{\\overline{P${nameSrcPoint}}} = ${nodeFactor.toTex()}
133
+ $$
134
+
135
+ `;
136
+ };
137
+ const getCorrectionGGBOptions = (identifiers) => {
138
+ const points = Object.values(identifiers.pointsDict).map((p) => PointConstructor.fromIdentifiers(p));
139
+ const answerPoint = getAnswerPoint(identifiers);
140
+ const ggb = new GeogebraConstructor({
141
+ hideAxes: true,
142
+ isGridSimple: true,
143
+ commands: [
144
+ ...points.flatMap((p) => p.toGGBCommand({
145
+ size: 3,
146
+ style: 1,
147
+ })),
148
+ ...answerPoint.toGGBCommand({ color: `${greenMain}` }),
149
+ ],
150
+ fontSize: 16,
151
+ });
152
+ return ggb.getOptions({
153
+ coords: ggb.getCoordsForPoints([...points, answerPoint]),
154
+ });
155
+ };
156
+ const getStudentGGBOptions = (identifiers) => {
157
+ const points = Object.values(identifiers.pointsDict).map((p) => PointConstructor.fromIdentifiers(p));
158
+ const answerPoint = getAnswerPoint(identifiers);
159
+ const wrongPoints = getWrongPoints(identifiers);
160
+ const ggb = new GeogebraConstructor({
161
+ hideAxes: true,
162
+ isGridSimple: true,
163
+ customToolBar: toolBarConstructor({ point: true }),
164
+ commands: [
165
+ ...points.flatMap((p) => p.toGGBCommand({
166
+ size: 3,
167
+ style: 1,
168
+ })),
169
+ ],
170
+ fontSize: 16,
171
+ });
172
+ return ggb.getOptions({
173
+ coords: ggb.getCoordsForPoints([...points, answerPoint, ...wrongPoints]),
174
+ });
175
+ };
176
+ const isGGBAnswerValid = (ans, { ggbAnswer }) => {
177
+ const studentAns = ans;
178
+ if (studentAns.length !== 1)
179
+ return false;
180
+ const studentPoint = studentAns[0].split("=")[1];
181
+ if (studentPoint === undefined)
182
+ return false;
183
+ const coords = ggbPointToCoords(studentPoint);
184
+ const coordsAns = ggbPointToCoords(ggbAnswer[0].split("=")[1]);
185
+ return (approxEqual(coords.x, coordsAns.x, 0.2) &&
186
+ approxEqual(coords.y, coordsAns.y, 0.2));
187
+ };
188
+ const getPlaceHomothetyCenterQuestion = (optsIn) => {
189
+ const opts = optsIn ?? optsDefault;
190
+ const { isPositiveFactorOnly, factorTypes } = opts;
191
+ const factorType = random(factorTypes);
192
+ function createRandomPoints() {
193
+ const points = [];
194
+ for (let i = 0; i < 2; i++) {
195
+ const name = String.fromCharCode(65 + i);
196
+ const newPoint = doWhile(() => PointConstructor.random(name, -3, 4), (p) => points.some((p2) => p.distanceTo(p2) < 2));
197
+ points.push(newPoint);
198
+ }
199
+ return points;
200
+ }
201
+ function createRandomIdentifiersBud() {
202
+ const points = createRandomPoints();
203
+ const [pointCenter, pointSrc] = randomMany(points, 2);
204
+ const vec1 = VectorConstructor.fromPoints(pointCenter, pointSrc);
205
+ const factorNode = getRandomFactorNodeForVector(vec1, isPositiveFactorOnly, [1], factorType).simplify();
206
+ const pointDst = vec1
207
+ .times(factorNode)
208
+ .getEndPoint(pointCenter, String.fromCharCode(65 + points.length));
209
+ points.push(pointDst);
210
+ const identifiers = {
211
+ pointsDict: Object.fromEntries([pointSrc, pointDst].map((p) => [p.name, p.toIdentifiers()])),
212
+ nameSrcPoint: pointSrc.name,
213
+ nameDstPoint: pointDst.name,
214
+ factor: factorNode.toIdentifiers(),
215
+ //clandestine
216
+ pointCenter,
217
+ };
218
+ return identifiers;
219
+ }
220
+ const pointOrigin = new Point("O", 0, 0);
221
+ let identifiers;
222
+ let counter = -1;
223
+ let isValidIdentifiers = false;
224
+ while (!isValidIdentifiers && counter < 100) {
225
+ let identifiersBud;
226
+ counter++;
227
+ try {
228
+ identifiersBud = createRandomIdentifiersBud();
229
+ }
230
+ catch (_) {
231
+ continue;
232
+ }
233
+ const points = [
234
+ ...Object.values(identifiersBud.pointsDict).map((pointIds) => PointConstructor.fromIdentifiers(pointIds)),
235
+ identifiersBud.pointCenter,
236
+ ];
237
+ const isPointsDistinct = [...new Set(points.map((point) => point.toCoords()))].length ===
238
+ points.length;
239
+ const isPointsCloseToOrigin = points.every((point) => point.distanceTo(pointOrigin) < 10);
240
+ isValidIdentifiers = isPointsDistinct && isPointsCloseToOrigin;
241
+ if (isValidIdentifiers) {
242
+ identifiers = { ...identifiersBud };
243
+ }
244
+ }
245
+ // const identifiers = createRandomIdentifiers(points);
246
+ const defaultIdentifiers = {
247
+ pointsDict: Object.fromEntries([
248
+ new Point("O", 0, 0),
249
+ new Point("A", 5, 0),
250
+ new Point("B", 0, 5),
251
+ new Point("C", -5, 0),
252
+ new Point("D", 0, -5),
253
+ ].map((point) => [point.name, point.toIdentifiers()])),
254
+ nameSrcPoint: "A",
255
+ nameDstPoint: "C",
256
+ factor: (-1).toTree().toIdentifiers(),
257
+ };
258
+ return getQuestionFromIdentifiers(identifiers ?? defaultIdentifiers, opts);
259
+ };
260
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
261
+ const question = {
262
+ ggbAnswer: getGGBAnswer(identifiers, opts),
263
+ instruction: getInstruction(identifiers, opts),
264
+ studentGgbOptions: getStudentGGBOptions(identifiers, opts),
265
+ keys: [],
266
+ identifiers,
267
+ hint: getHint(identifiers, opts),
268
+ correction: getCorrection(identifiers),
269
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers),
270
+ };
271
+ return question;
272
+ };
273
+ const options = [
274
+ {
275
+ id: "isPositiveFactorOnly",
276
+ label: "Rapports positifs uniquement",
277
+ type: GeneratorOptionType.checkbox,
278
+ target: GeneratorOptionTarget.generation,
279
+ defaultValue: false,
280
+ },
281
+ {
282
+ id: "factorTypes",
283
+ label: "Rapport: type de nombre",
284
+ type: GeneratorOptionType.multiselect,
285
+ target: GeneratorOptionTarget.generation,
286
+ values: ["entier", "fraction"],
287
+ defaultValue: ["entier", "fraction"],
288
+ },
289
+ ];
290
+ const optsDefault = {
291
+ isPositiveFactorOnly: false,
292
+ factorTypes: ["entier", "fraction"],
293
+ };
294
+ export const placeHomothetyCenter = {
295
+ id: "placeHomothetyCenter",
296
+ label: "Placer le centre d'une homothétie",
297
+ isSingleStep: true,
298
+ generator: (nb, opts) => getDistinctQuestions(() => getPlaceHomothetyCenterQuestion(opts), nb),
299
+ ggbTimer: 60,
300
+ subject: "Mathématiques",
301
+ getHint,
302
+ getCorrection,
303
+ getStudentGGBOptions,
304
+ options,
305
+ getQuestionFromIdentifiers,
306
+ hasHintAndCorrection: true,
307
+ isGGBAnswerValid,
308
+ answerType: "GGB",
309
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"calculateProbaFromProbaLaw.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AA6HF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAmB5D,CAAC"}
1
+ {"version":3,"file":"calculateProbaFromProbaLaw.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAoIF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAmB5D,CAAC"}
@@ -106,6 +106,13 @@ const getQuestionFromIdentifiers = (identifiers) => {
106
106
  identifiers,
107
107
  hint: getHint(identifiers),
108
108
  correction: getCorrection(identifiers),
109
+ style: {
110
+ tableOptions: {
111
+ firstColumnIsHeader: true,
112
+ firstCellIsDivided: false,
113
+ firstRowIsHeader: false,
114
+ },
115
+ },
109
116
  };
110
117
  };
111
118
  export const calculateProbaFromProbaLaw = {
@@ -1 +1 @@
1
- {"version":3,"file":"getMissingProbabilityValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAiHF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAiB5D,CAAC"}
1
+ {"version":3,"file":"getMissingProbabilityValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAwHF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAiB5D,CAAC"}
@@ -89,6 +89,13 @@ const getQuestionFromIdentifiers = (identifiers) => ({
89
89
  identifiers,
90
90
  hint: getHint(identifiers),
91
91
  correction: getCorrection(identifiers),
92
+ style: {
93
+ tableOptions: {
94
+ firstColumnIsHeader: true,
95
+ firstCellIsDivided: false,
96
+ firstRowIsHeader: false,
97
+ },
98
+ },
92
99
  });
93
100
  export const getMissingProbabilityValue = {
94
101
  id: "getMissingProbabilityValue",
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ labels: string[];
4
+ pValues: number[];
5
+ missingIndex: number;
6
+ };
7
+ export declare const getMissingProbabilityValueMiddleSchool: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=getMissingProbabilityValueMiddleSchool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMissingProbabilityValueMiddleSchool.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AA4HF,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAAC,WAAW,CAoBxE,CAAC"}