math-exercises 1.3.38 → 1.3.40

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 (222) hide show
  1. package/lib/exercises/calcul/addAndSub.d.ts.map +1 -1
  2. package/lib/exercises/calcul/addAndSub.js +29 -2
  3. package/lib/exercises/calcul/addAndSubWithoutRelatives.d.ts.map +1 -1
  4. package/lib/exercises/calcul/addAndSubWithoutRelatives.js +26 -0
  5. package/lib/exercises/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
  6. package/lib/exercises/calcul/arithmetics/primeNumbers.js +48 -9
  7. package/lib/exercises/calcul/fractions/fractionAndIntegerDivision.d.ts.map +1 -1
  8. package/lib/exercises/calcul/fractions/fractionAndIntegerDivision.js +29 -0
  9. package/lib/exercises/calcul/fractions/fractionAndIntegerProduct.d.ts.map +1 -1
  10. package/lib/exercises/calcul/fractions/fractionAndIntegerProduct.js +27 -0
  11. package/lib/exercises/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
  12. package/lib/exercises/calcul/fractions/fractionAndIntegerSum.js +27 -0
  13. package/lib/exercises/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
  14. package/lib/exercises/calcul/fractions/fractionToPercentToDecimal.js +48 -1
  15. package/lib/exercises/calcul/fractions/fractionsDivision.d.ts.map +1 -1
  16. package/lib/exercises/calcul/fractions/fractionsDivision.js +27 -0
  17. package/lib/exercises/calcul/fractions/fractionsProduct.d.ts.map +1 -1
  18. package/lib/exercises/calcul/fractions/fractionsProduct.js +27 -0
  19. package/lib/exercises/calcul/fractions/fractionsSum.d.ts.map +1 -1
  20. package/lib/exercises/calcul/fractions/fractionsSum.js +27 -0
  21. package/lib/exercises/calcul/fractions/simplifyFraction.d.ts.map +1 -1
  22. package/lib/exercises/calcul/fractions/simplifyFraction.js +26 -0
  23. package/lib/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.d.ts.map +1 -1
  24. package/lib/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.js +30 -0
  25. package/lib/exercises/calcul/mentalCaluls.ts/mentalDivisions.d.ts.map +1 -1
  26. package/lib/exercises/calcul/mentalCaluls.ts/mentalDivisions.js +29 -0
  27. package/lib/exercises/calcul/mentalCaluls.ts/mentalMultiplications.d.ts.map +1 -1
  28. package/lib/exercises/calcul/mentalCaluls.ts/mentalMultiplications.js +26 -0
  29. package/lib/exercises/calcul/mentalCaluls.ts/mentalPercentage.d.ts.map +1 -1
  30. package/lib/exercises/calcul/mentalCaluls.ts/mentalPercentage.js +65 -0
  31. package/lib/exercises/calcul/operations/operationsPriorities.d.ts.map +1 -1
  32. package/lib/exercises/calcul/operations/operationsPriorities.js +25 -0
  33. package/lib/exercises/calcul/operations/operationsPrioritiesWithoutRelative.d.ts.map +1 -1
  34. package/lib/exercises/calcul/operations/operationsPrioritiesWithoutRelative.js +25 -0
  35. package/lib/exercises/calcul/proportionality/proportionalityTable.d.ts +4 -0
  36. package/lib/exercises/calcul/proportionality/proportionalityTable.d.ts.map +1 -0
  37. package/lib/exercises/calcul/proportionality/proportionalityTable.js +78 -0
  38. package/lib/exercises/calcul/rounding/rounding.d.ts.map +1 -1
  39. package/lib/exercises/calcul/rounding/rounding.js +49 -0
  40. package/lib/exercises/calculLitteral/distributivity/doubleDistributivity.d.ts.map +1 -1
  41. package/lib/exercises/calculLitteral/distributivity/doubleDistributivity.js +45 -0
  42. package/lib/exercises/calculLitteral/distributivity/firstIdentity.d.ts.map +1 -1
  43. package/lib/exercises/calculLitteral/distributivity/firstIdentity.js +45 -0
  44. package/lib/exercises/calculLitteral/distributivity/secondIdentity.d.ts.map +1 -1
  45. package/lib/exercises/calculLitteral/distributivity/secondIdentity.js +45 -0
  46. package/lib/exercises/calculLitteral/distributivity/simpleDistributivity.d.ts.map +1 -1
  47. package/lib/exercises/calculLitteral/distributivity/simpleDistributivity.js +45 -1
  48. package/lib/exercises/calculLitteral/distributivity/thirdIdentity.d.ts.map +1 -1
  49. package/lib/exercises/calculLitteral/distributivity/thirdIdentity.js +45 -0
  50. package/lib/exercises/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
  51. package/lib/exercises/calculLitteral/equation/equationSimpleSquare.js +106 -0
  52. package/lib/exercises/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
  53. package/lib/exercises/calculLitteral/equation/equationType1Exercise.js +27 -0
  54. package/lib/exercises/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
  55. package/lib/exercises/calculLitteral/equation/equationType2Exercise.js +27 -0
  56. package/lib/exercises/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
  57. package/lib/exercises/calculLitteral/equation/equationType3Exercise.js +27 -0
  58. package/lib/exercises/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
  59. package/lib/exercises/calculLitteral/equation/equationType4Exercise.js +27 -0
  60. package/lib/exercises/calculLitteral/equation/evaluateExpression.d.ts +4 -0
  61. package/lib/exercises/calculLitteral/equation/evaluateExpression.d.ts.map +1 -0
  62. package/lib/exercises/calculLitteral/equation/evaluateExpression.js +61 -0
  63. package/lib/exercises/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
  64. package/lib/exercises/calculLitteral/equation/firstDegreeEquation.js +25 -0
  65. package/lib/exercises/calculLitteral/equation/fractionEquation.d.ts.map +1 -1
  66. package/lib/exercises/calculLitteral/equation/fractionEquation.js +32 -0
  67. package/lib/exercises/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
  68. package/lib/exercises/calculLitteral/equation/multiplicationEquation.js +35 -0
  69. package/lib/exercises/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
  70. package/lib/exercises/calculLitteral/factorisation/factoIdRmq1.js +32 -0
  71. package/lib/exercises/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
  72. package/lib/exercises/calculLitteral/factorisation/factoIdRmq2.js +38 -0
  73. package/lib/exercises/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
  74. package/lib/exercises/calculLitteral/factorisation/factoIdRmq3.js +44 -0
  75. package/lib/exercises/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
  76. package/lib/exercises/calculLitteral/factorisation/factoType1Exercise.js +42 -0
  77. package/lib/exercises/calculLitteral/simplifying/reduceExpression.d.ts +4 -0
  78. package/lib/exercises/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -0
  79. package/lib/exercises/calculLitteral/simplifying/reduceExpression.js +118 -0
  80. package/lib/exercises/conversion/aeraConversion.d.ts.map +1 -1
  81. package/lib/exercises/conversion/aeraConversion.js +27 -0
  82. package/lib/exercises/conversion/capacityConversion.d.ts.map +1 -1
  83. package/lib/exercises/conversion/capacityConversion.js +27 -0
  84. package/lib/exercises/conversion/lengthConversion.d.ts.map +1 -1
  85. package/lib/exercises/conversion/lengthConversion.js +26 -0
  86. package/lib/exercises/conversion/massConversion.d.ts.map +1 -1
  87. package/lib/exercises/conversion/massConversion.js +26 -0
  88. package/lib/exercises/conversion/volumeCapacityConversion.d.ts.map +1 -1
  89. package/lib/exercises/conversion/volumeCapacityConversion.js +29 -3
  90. package/lib/exercises/conversion/volumeConversion.d.ts.map +1 -1
  91. package/lib/exercises/conversion/volumeConversion.js +26 -0
  92. package/lib/exercises/derivation/derivative/constanteDerivative.d.ts.map +1 -1
  93. package/lib/exercises/derivation/derivative/constanteDerivative.js +26 -0
  94. package/lib/exercises/derivation/derivative/firstDegreeDerivative.d.ts.map +1 -1
  95. package/lib/exercises/derivation/derivative/firstDegreeDerivative.js +26 -0
  96. package/lib/exercises/derivation/derivative/inverseFunctionDerivative.d.ts.map +1 -1
  97. package/lib/exercises/derivation/derivative/inverseFunctionDerivative.js +26 -0
  98. package/lib/exercises/derivation/derivative/powerFunctionDerivative.d.ts.map +1 -1
  99. package/lib/exercises/derivation/derivative/powerFunctionDerivative.js +26 -0
  100. package/lib/exercises/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
  101. package/lib/exercises/derivation/derivative/rootFunctionDerivative.js +36 -0
  102. package/lib/exercises/derivation/derivative/secondDegreeDerivative.d.ts.map +1 -1
  103. package/lib/exercises/derivation/derivative/secondDegreeDerivative.js +31 -0
  104. package/lib/exercises/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
  105. package/lib/exercises/derivation/derivative/thirdDegreeDerivative.js +30 -0
  106. package/lib/exercises/derivation/derivativeNumberReading.d.ts.map +1 -1
  107. package/lib/exercises/derivation/derivativeNumberReading.js +30 -0
  108. package/lib/exercises/exercise.d.ts +6 -0
  109. package/lib/exercises/exercise.d.ts.map +1 -1
  110. package/lib/exercises/exercises.d.ts.map +1 -1
  111. package/lib/exercises/exercises.js +8 -0
  112. package/lib/exercises/geometry/cartesian/distanceBetweenTwoPoints.d.ts +4 -0
  113. package/lib/exercises/geometry/cartesian/distanceBetweenTwoPoints.d.ts.map +1 -0
  114. package/lib/exercises/geometry/cartesian/distanceBetweenTwoPoints.js +101 -0
  115. package/lib/exercises/geometry/cartesian/leadingCoefficient.d.ts.map +1 -1
  116. package/lib/exercises/geometry/cartesian/leadingCoefficient.js +30 -0
  117. package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.d.ts.map +1 -1
  118. package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.js +26 -0
  119. package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.d.ts.map +1 -1
  120. package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.js +26 -0
  121. package/lib/exercises/geometry/cartesian/midpoint.d.ts.map +1 -1
  122. package/lib/exercises/geometry/cartesian/midpoint.js +29 -0
  123. package/lib/exercises/geometry/euclidean/circleArea.d.ts.map +1 -1
  124. package/lib/exercises/geometry/euclidean/circleArea.js +28 -1
  125. package/lib/exercises/geometry/euclidean/circleCircumference.d.ts.map +1 -1
  126. package/lib/exercises/geometry/euclidean/circleCircumference.js +28 -1
  127. package/lib/exercises/geometry/euclidean/pythagore.d.ts.map +1 -1
  128. package/lib/exercises/geometry/euclidean/pythagore.js +47 -0
  129. package/lib/exercises/geometry/euclidean/pythagoreCalcul.d.ts.map +1 -1
  130. package/lib/exercises/geometry/euclidean/pythagoreCalcul.js +28 -0
  131. package/lib/exercises/geometry/euclidean/rectangleArea.d.ts.map +1 -1
  132. package/lib/exercises/geometry/euclidean/rectangleArea.js +25 -0
  133. package/lib/exercises/geometry/euclidean/rectanglePerimeter.d.ts.map +1 -1
  134. package/lib/exercises/geometry/euclidean/rectanglePerimeter.js +25 -0
  135. package/lib/exercises/geometry/euclidean/rightTriangleArea.d.ts.map +1 -1
  136. package/lib/exercises/geometry/euclidean/rightTriangleArea.js +25 -0
  137. package/lib/exercises/geometry/euclidean/squareArea.d.ts.map +1 -1
  138. package/lib/exercises/geometry/euclidean/squareArea.js +25 -0
  139. package/lib/exercises/geometry/euclidean/squarePerimeter.d.ts.map +1 -1
  140. package/lib/exercises/geometry/euclidean/squarePerimeter.js +25 -0
  141. package/lib/exercises/geometry/euclidean/thales.d.ts.map +1 -1
  142. package/lib/exercises/geometry/euclidean/thales.js +44 -1
  143. package/lib/exercises/geometry/euclidean/thalesCalcul.d.ts.map +1 -1
  144. package/lib/exercises/geometry/euclidean/thalesCalcul.js +25 -0
  145. package/lib/exercises/geometry/euclidean/triangleArea.d.ts.map +1 -0
  146. package/lib/exercises/geometry/euclidean/{TriangleArea.js → triangleArea.js} +24 -0
  147. package/lib/exercises/geometry/euclidean/triangleAreaV2.d.ts.map +1 -1
  148. package/lib/exercises/geometry/euclidean/triangleAreaV2.js +32 -1
  149. package/lib/exercises/geometry/euclidean/trianglePerimeter.d.ts.map +1 -1
  150. package/lib/exercises/geometry/euclidean/trianglePerimeter.js +26 -0
  151. package/lib/exercises/geometry/euclidean/trigonometry.d.ts.map +1 -1
  152. package/lib/exercises/geometry/euclidean/trigonometry.js +39 -0
  153. package/lib/exercises/geometry/euclidean/trigonometryAngleCalcul.d.ts.map +1 -1
  154. package/lib/exercises/geometry/euclidean/trigonometryAngleCalcul.js +24 -0
  155. package/lib/exercises/geometry/euclidean/trigonometrySideCalcul.d.ts.map +1 -1
  156. package/lib/exercises/geometry/euclidean/trigonometrySideCalcul.js +25 -0
  157. package/lib/exercises/geometry/vectors/scalarProductViaCoords.d.ts.map +1 -1
  158. package/lib/exercises/geometry/vectors/scalarProductViaCoords.js +28 -1
  159. package/lib/exercises/percent/applyPercent.d.ts.map +1 -1
  160. package/lib/exercises/percent/applyPercent.js +30 -0
  161. package/lib/exercises/percent/averageEvolutionRate.d.ts.map +1 -1
  162. package/lib/exercises/percent/averageEvolutionRate.js +32 -2
  163. package/lib/exercises/percent/globalPercent.d.ts.map +1 -1
  164. package/lib/exercises/percent/globalPercent.js +30 -0
  165. package/lib/exercises/percent/reciprocalPercentage.d.ts.map +1 -1
  166. package/lib/exercises/percent/reciprocalPercentage.js +30 -0
  167. package/lib/exercises/powers/powersDivision.d.ts.map +1 -1
  168. package/lib/exercises/powers/powersDivision.js +29 -1
  169. package/lib/exercises/powers/powersOfTenToDecimal.d.ts.map +1 -1
  170. package/lib/exercises/powers/powersOfTenToDecimal.js +28 -0
  171. package/lib/exercises/powers/powersPower.d.ts.map +1 -1
  172. package/lib/exercises/powers/powersPower.js +28 -0
  173. package/lib/exercises/powers/powersProduct.d.ts.map +1 -1
  174. package/lib/exercises/powers/powersProduct.js +29 -1
  175. package/lib/exercises/powers/scientificToDecimal.d.ts.map +1 -1
  176. package/lib/exercises/powers/scientificToDecimal.js +27 -0
  177. package/lib/exercises/proba/conditionalProbability.d.ts.map +1 -1
  178. package/lib/exercises/proba/conditionalProbability.js +25 -0
  179. package/lib/exercises/proba/marginalAndConditionalFrequency.d.ts.map +1 -1
  180. package/lib/exercises/proba/marginalAndConditionalFrequency.js +25 -0
  181. package/lib/exercises/proba/probabilityTree.d.ts.map +1 -1
  182. package/lib/exercises/proba/probabilityTree.js +33 -6
  183. package/lib/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.d.ts.map +1 -1
  184. package/lib/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.js +25 -0
  185. package/lib/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.d.ts.map +1 -1
  186. package/lib/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.js +25 -0
  187. package/lib/exercises/sequences/arithmetic/arithmeticFindReason.d.ts.map +1 -1
  188. package/lib/exercises/sequences/arithmetic/arithmeticFindReason.js +25 -0
  189. package/lib/exercises/sequences/arithmetic/arithmeticReasonUsage.d.ts.map +1 -1
  190. package/lib/exercises/sequences/arithmetic/arithmeticReasonUsage.js +25 -0
  191. package/lib/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.d.ts.map +1 -1
  192. package/lib/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.js +25 -0
  193. package/lib/exercises/sequences/arithmetic/arithmeticThresholdFind.d.ts.map +1 -1
  194. package/lib/exercises/sequences/arithmetic/arithmeticThresholdFind.js +25 -0
  195. package/lib/exercises/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
  196. package/lib/exercises/sequences/geometric/geometricExplicitFormulaUsage.js +25 -0
  197. package/lib/exercises/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
  198. package/lib/exercises/sequences/geometric/geometricFindExplicitFormula.js +31 -0
  199. package/lib/exercises/sequences/geometric/geometricFindReason.d.ts.map +1 -1
  200. package/lib/exercises/sequences/geometric/geometricFindReason.js +31 -0
  201. package/lib/exercises/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
  202. package/lib/exercises/sequences/geometric/geometricReasonUsage.js +31 -0
  203. package/lib/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.d.ts.map +1 -1
  204. package/lib/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.js +31 -0
  205. package/lib/exercises/squareRoots/simpifySquareRoot.d.ts.map +1 -1
  206. package/lib/exercises/squareRoots/simpifySquareRoot.js +29 -0
  207. package/lib/math/geometry/point.d.ts +1 -0
  208. package/lib/math/geometry/point.d.ts.map +1 -1
  209. package/lib/math/geometry/point.js +9 -0
  210. package/lib/math/polynomials/polynomial.d.ts +1 -0
  211. package/lib/math/polynomials/polynomial.d.ts.map +1 -1
  212. package/lib/math/polynomials/polynomial.js +8 -1
  213. package/lib/server.js +16 -20
  214. package/package.json +7 -6
  215. package/lib/exercises/geometry/cartesian/derivativeNumberReading.d.ts +0 -4
  216. package/lib/exercises/geometry/cartesian/derivativeNumberReading.d.ts.map +0 -1
  217. package/lib/exercises/geometry/cartesian/derivativeNumberReading.js +0 -51
  218. package/lib/exercises/geometry/cartesian/derivativeNumberReading2.d.ts +0 -1
  219. package/lib/exercises/geometry/cartesian/derivativeNumberReading2.d.ts.map +0 -1
  220. package/lib/exercises/geometry/cartesian/derivativeNumberReading2.js +0 -91
  221. package/lib/exercises/geometry/euclidean/TriangleArea.d.ts.map +0 -1
  222. /package/lib/exercises/geometry/euclidean/{TriangleArea.d.ts → triangleArea.d.ts} +0 -0
@@ -7,6 +7,8 @@ const round_1 = require("../../../math/utils/round");
7
7
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
8
8
  const addNode_1 = require("../../../tree/nodes/operators/addNode");
9
9
  const coinFlip_1 = require("../../../utils/coinFlip");
10
+ const shuffle_1 = require("../../../utils/shuffle");
11
+ const uuid_1 = require("uuid");
10
12
  exports.mentalAddAndSub = {
11
13
  id: 'mentalAddAndSub',
12
14
  connector: '=',
@@ -36,10 +38,38 @@ function getMentalAddAndSub() {
36
38
  for (let i = 2; i < nbrOperations; i++)
37
39
  statementTree = new addNode_1.AddNode(statementTree, allNumbersNodes[i]);
38
40
  statementTree.shuffle();
41
+ const getPropositions = (n) => {
42
+ const res = [];
43
+ // Ajout de la réponse correcte
44
+ const answer = (0, round_1.round)(sum, 2);
45
+ res.push({
46
+ id: (0, uuid_1.v4)() + '',
47
+ statement: answer.toString(),
48
+ isRightAnswer: true,
49
+ });
50
+ // Ajout des propositions incorrectes
51
+ for (let i = 0; i < n - 1; i++) {
52
+ let isDuplicate;
53
+ let proposition;
54
+ do {
55
+ const incorrectSum = (0, round_1.round)(sum + ((0, coinFlip_1.coinFlip)() ? 1 : -1) * Math.random() * 10, 2);
56
+ proposition = {
57
+ id: (0, uuid_1.v4)() + '',
58
+ statement: incorrectSum.toString(),
59
+ isRightAnswer: false,
60
+ };
61
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
62
+ } while (isDuplicate);
63
+ res.push(proposition);
64
+ }
65
+ // Mélange des propositions
66
+ return (0, shuffle_1.shuffle)(res);
67
+ };
39
68
  const question = {
40
69
  startStatement: statementTree.toTex(),
41
70
  answer: (0, round_1.round)(sum, 2) + '',
42
71
  keys: [],
72
+ getPropositions,
43
73
  };
44
74
  return question;
45
75
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mentalDivisions.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/mentalCaluls.ts/mentalDivisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,eAAO,MAAM,eAAe,EAAE,QAU7B,CAAC;AAEF,wBAAgB,kBAAkB,IAAI,QAAQ,CAuD7C"}
1
+ {"version":3,"file":"mentalDivisions.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/mentalCaluls.ts/mentalDivisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU3E,eAAO,MAAM,eAAe,EAAE,QAU7B,CAAC;AAEF,wBAAgB,kBAAkB,IAAI,QAAQ,CAyF7C"}
@@ -7,6 +7,8 @@ const round_1 = require("../../../math/utils/round");
7
7
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
8
8
  const divideNode_1 = require("../../../tree/nodes/operators/divideNode");
9
9
  const coinFlip_1 = require("../../../utils/coinFlip");
10
+ const shuffle_1 = require("../../../utils/shuffle");
11
+ const uuid_1 = require("uuid");
10
12
  exports.mentalDivisions = {
11
13
  id: 'mentalDivisions',
12
14
  connector: '=',
@@ -54,10 +56,37 @@ function getMentalDivisions() {
54
56
  ? new divideNode_1.DivideNode(allNumbersNodes[0], new divideNode_1.DivideNode(allNumbersNodes[1], allNumbersNodes[2]))
55
57
  : new divideNode_1.DivideNode(allNumbersNodes[0], allNumbersNodes[1]);
56
58
  const answer = rand === 6 ? a / (b / c) : a / b;
59
+ const getPropositions = (n) => {
60
+ const propositions = [];
61
+ // Ajout de la réponse correcte
62
+ propositions.push({
63
+ id: (0, uuid_1.v4)() + '',
64
+ statement: answer.toString(),
65
+ isRightAnswer: true,
66
+ });
67
+ // Ajout des propositions incorrectes
68
+ for (let i = 0; i < n - 1; i++) {
69
+ let isDuplicate;
70
+ let proposition;
71
+ do {
72
+ const incorrectAnswer = (0, round_1.round)(answer + ((0, coinFlip_1.coinFlip)() ? 1 : -1) * Math.random() * 10, 2);
73
+ proposition = {
74
+ id: (0, uuid_1.v4)() + '',
75
+ statement: incorrectAnswer.toString(),
76
+ isRightAnswer: false,
77
+ };
78
+ isDuplicate = propositions.some((p) => p.statement === proposition.statement);
79
+ } while (isDuplicate);
80
+ propositions.push(proposition);
81
+ }
82
+ // Mélange des propositions
83
+ return (0, shuffle_1.shuffle)(propositions);
84
+ };
57
85
  const question = {
58
86
  startStatement: statementTree.toTex(),
59
87
  answer: (0, round_1.round)(answer, 2) + '',
60
88
  keys: [],
89
+ getPropositions,
61
90
  };
62
91
  return question;
63
92
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mentalMultiplications.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/mentalCaluls.ts/mentalMultiplications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CAmCnD"}
1
+ {"version":3,"file":"mentalMultiplications.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/mentalCaluls.ts/mentalMultiplications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU3E,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CAkEnD"}
@@ -7,6 +7,8 @@ const round_1 = require("../../../math/utils/round");
7
7
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
8
8
  const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
9
9
  const coinFlip_1 = require("../../../utils/coinFlip");
10
+ const shuffle_1 = require("../../../utils/shuffle");
11
+ const uuid_1 = require("uuid");
10
12
  exports.mentalMultiplications = {
11
13
  id: 'mentalMultiplications',
12
14
  connector: '=',
@@ -41,10 +43,34 @@ function getMentalMultiplications() {
41
43
  answer = numbers[2] * numbers[3] * numbers[4];
42
44
  }
43
45
  statementTree.shuffle();
46
+ const getPropositions = (n) => {
47
+ const propositions = [];
48
+ propositions.push({
49
+ id: (0, uuid_1.v4)() + '',
50
+ statement: answer.toString(),
51
+ isRightAnswer: true,
52
+ });
53
+ for (let i = 0; i < n - 1; i++) {
54
+ let isDuplicate;
55
+ let proposition;
56
+ do {
57
+ let incorrectAnswer = (0, round_1.round)(answer + ((0, coinFlip_1.coinFlip)() ? 1 : -1) * Math.random() * 10, 2);
58
+ proposition = {
59
+ id: (0, uuid_1.v4)() + '',
60
+ statement: incorrectAnswer.toString(),
61
+ isRightAnswer: false,
62
+ };
63
+ isDuplicate = propositions.some((p) => p.statement === proposition.statement);
64
+ } while (isDuplicate);
65
+ propositions.push(proposition);
66
+ }
67
+ return (0, shuffle_1.shuffle)(propositions);
68
+ };
44
69
  const question = {
45
70
  startStatement: statementTree.toTex(),
46
71
  answer: (0, round_1.round)(answer, 2) + '',
47
72
  keys: [],
73
+ getPropositions,
48
74
  };
49
75
  return question;
50
76
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mentalPercentage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/mentalCaluls.ts/mentalPercentage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK9D,eAAO,MAAM,gBAAgB,EAAE,QAU9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CA6D9C"}
1
+ {"version":3,"file":"mentalPercentage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/mentalCaluls.ts/mentalPercentage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,gBAAgB,EAAE,QAU9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CA2I9C"}
@@ -4,6 +4,8 @@ exports.getMentalPercentage = exports.mentalPercentage = void 0;
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
5
  const randint_1 = require("../../../math/utils/random/randint");
6
6
  const coinFlip_1 = require("../../../utils/coinFlip");
7
+ const shuffle_1 = require("../../../utils/shuffle");
8
+ const uuid_1 = require("uuid");
7
9
  exports.mentalPercentage = {
8
10
  id: 'mentalPercentage',
9
11
  connector: '=',
@@ -57,10 +59,73 @@ function getMentalPercentage() {
57
59
  b = 1000;
58
60
  break;
59
61
  }
62
+ const getPropositions = (n) => {
63
+ const propositions = [];
64
+ propositions.push({
65
+ id: (0, uuid_1.v4)() + '',
66
+ statement: (a * b) / 100 + '',
67
+ isRightAnswer: true,
68
+ });
69
+ for (let i = 0; i < n - 1; i++) {
70
+ let isDuplicate;
71
+ let proposition;
72
+ do {
73
+ switch (rand) {
74
+ case 1: // 10% de 70%
75
+ a = 10 * (0, randint_1.randint)(1, 3);
76
+ b = (0, randint_1.randint)(1, 200);
77
+ break;
78
+ case 2: // 30% de 9
79
+ a = (0, randint_1.randint)(1, 10);
80
+ b = (0, randint_1.randint)(1, 10) * a;
81
+ a *= 10;
82
+ break;
83
+ case 3: // 32% de 10
84
+ a = (0, randint_1.randint)(1, 100);
85
+ b = 10 ** (0, randint_1.randint)(1, 3);
86
+ break;
87
+ case 4: // 14% de 50 ou 230% de 20
88
+ a = (0, coinFlip_1.coinFlip)() ? (0, randint_1.randint)(1, 100) : (0, randint_1.randint)(11, 30) * 10;
89
+ b = (0, coinFlip_1.coinFlip)() ? 20 : 50;
90
+ break;
91
+ case 5: // 12.5% de 72
92
+ a = (0, coinFlip_1.coinFlip)() ? 12.5 : 12.5 + 100;
93
+ b = 8 * (0, randint_1.randint)(1, 25);
94
+ break;
95
+ case 6: // 15% de 90
96
+ a = (0, coinFlip_1.coinFlip)() ? 15 * (0, randint_1.randint)(1, 6) : 30 * (0, randint_1.randint)(1, 4, [2]) + 100;
97
+ b = 3 * (0, randint_1.randint)(1, 10) * 10;
98
+ break;
99
+ case 7: // 20% de x
100
+ a = 20 * (0, randint_1.randint)(1, 12, [5]);
101
+ b = 5 * (0, randint_1.randint)(1, 21);
102
+ break;
103
+ case 8: // 75% de x
104
+ a = 25 * (0, randint_1.randint)(1, 8, [4]);
105
+ b = 4 * (0, randint_1.randint)(1, 75);
106
+ break;
107
+ case 9: //0.5 % de 1000
108
+ a = (0, randint_1.randint)(1, 10) / 10;
109
+ b = 1000;
110
+ break;
111
+ }
112
+ let incorrectAnswer = (a * b) / 100;
113
+ proposition = {
114
+ id: (0, uuid_1.v4)() + '',
115
+ statement: incorrectAnswer.toString(),
116
+ isRightAnswer: false,
117
+ };
118
+ isDuplicate = propositions.some((p) => p.statement === proposition.statement);
119
+ } while (isDuplicate);
120
+ propositions.push(proposition);
121
+ }
122
+ return (0, shuffle_1.shuffle)(propositions);
123
+ };
60
124
  const question = {
61
125
  instruction: `Calculer : $${String(a).replace('.', ',')}\\%$ de $${b}$.`,
62
126
  answer: (a * b) / 100 + '',
63
127
  keys: [],
128
+ getPropositions,
64
129
  };
65
130
  return question;
66
131
  }
@@ -1 +1 @@
1
- {"version":3,"file":"operationsPriorities.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/operations/operationsPriorities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS9D,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAEF,wBAAgB,oBAAoB,IAAI,QAAQ,CA+F/C"}
1
+ {"version":3,"file":"operationsPriorities.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/operations/operationsPriorities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAW3E,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAEF,wBAAgB,oBAAoB,IAAI,QAAQ,CA6H/C"}
@@ -15,6 +15,8 @@ const addNode_1 = require("../../../tree/nodes/operators/addNode");
15
15
  const divideNode_1 = require("../../../tree/nodes/operators/divideNode");
16
16
  const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
17
17
  const coinFlip_1 = require("../../../utils/coinFlip");
18
+ const shuffle_1 = require("../../../utils/shuffle");
19
+ const uuid_1 = require("uuid");
18
20
  exports.operationsPriorities = {
19
21
  id: 'operationsPriorities',
20
22
  connector: '=',
@@ -90,10 +92,33 @@ function getPriorityQuestions() {
90
92
  answer = (a * b * c + d).toString();
91
93
  break;
92
94
  }
95
+ const getPropositions = (n) => {
96
+ const propositions = [];
97
+ propositions.push({
98
+ id: (0, uuid_1.v4)(),
99
+ statement: answer,
100
+ isRightAnswer: true,
101
+ });
102
+ for (let i = 0; i < n - 1; i++) {
103
+ let isDuplicate;
104
+ let proposition;
105
+ do {
106
+ proposition = {
107
+ id: (0, uuid_1.v4)(),
108
+ statement: (0, randint_1.randint)(-100, 100) + '',
109
+ isRightAnswer: false,
110
+ };
111
+ isDuplicate = propositions.some((p) => p.statement === proposition.statement);
112
+ } while (isDuplicate);
113
+ propositions.push(proposition);
114
+ }
115
+ return (0, shuffle_1.shuffle)(propositions);
116
+ };
93
117
  const question = {
94
118
  startStatement,
95
119
  answer,
96
120
  keys: [],
121
+ getPropositions,
97
122
  };
98
123
  return question;
99
124
  }
@@ -1 +1 @@
1
- {"version":3,"file":"operationsPrioritiesWithoutRelative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/operations/operationsPrioritiesWithoutRelative.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS9D,eAAO,MAAM,mCAAmC,EAAE,QAUjD,CAAC;AAEF,wBAAgB,sCAAsC,IAAI,QAAQ,CAiOjE"}
1
+ {"version":3,"file":"operationsPrioritiesWithoutRelative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/operations/operationsPrioritiesWithoutRelative.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAW3E,eAAO,MAAM,mCAAmC,EAAE,QAUjD,CAAC;AAEF,wBAAgB,sCAAsC,IAAI,QAAQ,CA+PjE"}
@@ -15,6 +15,8 @@ const addNode_1 = require("../../../tree/nodes/operators/addNode");
15
15
  const divideNode_1 = require("../../../tree/nodes/operators/divideNode");
16
16
  const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
17
17
  const coinFlip_1 = require("../../../utils/coinFlip");
18
+ const shuffle_1 = require("../../../utils/shuffle");
19
+ const uuid_1 = require("uuid");
18
20
  exports.operationsPrioritiesWithoutRelative = {
19
21
  id: 'operationsPrioritiesWithoutRelative',
20
22
  connector: '=',
@@ -171,10 +173,33 @@ function getOperationsPrioritiesWithoutRelative() {
171
173
  }
172
174
  break;
173
175
  }
176
+ const getPropositions = (n) => {
177
+ const propositions = [];
178
+ propositions.push({
179
+ id: (0, uuid_1.v4)(),
180
+ statement: answer,
181
+ isRightAnswer: true,
182
+ });
183
+ for (let i = 0; i < n - 1; i++) {
184
+ let isDuplicate;
185
+ let proposition;
186
+ do {
187
+ proposition = {
188
+ id: (0, uuid_1.v4)(),
189
+ statement: (0, randint_1.randint)(1, 50) + '',
190
+ isRightAnswer: false,
191
+ };
192
+ isDuplicate = propositions.some((p) => p.statement === proposition.statement);
193
+ } while (isDuplicate);
194
+ propositions.push(proposition);
195
+ }
196
+ return (0, shuffle_1.shuffle)(propositions);
197
+ };
174
198
  const question = {
175
199
  startStatement,
176
200
  answer,
177
201
  keys: [],
202
+ getPropositions,
178
203
  };
179
204
  return question;
180
205
  }
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const proportionalityTable: Exercise;
3
+ export declare function getProportionalityTable(): Question;
4
+ //# sourceMappingURL=proportionalityTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proportionalityTable.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/proportionality/proportionalityTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,QAAQ,CAoElD"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProportionalityTable = exports.proportionalityTable = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const randint_1 = require("../../../math/utils/random/randint");
6
+ const shuffle_1 = require("../../../utils/shuffle");
7
+ const uuid_1 = require("uuid");
8
+ exports.proportionalityTable = {
9
+ id: 'proportionalityTable',
10
+ connector: '=',
11
+ instruction: '',
12
+ label: 'Calculs de fréquences marginales et conditionnelles',
13
+ levels: ['1', '0'],
14
+ isSingleStep: false,
15
+ section: 'Probabilités',
16
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getProportionalityTable, nb),
17
+ keys: ['f', 'cap', 'underscore'],
18
+ };
19
+ function getProportionalityTable() {
20
+ const fact = (0, randint_1.randint)(2, 10);
21
+ let [x1, x2] = [1, 2].map((el) => (0, randint_1.randint)(1, 100 / fact));
22
+ let [x3, x4] = [x1 * fact, x2 * fact];
23
+ let answer;
24
+ const randQuation = (0, randint_1.randint)(0, 4);
25
+ switch (randQuation) {
26
+ case 0:
27
+ answer = x1;
28
+ x1 = '?';
29
+ break;
30
+ case 1:
31
+ answer = x2;
32
+ x2 = '?';
33
+ break;
34
+ case 2:
35
+ answer = x3;
36
+ x3 = '?';
37
+ break;
38
+ case 3:
39
+ answer = x4;
40
+ x4 = '?';
41
+ break;
42
+ }
43
+ const getPropositions = (n) => {
44
+ const res = [];
45
+ res.push({
46
+ id: (0, uuid_1.v4)() + '',
47
+ statement: answer + '',
48
+ isRightAnswer: true,
49
+ });
50
+ for (let i = 0; i < n - 1; i++) {
51
+ let isDuplicate;
52
+ let proposition;
53
+ do {
54
+ proposition = {
55
+ id: (0, uuid_1.v4)() + '',
56
+ statement: answer + (0, randint_1.randint)(-answer + 1, 20, [0]) + '',
57
+ isRightAnswer: false,
58
+ };
59
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
60
+ } while (isDuplicate);
61
+ res.push(proposition);
62
+ }
63
+ return (0, shuffle_1.shuffle)(res);
64
+ };
65
+ const question = {
66
+ instruction: `On considère le tableau de proportionnalité suivant :
67
+
68
+ | |A|B|
69
+ |-|-|-|
70
+ |C|${x1}|${x3}|
71
+ |D|${x2}|${x4}|`,
72
+ answer: answer + '',
73
+ keys: ['f', 'cap', 'underscore'],
74
+ getPropositions,
75
+ };
76
+ return question;
77
+ }
78
+ exports.getProportionalityTable = getProportionalityTable;
@@ -1 +1 @@
1
- {"version":3,"file":"rounding.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/rounding/rounding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK9D;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,QAUzB,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,QAS5B,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAS7B,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAS7B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,QAS1B,CAAC;AASF,wBAAgB,iBAAiB,CAAC,cAAc,GAAE,MAAU,GAAG,QAAQ,CAUtE"}
1
+ {"version":3,"file":"rounding.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/rounding/rounding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ3E;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,QAUzB,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,QAS5B,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAS7B,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAS7B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,QAS1B,CAAC;AASF,wBAAgB,iBAAiB,CAAC,cAAc,GAAE,MAAU,GAAG,QAAQ,CAoEtE"}
@@ -4,6 +4,9 @@ exports.getRoundQuestions = exports.allRoundings = exports.roundToMillieme = exp
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
5
  const decimal_1 = require("../../../math/numbers/decimals/decimal");
6
6
  const randint_1 = require("../../../math/utils/random/randint");
7
+ const round_1 = require("../../../math/utils/round");
8
+ const shuffle_1 = require("../../../utils/shuffle");
9
+ const uuid_1 = require("uuid");
7
10
  /**
8
11
  * arrondi à l'unité
9
12
  */
@@ -76,11 +79,57 @@ const instructions = [
76
79
  function getRoundQuestions(precisionAsked = 0) {
77
80
  const precision = (0, randint_1.randint)(precisionAsked + 1, precisionAsked + 5);
78
81
  const dec = decimal_1.DecimalConstructor.random(0, 1000, precision);
82
+ const getPropositions = (n) => {
83
+ const res = [];
84
+ res.push({
85
+ id: (0, uuid_1.v4)() + '',
86
+ statement: dec.round(precisionAsked).toTree().toTex(),
87
+ isRightAnswer: true,
88
+ });
89
+ res.push({
90
+ id: (0, uuid_1.v4)() + '',
91
+ statement: (0, round_1.round)(dec.value, precisionAsked) === (0, round_1.round)(dec.value + 0.5 * 10 ** -precisionAsked, precisionAsked)
92
+ ? (0, round_1.round)(dec.value - 0.5 * 10 ** -precisionAsked, precisionAsked) + ''
93
+ : (0, round_1.round)(dec.value + 0.5 * 10 ** -precisionAsked, precisionAsked) + '',
94
+ isRightAnswer: false,
95
+ });
96
+ if (n > 2)
97
+ res.push({
98
+ id: (0, uuid_1.v4)() + '',
99
+ statement: dec.toTree().toTex(),
100
+ isRightAnswer: false,
101
+ });
102
+ if (n > 3 && dec.decimalPart.length !== precisionAsked + 1)
103
+ res.push({
104
+ id: (0, uuid_1.v4)() + '',
105
+ statement: dec
106
+ .round(precisionAsked + 1)
107
+ .toTree()
108
+ .toTex(),
109
+ isRightAnswer: false,
110
+ });
111
+ for (let i = 0; dec.decimalPart.length !== precisionAsked + 1 ? i < n - 4 : i < n - 3; i++) {
112
+ let isDuplicate;
113
+ let proposition;
114
+ do {
115
+ proposition = {
116
+ id: (0, uuid_1.v4)() + '',
117
+ statement: decimal_1.DecimalConstructor.random(0, 1000, precision).toTree().toTex(),
118
+ isRightAnswer: false,
119
+ };
120
+ console.log(proposition);
121
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
122
+ } while (isDuplicate);
123
+ res.push(proposition);
124
+ }
125
+ return (0, shuffle_1.shuffle)(res);
126
+ };
79
127
  const question = {
80
128
  instruction: instructions[precisionAsked],
81
129
  startStatement: dec.toTree().toTex(),
82
130
  answer: dec.round(precisionAsked).toTree().toTex(),
83
131
  keys: [],
132
+ getPropositions,
84
133
  };
85
134
  return question;
86
135
  }
@@ -1 +1 @@
1
- {"version":3,"file":"doubleDistributivity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/distributivity/doubleDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CAY1D"}
1
+ {"version":3,"file":"doubleDistributivity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/distributivity/doubleDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAW3E,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CAgE1D"}
@@ -6,7 +6,10 @@ const integer_1 = require("../../../math/numbers/integer/integer");
6
6
  const affine_1 = require("../../../math/polynomials/affine");
7
7
  const discreteSet_1 = require("../../../math/sets/discreteSet");
8
8
  const intervals_1 = require("../../../math/sets/intervals/intervals");
9
+ const randint_1 = require("../../../math/utils/random/randint");
9
10
  const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
11
+ const shuffle_1 = require("../../../utils/shuffle");
12
+ const uuid_1 = require("uuid");
10
13
  exports.doubleDistributivity = {
11
14
  id: 'doubleDistri',
12
15
  connector: '=',
@@ -23,10 +26,52 @@ function getDoubleDistributivityQuestion() {
23
26
  const affines = affine_1.AffineConstructor.differentRandoms(2, interval, interval);
24
27
  const statementTree = new multiplyNode_1.MultiplyNode(affines[0].toTree(), affines[1].toTree());
25
28
  const answerTree = affines[0].multiply(affines[1]).toTree();
29
+ const getPropositions = (n) => {
30
+ const res = [];
31
+ res.push({
32
+ id: (0, uuid_1.v4)() + '',
33
+ statement: answerTree.toTex(),
34
+ isRightAnswer: true,
35
+ });
36
+ res.push({
37
+ id: (0, uuid_1.v4)() + '',
38
+ statement: affines[0]
39
+ .multiply(new affine_1.Affine(-affines[1].a, (0, randint_1.randint)(-9, 10, [affines[1].b])))
40
+ .toTree()
41
+ .toTex(),
42
+ isRightAnswer: false,
43
+ });
44
+ if (n > 2)
45
+ res.push({
46
+ id: (0, uuid_1.v4)() + '',
47
+ statement: affines[1]
48
+ .multiply(new affine_1.Affine((0, randint_1.randint)(-9, 10, [affines[0].a]), affines[0].b))
49
+ .toTree()
50
+ .toTex(),
51
+ isRightAnswer: false,
52
+ });
53
+ for (let i = 0; i < n - 3; i++) {
54
+ let isDuplicate;
55
+ let proposition;
56
+ do {
57
+ const affinesTemps = affine_1.AffineConstructor.differentRandoms(2, interval, interval);
58
+ const wrongAnswer = affinesTemps[0].multiply(affinesTemps[1]).toTree();
59
+ proposition = {
60
+ id: (0, uuid_1.v4)() + '',
61
+ statement: wrongAnswer.toTex(),
62
+ isRightAnswer: false,
63
+ };
64
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
65
+ } while (isDuplicate);
66
+ res.push(proposition);
67
+ }
68
+ return (0, shuffle_1.shuffle)(res);
69
+ };
26
70
  return {
27
71
  startStatement: statementTree.toTex(),
28
72
  answer: answerTree.toTex(),
29
73
  keys: ['x'],
74
+ getPropositions,
30
75
  };
31
76
  }
32
77
  exports.getDoubleDistributivityQuestion = getDoubleDistributivityQuestion;
@@ -1 +1 @@
1
- {"version":3,"file":"firstIdentity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/distributivity/firstIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS9D,eAAO,MAAM,aAAa,EAAE,QAU3B,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CAYnD"}
1
+ {"version":3,"file":"firstIdentity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/distributivity/firstIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAY3E,eAAO,MAAM,aAAa,EAAE,QAU3B,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CAgEnD"}
@@ -4,10 +4,13 @@ exports.getFirstIdentityQuestion = exports.firstIdentity = void 0;
4
4
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
5
  const integer_1 = require("../../../math/numbers/integer/integer");
6
6
  const affine_1 = require("../../../math/polynomials/affine");
7
+ const polynomial_1 = require("../../../math/polynomials/polynomial");
7
8
  const discreteSet_1 = require("../../../math/sets/discreteSet");
8
9
  const intervals_1 = require("../../../math/sets/intervals/intervals");
9
10
  const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
10
11
  const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
12
+ const shuffle_1 = require("../../../utils/shuffle");
13
+ const uuid_1 = require("uuid");
11
14
  exports.firstIdentity = {
12
15
  id: 'idRmq1',
13
16
  connector: '=',
@@ -24,10 +27,52 @@ function getFirstIdentityQuestion() {
24
27
  const affine = affine_1.AffineConstructor.random(interval, interval);
25
28
  const statementTree = new powerNode_1.PowerNode(affine.toTree(), new numberNode_1.NumberNode(2));
26
29
  const answerTree = affine.multiply(affine).toTree();
30
+ const getPropositions = (n) => {
31
+ const res = [];
32
+ res.push({
33
+ id: (0, uuid_1.v4)() + '',
34
+ statement: answerTree.toTex(),
35
+ isRightAnswer: true,
36
+ });
37
+ res.push({
38
+ id: (0, uuid_1.v4)() + '',
39
+ statement: new polynomial_1.Polynomial([affine.b ** 2, 0, affine.a ** 2]).toTree().toTex(),
40
+ isRightAnswer: false,
41
+ });
42
+ if (n > 2)
43
+ res.push({
44
+ id: (0, uuid_1.v4)() + '',
45
+ statement: new polynomial_1.Polynomial([affine.b ** 2, affine.a * affine.b, affine.a ** 2]).toTree().toTex(),
46
+ isRightAnswer: false,
47
+ });
48
+ if (n > 3)
49
+ res.push({
50
+ id: (0, uuid_1.v4)() + '',
51
+ statement: new polynomial_1.Polynomial([affine.b ** 2, affine.a ** 2 + affine.b ** 2, affine.a ** 2]).toTree().toTex(),
52
+ isRightAnswer: false,
53
+ });
54
+ for (let i = 0; i < n - 4; i++) {
55
+ let isDuplicate;
56
+ let proposition;
57
+ do {
58
+ const affineTemp = affine_1.AffineConstructor.random(interval, interval);
59
+ const wrongAnswer = affine.multiply(affineTemp).toTree();
60
+ proposition = {
61
+ id: (0, uuid_1.v4)() + '',
62
+ statement: wrongAnswer.toTex(),
63
+ isRightAnswer: false,
64
+ };
65
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
66
+ } while (isDuplicate);
67
+ res.push(proposition);
68
+ }
69
+ return (0, shuffle_1.shuffle)(res);
70
+ };
27
71
  return {
28
72
  startStatement: statementTree.toTex(),
29
73
  answer: answerTree.toTex(),
30
74
  keys: ['x'],
75
+ getPropositions,
31
76
  };
32
77
  }
33
78
  exports.getFirstIdentityQuestion = getFirstIdentityQuestion;
@@ -1 +1 @@
1
- {"version":3,"file":"secondIdentity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/distributivity/secondIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS9D,eAAO,MAAM,cAAc,EAAE,QAU5B,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CAapD"}
1
+ {"version":3,"file":"secondIdentity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/distributivity/secondIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAY3E,eAAO,MAAM,cAAc,EAAE,QAU5B,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CAiEpD"}