math-exercises 3.0.128 → 3.0.129

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 (22) hide show
  1. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.js +2 -17
  3. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts +4 -1
  4. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +34 -10
  6. package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +2 -6
  7. package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +81 -191
  9. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts.map +1 -1
  10. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.js +1 -4
  11. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +1 -1
  12. package/lib/exercises/math/conversion/minutesToHours.d.ts.map +1 -1
  13. package/lib/exercises/math/conversion/minutesToHours.js +6 -3
  14. package/lib/exercises/math/conversion/secondsToHours.d.ts.map +1 -1
  15. package/lib/exercises/math/conversion/secondsToHours.js +6 -3
  16. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -1
  17. package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +5 -5
  18. package/lib/index.d.ts +6 -8
  19. package/lib/index.d.ts.map +1 -1
  20. package/lib/tests/questionTest.d.ts.map +1 -1
  21. package/lib/tests/questionTest.js +4 -2
  22. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"compareABUsingQuotient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareABUsingQuotient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,eAAe,EAAE,CAAC;CACnC,CAAC;AA+IF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAgBxD,CAAC"}
1
+ {"version":3,"file":"compareABUsingQuotient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareABUsingQuotient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,eAAe,EAAE,CAAC;CACnC,CAAC;AA2HF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAgBxD,CAAC"}
@@ -44,21 +44,6 @@ const getAnswer = (identifiers) => {
44
44
  const [A, B] = orderedNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).toTex());
45
45
  return `${B}>${A}`;
46
46
  };
47
- const isAnswerValid = (ans, { ...identifiers }) => {
48
- const { orderedNodeIds } = identifiers;
49
- const [A, B] = orderedNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).toTex());
50
- const compSymbol = ans.includes(">")
51
- ? ">"
52
- : ans.includes("<")
53
- ? "<"
54
- : undefined;
55
- if (!compSymbol) {
56
- return false;
57
- }
58
- else {
59
- return (compSymbol === ">" ? [B, A] : [A, B]).every((tex, i) => tex === ans.split(compSymbol)[i]);
60
- }
61
- };
62
47
  const getPropositions = (nbProps, { ...identifiers }) => {
63
48
  const { orderedNodeIds } = identifiers;
64
49
  const [A, B] = orderedNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).toTex());
@@ -88,7 +73,7 @@ const getKeys = (identifiers) => {
88
73
  };
89
74
  const getCompareABUsingQuotientQuestion = () => {
90
75
  const n = randint(2, 150);
91
- const orderedNodesIncreasing = [add(1, sqrt(add(1, n))), add(2, sqrt(n))];
76
+ const orderedNodesIncreasing = [add(1, sqrt(1 + n)), add(2, sqrt(n))];
92
77
  return getQuestionFromIdentifiers({
93
78
  orderedNodeIds: orderedNodesIncreasing.map((node) => node.toIdentifiers()),
94
79
  });
@@ -113,10 +98,10 @@ export const compareABUsingQuotient = {
113
98
  qcmTimer: 60,
114
99
  freeTimer: 60,
115
100
  getPropositions,
116
- isAnswerValid,
117
101
  getAnswer,
118
102
  subject: "Mathématiques",
119
103
  maxAllowedQuestions: 30,
120
104
  getQuestionFromIdentifiers,
121
105
  hasHintAndCorrection: true,
106
+ answerType: "QCU",
122
107
  };
@@ -4,6 +4,9 @@ type Identifiers = {
4
4
  nodeIds: NodeIdentifiers[];
5
5
  texAnswers: string[];
6
6
  };
7
- export declare const compareFracABWithFracAPlusCBPlusC: Exercise<Identifiers>;
7
+ type Options = {
8
+ isFracOfSums: boolean;
9
+ };
10
+ export declare const compareFracABWithFracAPlusCBPlusC: Exercise<Identifiers, Options>;
8
11
  export {};
9
12
  //# sourceMappingURL=compareFracABWithFracAPlusCBPlusC.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compareFracABWithFracAPlusCBPlusC.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA4LF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAmBnE,CAAC"}
1
+ {"version":3,"file":"compareFracABWithFracAPlusCBPlusC.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA0MF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAgBF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqB1E,CAAC"}
@@ -1,9 +1,9 @@
1
- import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
1
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { lcm } from "../../../../math/utils/arithmetic/lcm.js";
4
4
  import { randint } from "../../../../math/utils/random/randint.js";
5
5
  import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
6
- import { add } from "../../../../tree/nodes/operators/addNode.js";
6
+ import { add, isAddNode } from "../../../../tree/nodes/operators/addNode.js";
7
7
  import { frac, isFractionNode, } from "../../../../tree/nodes/operators/fractionNode.js";
8
8
  import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
9
9
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
@@ -33,12 +33,17 @@ const getCorrection = (identifiers) => {
33
33
  ? frac(multiply(node.leftChild.simplify(), frac(sameDen, node.rightChild)).simplify(), sameDen)
34
34
  : frac(multiply(node, sameDen).simplify(), sameDen));
35
35
  const answer = getAnswer(identifiers);
36
- return `On a :
36
+ const isFracOfSums = isAddNode(nodes[1].leftChild);
37
+ return `${isFracOfSums
38
+ ? `On a :
37
39
 
38
40
  $$
39
41
  ${nodes[1].toSimplificationTex()}
40
42
  $$
41
43
 
44
+ `
45
+ : ``}
46
+
42
47
  On veut donc comparer $${nodesSimplified[0].toTex()}$ et $${nodesSimplified[1].toTex()}$.
43
48
 
44
49
  On peut choisir $${sameDen.frenchify()}$ comme dénominateur commun.
@@ -84,14 +89,19 @@ const getAnswer = (identifiers) => {
84
89
  const { texAnswers } = identifiers;
85
90
  return texAnswers[0];
86
91
  };
87
- const isAnswerValid = (ans, { texAnswers }) => {
88
- return texAnswers.includes(ans);
89
- };
90
- const getCompareFracABWithFracAPlusCBPlusCQuestion = () => {
92
+ const getCompareFracABWithFracAPlusCBPlusCQuestion = (optsIn) => {
93
+ const opts = optsIn ?? optsDefault;
91
94
  const a = randint(1, 10);
92
- const b = randint(1, 10, [a]);
95
+ const b = randint(2, 10, [a]);
93
96
  const c = randint(1, 10);
94
- const nodes = [frac(a, b), frac(add(a, c), add(b, c))];
97
+ const nodes = [
98
+ frac(a, b),
99
+ (() => {
100
+ const nodeNum = opts.isFracOfSums ? add(a, c) : (a + c).toTree();
101
+ const nodeDec = opts.isFracOfSums ? add(b, c) : (b + c).toTree();
102
+ return frac(nodeNum, nodeDec);
103
+ })(),
104
+ ];
95
105
  const isOrderAsc = coinFlip();
96
106
  const sortedNodes = nodes.toSorted((node1, node2) => (isOrderAsc ? +1 : -1) * (node1.evaluate() - node2.evaluate()));
97
107
  const texAnswers = [
@@ -132,17 +142,31 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
132
142
  };
133
143
  return question;
134
144
  };
145
+ const optsDefault = {
146
+ isFracOfSums: false,
147
+ };
148
+ const options = [
149
+ {
150
+ id: "isFracOfSums",
151
+ label: "Fraction de sommes ?",
152
+ target: GeneratorOptionTarget.generation,
153
+ type: GeneratorOptionType.checkbox,
154
+ values: [true, false],
155
+ defaultValue: optsDefault.isFracOfSums,
156
+ },
157
+ ];
135
158
  export const compareFracABWithFracAPlusCBPlusC = {
136
159
  id: "compareFracABWithFracAPlusCBPlusC",
137
160
  label: "Effectuer des comparaisons entre des fractions simples (de la forme $\\frac{a}{b}$ et $\\frac{a+c}{b+c}$)",
138
161
  isSingleStep: true,
139
162
  generator: (nb, opts) => getDistinctQuestions(() => getCompareFracABWithFracAPlusCBPlusCQuestion(opts), nb, 30),
163
+ options,
140
164
  qcmTimer: 60,
141
165
  freeTimer: 60,
142
- isAnswerValid,
143
166
  getPropositions,
144
167
  subject: "Mathématiques",
145
168
  maxAllowedQuestions: 30,
146
169
  getQuestionFromIdentifiers,
147
170
  hasHintAndCorrection: true,
171
+ answerType: "QCU",
148
172
  };
@@ -5,18 +5,14 @@ type QCMItem = {
5
5
  isValidAnswer: boolean;
6
6
  };
7
7
  type QuestionParam = {
8
- fakeName: string;
8
+ letter: string;
9
9
  trueName: string;
10
10
  tex: string;
11
11
  nodeIds: NodeIdentifiers;
12
12
  explainTex: string;
13
13
  };
14
14
  type Identifiers = {
15
- sign: number;
16
- a: number;
17
- b: number;
18
- c: number;
19
- dictFakeNameToQuestionParam: Record<string, QuestionParam>;
15
+ questionParams: QuestionParam[];
20
16
  items: QCMItem[];
21
17
  };
22
18
  type Options = {
@@ -1 +1 @@
1
- {"version":3,"file":"compareFracAndDec.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareFracAndDec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC3D,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB,CAAC;AAkYF,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,yBAAyB,EAAE,OAAO,CAAC;CACpC,CAAC;AA+BF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB5D,CAAC"}
1
+ {"version":3,"file":"compareFracAndDec.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareFracAndDec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB,CAAC;AA0SF,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,yBAAyB,EAAE,OAAO,CAAC;CACpC,CAAC;AAuBF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB5D,CAAC"}
@@ -2,44 +2,39 @@ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrong
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { randint } from "../../../../math/utils/random/randint.js";
4
4
  import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
5
- import { add } from "../../../../tree/nodes/operators/addNode.js";
6
5
  import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
6
  import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
8
7
  import { substract } from "../../../../tree/nodes/operators/substractNode.js";
9
8
  import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
10
9
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
11
- import { random, randomMany } from "../../../../utils/alea/random.js";
10
+ import { random } from "../../../../utils/alea/random.js";
12
11
  import { shuffle } from "../../../../utils/alea/shuffle.js";
13
12
  import { permute } from "../../../../utils/arrays/permutations.js";
14
- const getDecimalFormatTex = (questionParam) => {
15
- return NodeConstructor.fromIdentifiers(questionParam.nodeIds)
16
- .evaluate()
17
- .frenchify();
18
- };
19
13
  const getInstruction = (identifiers, optsIn) => {
20
- const { dictFakeNameToQuestionParam } = identifiers;
14
+ const { questionParams } = identifiers;
21
15
  const opts = Object.assign(optsDefault, optsIn);
22
16
  return `Voici trois nombres.
23
17
 
24
18
  ${opts.isUseABC
25
- ? Object.entries(dictFakeNameToQuestionParam)
26
- .toSorted(([fakeName1], [fakeName2]) => fakeName1.localeCompare(fakeName2))
27
- .map(([fakeName, questionParam]) => {
28
- return `
19
+ ? (() => {
20
+ const entries = questionParams.map((qP) => [qP.letter, qP]);
21
+ return entries
22
+ .toSorted(([letter1], [letter2]) => letter1.localeCompare(letter2))
23
+ .map(([letter, questionParam]) => {
24
+ return `
29
25
 
30
26
  $$
31
- ${fakeName} = ${questionParam.tex}
27
+ ${letter} = ${questionParam.tex}
32
28
  $$
33
29
 
34
30
  `;
35
- })
36
- .join("")
31
+ })
32
+ .join("");
33
+ })()
37
34
  : `
38
35
 
39
36
  $$
40
- ${Object.values(dictFakeNameToQuestionParam)
41
- .map((questionParam) => questionParam.tex)
42
- .join(" ; ")}
37
+ ${questionParams.map((questionParam) => questionParam.tex).join(" ; ")}
43
38
  $$
44
39
 
45
40
  `}
@@ -52,116 +47,48 @@ const getHint = () => {
52
47
  soit les mettre au même dénominateur.`;
53
48
  };
54
49
  const getCorrection = (identifiers, optsIn) => {
55
- const { sign, a, dictFakeNameToQuestionParam } = identifiers;
56
- const opts = Object.assign(optsDefault, optsIn);
57
- const dictTrueNameToQuestionParam = Object.fromEntries(Object.entries(dictFakeNameToQuestionParam).map(([, questionParam]) => [
58
- questionParam.trueName,
59
- questionParam,
60
- ]));
61
- const letters = Object.keys(dictTrueNameToQuestionParam).toSorted((s1, s2) => s1.localeCompare(s2));
62
- const [A, B, C] = letters.map((trueName) => {
63
- const questionParam = dictTrueNameToQuestionParam[trueName];
64
- return opts.isUseABC ? questionParam.fakeName : questionParam.tex;
50
+ const { questionParams } = identifiers;
51
+ const opts = optsIn ?? optsDefault;
52
+ const ascOrderedQuestionParams = questionParams.toSorted((questionParam1, questionParam2) => {
53
+ const [node1, node2] = [questionParam1, questionParam2].map((questionParam) => NodeConstructor.fromIdentifiers(questionParam.nodeIds));
54
+ return substract(node1, node2).evaluate();
65
55
  });
66
- return `
67
-
68
- ${(() => {
69
- if (opts.nbDecimalFormat > 0) {
70
- return `On a :
71
-
72
- ${letters
73
- .toSorted((trueName1, trueName2) => {
74
- const [fakeName1, fakeName2] = [trueName1, trueName2].map((trueName) => dictTrueNameToQuestionParam[trueName].fakeName);
75
- return fakeName1.localeCompare(fakeName2);
76
- })
77
- .map((trueName) => {
78
- const questionParam = dictTrueNameToQuestionParam[trueName];
79
- return questionParam.explainTex;
80
- })
81
- .join("")}`;
82
- }
83
- else {
84
- return `On a :
56
+ return `On a :
57
+ ${questionParams
58
+ .toSorted((qp1, qp2) => qp1.letter.localeCompare(qp2.letter))
59
+ .map((questionParam) => questionParam.explainTex.length > 0 &&
60
+ `
85
61
 
86
62
  $$
87
- ${A} = ${sign === +1 ? `` : `-`}\\frac{${a} \\times 20}{5 \\times 20} = ${sign === +1 ? `` : `-`}\\frac{${20 * a}}{100}
63
+ ${questionParam.explainTex}
88
64
  $$
89
65
 
90
- De plus :
91
-
92
- $$
93
- ${A} = ${sign === +1 ? `` : `-`}\\frac{${a} \\times 2}{5 \\times 2} = ${sign === +1 ? `` : `-`}\\frac{${2 * a}}{10}
94
- $$
95
-
96
- Ainsi :
97
-
98
- ${(() => {
99
- if (sign === +1) {
100
- return `
101
-
102
- $$
103
- ${dictTrueNameToQuestionParam["C"].tex} > \\frac{${2 * a}}{10} = \\frac{${20 * a}}{100} > ${dictTrueNameToQuestionParam["B"].tex}
104
- $$
105
-
106
- `;
107
- }
108
- else {
109
- return `
110
-
111
- $$
112
- ${dictTrueNameToQuestionParam["B"].tex} > -\\frac{${20 * a}}{100} = -\\frac{${2 * a}}{10} > ${dictTrueNameToQuestionParam["C"].tex}
113
- $$
114
-
115
- `;
116
- }
117
- })()}
118
- `;
119
- }
120
- })()}
121
-
122
-
123
- Or :
124
-
125
- ${(() => {
126
- if (sign === +1) {
127
- return `
128
-
129
- $$
130
- ${getDecimalFormatTex(dictTrueNameToQuestionParam["C"])}
131
- >
132
- ${getDecimalFormatTex(dictTrueNameToQuestionParam["A"])}
133
- >
134
- ${getDecimalFormatTex(dictTrueNameToQuestionParam["B"])}
135
- $$
136
-
137
- Le classement par ordre décroissant est donc :
66
+ `)
67
+ .join("")}
68
+
69
+ Le classement par ordre décroissant est donc :
138
70
 
139
71
  $$
140
- ${C} > ${A} > ${B}
72
+ ${ascOrderedQuestionParams
73
+ .toReversed()
74
+ .map((questionParam) => questionParam.tex)
75
+ .join(">")}
141
76
  $$
142
77
 
143
- `;
144
- }
145
- else {
146
- return `
147
-
148
- $$
149
- ${getDecimalFormatTex(dictTrueNameToQuestionParam["B"])}
150
- >
151
- ${getDecimalFormatTex(dictTrueNameToQuestionParam["A"])}
152
- >
153
- ${getDecimalFormatTex(dictTrueNameToQuestionParam["C"])}
154
- $$
155
-
156
- Le classement par ordre décroissant est donc :
157
-
78
+ ${opts.isUseABC
79
+ ? `
80
+
158
81
  $$
159
- ${B} > ${A} > ${C}
82
+ ${ascOrderedQuestionParams
83
+ .toReversed()
84
+ .map((questionParam) => questionParam.letter)
85
+ .join(">")}
160
86
  $$
87
+
88
+ `
89
+ : ``}
161
90
 
162
- `;
163
- }
164
- })()}`;
91
+ `;
165
92
  };
166
93
  const getPropositions = (_, { answer, ...identifiers }) => {
167
94
  const { items } = identifiers;
@@ -184,16 +111,16 @@ const getAnswer = (identifiers) => {
184
111
  const isAnswerValid = (ans, { answer }) => {
185
112
  const [ansNodes, answerNodes] = [ans, answer].map((str) => str.split(">").map((tex) => parseAlgebraic(tex)));
186
113
  return (ansNodes.length === 3 &&
187
- [0, 1, 2].every((i) => ansNodes[i].equals(answerNodes[i])));
114
+ [0, 1, 2].every((i) => substract(ansNodes[i], answerNodes[i]).evaluate() === 0));
188
115
  };
189
116
  const getKeys = (identifiers, optsIn) => {
190
- const { dictFakeNameToQuestionParam } = identifiers;
117
+ const { questionParams } = identifiers;
191
118
  const opts = Object.assign(optsDefault, optsIn);
192
119
  return [
193
120
  "sup",
194
121
  "inf",
195
- ...Object.values(dictFakeNameToQuestionParam).map((questionParam) => {
196
- const tex = opts.isUseABC ? questionParam.fakeName : questionParam.tex;
122
+ ...questionParams.map((questionParam) => {
123
+ const tex = opts.isUseABC ? questionParam.letter : questionParam.tex;
197
124
  return {
198
125
  id: "custom",
199
126
  label: tex,
@@ -208,85 +135,60 @@ const getKeys = (identifiers, optsIn) => {
208
135
  };
209
136
  const getCompareFracAndDecQuestion = (optsIn) => {
210
137
  const opts = Object.assign(optsDefault, optsIn);
211
- const sign = opts.isAllowingNegativeNumbers ? (coinFlip() ? +1 : -1) : +1;
138
+ function randomSign() {
139
+ return opts.isAllowingNegativeNumbers ? (coinFlip() ? +1 : -1) : +1;
140
+ }
212
141
  const a = random([...Array(19).keys()].map((i) => i + 1).filter((i) => i % 5 !== 0));
213
142
  const b = randint(1, a - 1);
214
- const c = random([...Array(99).keys()].map((i) => i + 1));
215
- const nodes = {
216
- A: frac(a, 5),
217
- B: frac(substract(multiply(20, a), b).simplify(), 100),
218
- C: frac(add(multiply(2, a), c).simplify(), 10)
219
- .evaluate()
220
- .toTree(),
221
- };
222
- Object.keys(nodes).forEach((letter) => {
223
- nodes[letter] = multiply(sign, nodes[letter]);
224
- });
225
- const dictIsInDecimalFormat = Object.fromEntries(randomMany(["A", "C"], opts.nbDecimalFormat).map((letter) => [
226
- letter,
227
- true,
228
- ]));
143
+ const d = randint(Math.floor(a / 10 + 1), 99);
144
+ const nodes = [
145
+ frac(multiply(randomSign(), a).evaluate(), 5),
146
+ frac(multiply(randomSign(), substract(multiply(20, a), b).evaluate()).simplify(), 100),
147
+ multiply(randomSign(), `0,${d}`.unfrenchify().toTree()).simplify(),
148
+ ];
229
149
  const nbTotal = 4;
230
150
  const nbValid = 1;
231
151
  const nbInvalid = nbTotal - nbValid;
232
- const letters = Object.keys(nodes).toSorted((s1, s2) => s1.localeCompare(s2));
152
+ const letters = ["A", "B", "C"];
233
153
  const shuffledLetters = shuffle(letters);
234
- const dictFakeNameToQuestionParam = Object.fromEntries(letters.map((trueName, i) => {
235
- const node = nodes[trueName];
236
- const fakeName = shuffledLetters[i];
154
+ const dictLetterToQuestionParam = Object.fromEntries(shuffledLetters.map((letter, i) => {
155
+ const node = nodes[i];
237
156
  return [
238
- fakeName,
157
+ letter,
239
158
  {
240
- fakeName: fakeName,
241
- trueName: trueName,
159
+ letter,
242
160
  nodeIds: node.toIdentifiers(),
243
- tex: dictIsInDecimalFormat[trueName]
244
- ? node.evaluate().frenchify()
245
- : node.toTex(),
246
- explainTex: (() => {
247
- if (opts.isUseABC || !dictIsInDecimalFormat[trueName]) {
248
- return `
249
-
250
- $$
251
- ${opts.isUseABC ? `${fakeName} =` : ``}${dictIsInDecimalFormat[trueName]
252
- ? ``
253
- : (() => {
254
- if (trueName === "A") {
255
- return `${node.toTex()} =
256
- ${sign === +1 ? `` : `-`}\\frac{${a} \\times 2}{5 \\times 2} =
257
- ${sign === +1 ? `` : `-`}\\frac{${2 * a}}{10} =`;
258
- }
259
- else {
260
- return `${node.toTex()} =`;
261
- }
262
- })()}
263
- ${node.evaluate().frenchify()}
264
- $$
265
-
266
- `;
161
+ tex: node.toTex(),
162
+ explainTex: `${opts.isUseABC ? `${letter} = ` : ``}${(() => {
163
+ const isPositive = nodes[i].evaluate() >= 0;
164
+ const tex = node.toTex();
165
+ const strEv = node.evaluate().frenchify();
166
+ if (i === 0) {
167
+ return `${node.toTex()} =
168
+ ${isPositive ? `` : `-`}\\frac{${a} \\times 2}{5 \\times 2} =
169
+ ${isPositive ? `` : `-`}\\frac{${2 * a}}{10} = ${strEv}`;
267
170
  }
268
171
  else {
269
- return ``;
172
+ return strEv !== tex ? `${tex} = ${strEv}` : ``;
270
173
  }
271
- })(),
174
+ })()}`,
272
175
  },
273
176
  ];
274
177
  }));
275
- const dictTrueNameToQuestionParam = Object.fromEntries(Object.values(dictFakeNameToQuestionParam).map((questionParam) => [
276
- questionParam.trueName,
277
- questionParam,
278
- ]));
279
- const [A, B, C] = letters.map((trueName) => {
280
- const questionParam = dictTrueNameToQuestionParam[trueName];
281
- return opts.isUseABC ? questionParam.fakeName : questionParam.tex;
178
+ const ascOrderedQuestionParams = Object.values(dictLetterToQuestionParam).toSorted((questionParam1, questionParam2) => {
179
+ const [node1, node2] = [questionParam1, questionParam2].map((questionParam) => NodeConstructor.fromIdentifiers(questionParam.nodeIds));
180
+ return substract(node1, node2).evaluate();
282
181
  });
283
182
  const validItems = [
284
183
  {
285
- tex: sign === +1 ? `{${C}}>{${A}}>{${B}}` : `{${B}}>{${A}}>{${C}}`,
184
+ tex: ascOrderedQuestionParams
185
+ .toReversed()
186
+ .map((questionParam) => opts.isUseABC ? questionParam.letter : questionParam.tex)
187
+ .join(">"),
286
188
  isValidAnswer: true,
287
189
  },
288
190
  ];
289
- const invalidItems = permute([A, B, C])
191
+ const invalidItems = permute(ascOrderedQuestionParams.map((questionParam) => opts.isUseABC ? questionParam.letter : questionParam.tex))
290
192
  .filter(([D, E, F]) => `{${D}}>{${E}}>{${F}}` !== validItems[0].tex)
291
193
  .map(([D, E, F]) => {
292
194
  return {
@@ -300,11 +202,7 @@ $$
300
202
  ...shuffle(invalidItems).slice(0, nbInvalid),
301
203
  ]);
302
204
  return getQuestionFromIdentifiers({
303
- sign,
304
- a,
305
- b,
306
- c,
307
- dictFakeNameToQuestionParam,
205
+ questionParams: shuffle(ascOrderedQuestionParams),
308
206
  items,
309
207
  });
310
208
  };
@@ -334,14 +232,6 @@ const options = [
334
232
  type: GeneratorOptionType.checkbox,
335
233
  defaultValue: optsDefault.isUseABC,
336
234
  },
337
- {
338
- id: "nbDecimalFormat",
339
- label: "Nombre d'écritures décimales",
340
- target: GeneratorOptionTarget.generation,
341
- type: GeneratorOptionType.select,
342
- values: [1, 2],
343
- defaultValue: optsDefault.nbDecimalFormat,
344
- },
345
235
  {
346
236
  id: "isAllowingNegativeNumbers",
347
237
  label: "Permettre les nombres négatifs",
@@ -1 +1 @@
1
- {"version":3,"file":"compareFromPiMinusFrac.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAmJF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
1
+ {"version":3,"file":"compareFromPiMinusFrac.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA+IF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
@@ -50,9 +50,6 @@ const getAnswer = (identifiers) => {
50
50
  const { texAnswers } = identifiers;
51
51
  return texAnswers[0];
52
52
  };
53
- const isAnswerValid = (ans, { texAnswers }) => {
54
- return texAnswers.includes(ans);
55
- };
56
53
  const getCompareFromPiMinusFracQuestion = () => {
57
54
  const fracsPool = [
58
55
  frac(31, 10),
@@ -134,10 +131,10 @@ export const compareFromPiMinusFrac = {
134
131
  generator: (nb, opts) => getDistinctQuestions(() => getCompareFromPiMinusFracQuestion(opts), nb, 30),
135
132
  qcmTimer: 60,
136
133
  freeTimer: 60,
137
- isAnswerValid,
138
134
  getPropositions,
139
135
  subject: "Mathématiques",
140
136
  maxAllowedQuestions: 30,
141
137
  getQuestionFromIdentifiers,
142
138
  hasHintAndCorrection: true,
139
+ answerType: "QCU",
143
140
  };
@@ -100,7 +100,7 @@ const options = [
100
100
  export const kmPerMinToKmPerHourConversion = {
101
101
  id: "kmPerMinToKmPerHourConversion",
102
102
  connector: "=",
103
- label: "Effectuer des conversions de vitesse ( $x$ km en $y$ min donne une vitesse $V$ en \\textrm{km/h})",
103
+ label: "Effectuer des conversions de vitesse ( $x$ $\\textrm{km}$ en $y$ $\\textrm{min}$ donne une vitesse $V$ en $\\textrm{km/h}$)",
104
104
  isSingleStep: true,
105
105
  generator: (nb, opts) => getDistinctQuestions(() => getKmPerMinToKmPerHourConversionQuestion(opts), nb),
106
106
  options,
@@ -1 +1 @@
1
- {"version":3,"file":"minutesToHours.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/minutesToHours.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,eAAe,CAAC;IAChC,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AA2LF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAehD,CAAC"}
1
+ {"version":3,"file":"minutesToHours.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/minutesToHours.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,eAAe,CAAC;IAChC,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AA8LF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAehD,CAAC"}
@@ -76,13 +76,16 @@ const getPropositions = (n, { answer, ...identifiers }) => {
76
76
  addValidProp(propositions, answer);
77
77
  if (isMinutesToHours) {
78
78
  const roundedValue = round(hours.evaluate(), 2);
79
- const texDecimal = roundedValue.frenchify().split(",")[1];
80
79
  tryToAddWrongProp(propositions, `${roundedValue.frenchify()}\\text{h}`);
81
80
  tryToAddWrongProp(propositions, `${multiply(minutes.evaluate(), 60).simplify().toTex()}\\text{h}`);
82
81
  tryToAddWrongProp(propositions, `${frac(60, minutes).toTex()}\\text{h}`);
83
82
  propWhile(propositions, n, () => {
84
- tryToAddWrongProp(propositions, `${0},${texDecimal}\\text{h}`);
85
- tryToAddWrongProp(propositions, `${1},${texDecimal}\\text{h}`);
83
+ const texDecimal = roundedValue.frenchify().split(",")[1];
84
+ if (texDecimal) {
85
+ tryToAddWrongProp(propositions, `${0},${texDecimal}\\text{h}`);
86
+ tryToAddWrongProp(propositions, `${1},${texDecimal}\\text{h}`);
87
+ }
88
+ tryToAddWrongProp(propositions, `${randint(1, 20)}\\text{h}`);
86
89
  });
87
90
  }
88
91
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"secondsToHours.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/secondsToHours.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,eAAe,CAAC;IAChC,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AA2LF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAgBhD,CAAC"}
1
+ {"version":3,"file":"secondsToHours.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/secondsToHours.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,eAAe,CAAC;IAChC,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AA8LF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAgBhD,CAAC"}
@@ -76,13 +76,16 @@ const getPropositions = (n, { answer, ...identifiers }) => {
76
76
  addValidProp(propositions, answer);
77
77
  if (isSecondsToHours) {
78
78
  const roundedValue = round(hours.evaluate(), 2);
79
- const texDecimal = roundedValue.frenchify().split(",")[1];
80
79
  tryToAddWrongProp(propositions, `${roundedValue.frenchify()}\\text{h}`);
81
80
  tryToAddWrongProp(propositions, `${multiply(seconds.evaluate(), 3600).simplify().toTex()}\\text{h}`);
82
81
  tryToAddWrongProp(propositions, `${frac(3600, seconds).toTex()}\\text{h}`);
83
82
  propWhile(propositions, n, () => {
84
- tryToAddWrongProp(propositions, `${0},${texDecimal}\\text{h}`);
85
- tryToAddWrongProp(propositions, `${1},${texDecimal}\\text{h}`);
83
+ const texDecimal = roundedValue.frenchify().split(",")[1];
84
+ if (texDecimal) {
85
+ tryToAddWrongProp(propositions, `${0},${texDecimal}\\text{h}`);
86
+ tryToAddWrongProp(propositions, `${1},${texDecimal}\\text{h}`);
87
+ }
88
+ tryToAddWrongProp(propositions, `${randint(1, 20)}\\text{h}`);
86
89
  });
87
90
  }
88
91
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"barChartInterpreting.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/barChartInterpreting.ts"],"names":[],"mappings":"AAAA,OAAO,EAaL,QAAQ,EAKT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,cAAc,GAAG,cAAc,CAAC;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC;AAE5C,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,GAAG,GAAG;IACT,KAAK,EAAE,QAAQ,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAotBF,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAsBF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB/D,CAAC"}
1
+ {"version":3,"file":"barChartInterpreting.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/barChartInterpreting.ts"],"names":[],"mappings":"AAAA,OAAO,EAaL,QAAQ,EAKT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,cAAc,GAAG,cAAc,CAAC;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC;AAE5C,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,GAAG,GAAG;IACT,KAAK,EAAE,QAAQ,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAktBF,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAsBF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB/D,CAAC"}
@@ -8,7 +8,6 @@ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuesti
8
8
  import { randint } from "../../../math/utils/random/randint.js";
9
9
  import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
10
10
  import { capitalize } from "../../../utils/strings/capitalize.js";
11
- import { shuffle } from "../../../utils/alea/shuffle.js";
12
11
  class BarChartConstructor {
13
12
  static stylesPools = {
14
13
  color: [
@@ -98,7 +97,7 @@ class BarChartConstructor {
98
97
  }
99
98
  static createRandomCategories(dictIsUsingCategory, categoryPropsPool, styleType) {
100
99
  const nbCategUsed = Object.keys(dictIsUsingCategory).length;
101
- const styles = shuffle(this.stylesPools[styleType].slice(0, nbCategUsed));
100
+ const styles = this.stylesPools[styleType].slice(0, nbCategUsed);
102
101
  return categoryPropsPool
103
102
  .filter((_, i) => dictIsUsingCategory[i])
104
103
  .map((props, i) => {
@@ -357,7 +356,8 @@ const getGGBOptionsVertStacked = (identifiers) => {
357
356
  }
358
357
  function createCommandsForBar(barChart, barIndex) {
359
358
  //const bar = barChart.bars[barIndex];
360
- const commands = barChart.categories.flatMap((categ, categIndex) => {
359
+ const categoriesReversed = barChart.categories.toReversed();
360
+ const commands = categoriesReversed.flatMap((categ, categIndex) => {
361
361
  const xRange = getXRangeForBarIndex(barIndex);
362
362
  const yRange = getYRangeForCategory(barIndex, categIndex);
363
363
  const style = categ.style;
@@ -366,8 +366,8 @@ const getGGBOptionsVertStacked = (identifiers) => {
366
366
  `${B} = Polygon((${xRange.min}, ${yRange.min}), (${xRange.min}, ${yRange.max}),(${xRange.max}, ${yRange.max}),(${xRange.max}, ${yRange.min}))`,
367
367
  `ShowLabel(${B},false)`,
368
368
  style.type === "color"
369
- ? `SetColor(${B}, "${barChart.categories[categIndex].style.color}")`
370
- : `SetDecoration(${B}, ${barChart.categories[categIndex].style.fill})`,
369
+ ? `SetColor(${B}, "${categ.style.color}")`
370
+ : `SetDecoration(${B}, ${categ.style.fill})`,
371
371
  ];
372
372
  return barChartCommand;
373
373
  });
package/lib/index.d.ts CHANGED
@@ -275,17 +275,13 @@ declare const mathExercises: (Exercise<{
275
275
  a: number;
276
276
  b: number;
277
277
  }, object, string | number | boolean | string[] | number[] | boolean[]> | Exercise<{
278
- sign: number;
279
- a: number;
280
- b: number;
281
- c: number;
282
- dictFakeNameToQuestionParam: Record<string, {
283
- fakeName: string;
278
+ questionParams: {
279
+ letter: string;
284
280
  trueName: string;
285
281
  tex: string;
286
282
  nodeIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
287
283
  explainTex: string;
288
- }>;
284
+ }[];
289
285
  items: {
290
286
  tex: string;
291
287
  isValidAnswer: boolean;
@@ -313,7 +309,9 @@ declare const mathExercises: (Exercise<{
313
309
  }, object, string | number | boolean | string[] | number[] | boolean[]> | Exercise<{
314
310
  nodeIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers[];
315
311
  texAnswers: string[];
316
- }, object, string | number | boolean | string[] | number[] | boolean[]> | Exercise<{
312
+ }, {
313
+ isFracOfSums: boolean;
314
+ }, string | number | boolean | string[] | number[] | boolean[]> | Exercise<{
317
315
  a: number;
318
316
  b: number;
319
317
  isAdd: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kEAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKjE,eAAO,MAAM,YAAY,GACvB,KAAK,QAAQ,CAAC,MAAM,CAAC,EACrB,UAAU,QAAQ,CAAC,MAAM,CAAC;;;CAqP3B,CAAC"}
1
+ {"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKjE,eAAO,MAAM,YAAY,GACvB,KAAK,QAAQ,CAAC,MAAM,CAAC,EACrB,UAAU,QAAQ,CAAC,MAAM,CAAC;;;CA2P3B,CAAC"}
@@ -191,10 +191,12 @@ export const questionTest = (exo, question) => {
191
191
  throw new Error(`exo ${exo.id} has invalid props`);
192
192
  }
193
193
  props.forEach((prop) => {
194
+ if (prop.statement.includes("undefined"))
195
+ throw new Error(`exo ${exo.id} has invalid prop (undefined) : ${prop.statement}`);
194
196
  if (prop.statement.match(dotDecimalPattern))
195
- throw new Error(`exo ${exo.id} has invalid prop (dot) : ${prop}`);
197
+ throw new Error(`exo ${exo.id} has invalid prop (dot) : ${prop.statement}`);
196
198
  if (prop.statement.includes("[object Object]"))
197
- throw new Error(`exo ${exo.id} has invalid prop (objectObject) : ${prop}`);
199
+ throw new Error(`exo ${exo.id} has invalid prop (objectObject) : ${prop.statement}`);
198
200
  if (!props.every((prop2) => prop2.id === prop.id || prop.statement !== prop2.statement))
199
201
  throw new Error(`exo ${exo.id} has invalid prop (duplicate): ${prop.statement}`);
200
202
  if (prop.format !== "raw") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.128",
4
+ "version": "3.0.129",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [