math-exercises 3.0.131 → 3.0.133
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.
- package/lib/exercises/exercise.d.ts +37 -30
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +2 -2
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +44 -40
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts +1 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.js +15 -10
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +0 -1
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +2 -0
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +8 -6
- package/lib/exercises/math/calcul/rounding/rounding.d.ts +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.js +7 -6
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +8 -9
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +4 -4
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +15 -60
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +14 -10
- package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/lengthConversion.js +1 -0
- package/lib/exercises/math/conversion/prefixToNumber.d.ts +0 -2
- package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -1
- package/lib/exercises/math/conversion/prefixToNumber.js +31 -24
- package/lib/exercises/math/conversion/secondsToHours.js +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +2 -2
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +4 -5
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +10 -11
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts +1 -1
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.js +8 -8
- package/lib/exercises/math/geometry/cartesian/index.d.ts +1 -0
- package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/index.js +1 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +6 -9
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +60 -137
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts +16 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +213 -0
- package/lib/exercises/math/percent/evolutions/globalPercent.d.ts +4 -1
- package/lib/exercises/math/percent/evolutions/globalPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/globalPercent.js +37 -21
- package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
- package/lib/exercises/math/percent/findProportion.js +24 -26
- package/lib/exercises/math/percent/percentToDecimal.d.ts +4 -1
- package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/percent/percentToDecimal.js +55 -35
- package/lib/exercises/math/powers/calculateNegativePower.d.ts +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.js +17 -10
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +2 -2
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts +5 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.js +76 -12
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +7 -7
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +2 -3
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +60 -95
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +12 -5
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +354 -94
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts +4 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.js +43 -23
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +70 -23
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.js +4 -4
- package/lib/exercises/pc/index.d.ts +0 -1
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +0 -1
- package/lib/exercises/pc/motion/averageSpeed.d.ts +0 -2
- package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeed.js +40 -45
- package/lib/exercises/pc/optics/lensFormula.d.ts +1 -2
- package/lib/exercises/pc/optics/lensFormula.d.ts.map +1 -1
- package/lib/exercises/pc/optics/lensFormula.js +7 -10
- package/lib/exercises/pc/weight/calculateWeight.d.ts +1 -3
- package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
- package/lib/exercises/pc/weight/calculateWeight.js +38 -30
- package/lib/index.d.ts +932 -948
- package/lib/index.d.ts.map +1 -1
- package/lib/math/progCalc/progCalc.d.ts +2 -2
- package/lib/math/progCalc/progCalc.d.ts.map +1 -1
- package/lib/math/progCalc/progCalc.js +4 -11
- package/lib/playgroundUtils.d.ts +3 -0
- package/lib/playgroundUtils.d.ts.map +1 -0
- package/lib/playgroundUtils.js +13 -0
- package/lib/server.js +121 -0
- package/lib/tests/exoTest.d.ts.map +1 -1
- package/lib/tests/exoTest.js +13 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationFromProblem.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationFromProblem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAKlE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"equationFromProblem.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationFromProblem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAKlE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAatE,KAAK,WAAW,GAAG;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IACzE,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AAsrBF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
|
|
@@ -10,7 +10,6 @@ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
|
10
10
|
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
11
11
|
import { random, randomMany } from "../../../../utils/alea/random.js";
|
|
12
12
|
import { isOperatorNode, OperatorIds, } from "../../../../tree/nodes/operators/operatorNode.js";
|
|
13
|
-
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
14
13
|
class ProblemConstructor {
|
|
15
14
|
static byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays) {
|
|
16
15
|
const shuffleFuncs = shuffleArrays.map((shuffleArray) => {
|
|
@@ -71,14 +70,14 @@ class Problem {
|
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
72
|
getExplanationString() {
|
|
74
|
-
const arrArr = Object.values(this.groups).map((group) =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return
|
|
73
|
+
const arrArr = Object.values(this.groups).map((group) => `\n - ${group.getScalarString(this.mysteryVar)}` +
|
|
74
|
+
` : ` +
|
|
75
|
+
`\n
|
|
76
|
+
$$
|
|
77
|
+
${group.getNode(this.mysteryVar, this.groups, this.shuffleFuncs).toTex()}
|
|
78
|
+
$$
|
|
79
|
+
\n `);
|
|
80
|
+
return arrArr.join("");
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
class ProblemVarGroup {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compareATimes0.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/compareATimes0.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,IAAI,GAAG;IACV,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;
|
|
1
|
+
{"version":3,"file":"compareATimes0.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/compareATimes0.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,IAAI,GAAG;IACV,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAwGF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAehD,CAAC"}
|
|
@@ -45,9 +45,9 @@ const getCompareATimes0Question = () => {
|
|
|
45
45
|
const nbInvalid = nbTotal - nbValid;
|
|
46
46
|
const validItems = [
|
|
47
47
|
`0 \\times a`,
|
|
48
|
-
`a \\times 0`,
|
|
49
48
|
`\\frac{0}{a}`,
|
|
50
49
|
`a + (-a)`,
|
|
50
|
+
`a \\times 0`,
|
|
51
51
|
].map((tex) => {
|
|
52
52
|
return {
|
|
53
53
|
tex,
|
|
@@ -55,8 +55,8 @@ const getCompareATimes0Question = () => {
|
|
|
55
55
|
};
|
|
56
56
|
});
|
|
57
57
|
const invalidItems = [
|
|
58
|
+
`\\frac{a}{0}`,
|
|
58
59
|
`a \\times (-a)`,
|
|
59
|
-
`(-a) \\times a`,
|
|
60
60
|
`\\frac{a}{a}`,
|
|
61
61
|
`\\frac{a}{-a}`,
|
|
62
62
|
`a - (-a)`,
|
|
@@ -68,8 +68,8 @@ const getCompareATimes0Question = () => {
|
|
|
68
68
|
};
|
|
69
69
|
});
|
|
70
70
|
const items = shuffle([
|
|
71
|
-
...shuffle(validItems).slice(0, nbValid),
|
|
72
|
-
...shuffle(invalidItems).slice(0, nbInvalid),
|
|
71
|
+
...shuffle(validItems.slice(0, Math.max(2, nbValid))).slice(0, nbValid),
|
|
72
|
+
...shuffle([...invalidItems.slice(0, 1), ...invalidItems.slice(1)]).slice(0, nbInvalid),
|
|
73
73
|
]);
|
|
74
74
|
return getQuestionFromIdentifiers({ items });
|
|
75
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeLitExpFromFrenchExp.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAmCrC,KAAK,QAAQ,GACT,UAAU,GACV,SAAS,GACT,KAAK,GACL,UAAU,GACV,UAAU,GACV,QAAQ,CAAC;AAoEb,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,QAAQ,CAAC;IACvB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/B,wBAAwB,EAAE,OAAO,CAAC;CACnC,CAAC;
|
|
1
|
+
{"version":3,"file":"writeLitExpFromFrenchExp.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAmCrC,KAAK,QAAQ,GACT,UAAU,GACV,SAAS,GACT,KAAK,GACL,UAAU,GACV,UAAU,GACV,QAAQ,CAAC;AAoEb,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,QAAQ,CAAC;IACvB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/B,wBAAwB,EAAE,OAAO,CAAC;CACnC,CAAC;AAyNF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
|
|
@@ -157,77 +157,32 @@ const getHint = (identifiers) => {
|
|
|
157
157
|
case "opposite":
|
|
158
158
|
return `La somme d'un nombre et de son opposé donne $0$.`;
|
|
159
159
|
case "inverse":
|
|
160
|
-
return `L'inverse de $8$ est $0
|
|
160
|
+
return `L'inverse de $8$ est $0.25$.`;
|
|
161
161
|
case "add":
|
|
162
|
-
return `La somme de $
|
|
162
|
+
return `La somme de $8457$ et de $6567$ est $${8457 + 6567}$.`;
|
|
163
163
|
case "subtract":
|
|
164
|
-
return `La différence entre $
|
|
165
|
-
case "multiply":
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const exprHint1 = ExpressionConstructor.fromIdentifiers(Object.assign({}, identifiers, {
|
|
170
|
-
b: "" + bHint,
|
|
171
|
-
}));
|
|
172
|
-
const exprHint2 = ExpressionConstructor.fromIdentifiers(Object.assign({}, identifiers, {
|
|
173
|
-
b: bHint,
|
|
174
|
-
}));
|
|
175
|
-
return `${capitalize(exprHint1.strFrench)} est $${exprHint2.node
|
|
176
|
-
.simplify()
|
|
177
|
-
.toTex()}$.`;
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
return `Le produit de $8$ par $6$ est $48$.`;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
case "divide": {
|
|
184
|
-
const statementString = ExpressionConstructor.fromIdentifiers(identifiers).strFrench;
|
|
185
|
-
if (!statementString.includes("quotient")) {
|
|
186
|
-
const aHint = randint(2, 10, typeof identifiers.a === "number" ? [identifiers.a] : []);
|
|
187
|
-
const exprHint1 = ExpressionConstructor.fromIdentifiers(Object.assign({}, identifiers, {
|
|
188
|
-
a: "" + aHint,
|
|
189
|
-
}));
|
|
190
|
-
const exprHint2 = ExpressionConstructor.fromIdentifiers(Object.assign({}, identifiers, {
|
|
191
|
-
a: aHint,
|
|
192
|
-
}));
|
|
193
|
-
return `${capitalize(exprHint1.strFrench)} est $${exprHint2.node.toTex()}$.`;
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
return `Le quotient de $200$ par $8$ est $25$.`;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
164
|
+
return `La différence entre $8457$ est $6567$ est $${8457 - 6567}$.`;
|
|
165
|
+
case "multiply":
|
|
166
|
+
return `Le produit de $8457$ par $6567$ est $${8457 * 6567}$ .`;
|
|
167
|
+
case "divide":
|
|
168
|
+
return `Le quotient de $200$ par $8$ est $25$.`;
|
|
199
169
|
}
|
|
200
170
|
};
|
|
201
171
|
const getCorrection = (identifiers) => {
|
|
202
|
-
const { a, operatorName, b } = identifiers;
|
|
203
172
|
const expression = ExpressionConstructor.fromIdentifiers(identifiers);
|
|
204
173
|
const statementString = expression.strFrench;
|
|
174
|
+
let outString = `${capitalize(statementString)} est $ ${getAnswer(identifiers)} $.`;
|
|
205
175
|
//explain rewriting if needed
|
|
206
176
|
const nodeRaw = expression.node;
|
|
207
177
|
const nodeRefined = nodeRaw.simplify();
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
break;
|
|
217
|
-
default:
|
|
218
|
-
{
|
|
219
|
-
texRaw = nodeRaw.toTex({
|
|
220
|
-
allowDoubleMinus: true,
|
|
221
|
-
forceTimesSign: true,
|
|
222
|
-
forceParenthesis: true,
|
|
223
|
-
forceNoSimplification: true,
|
|
224
|
-
allowMinusAnywhereInFraction: true,
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
break;
|
|
228
|
-
}
|
|
178
|
+
const texRaw = nodeRaw.toTex({
|
|
179
|
+
allowDoubleMinus: true,
|
|
180
|
+
forceTimesSign: true,
|
|
181
|
+
forceParenthesis: true,
|
|
182
|
+
forceNoSimplification: true,
|
|
183
|
+
allowMinusAnywhereInFraction: true,
|
|
184
|
+
});
|
|
229
185
|
const texRefined = nodeRefined.toTex();
|
|
230
|
-
let outString = `${capitalize(statementString)} est $ ${texRefined} $.`;
|
|
231
186
|
if (texRaw !== texRefined) {
|
|
232
187
|
outString += `
|
|
233
188
|
|
|
@@ -12,14 +12,15 @@ const getInstruction = (identifiers, optsIn) => {
|
|
|
12
12
|
const opts = optsIn ?? optsDefault;
|
|
13
13
|
const { unitTex } = opts;
|
|
14
14
|
return `Si on parcourt $${distance.frenchify()} \\ \\textrm{km}$ en $${minutes.frenchify()} \\ \\textrm{min}$,
|
|
15
|
-
quelle est la vitesse moyenne en
|
|
15
|
+
quelle est la vitesse moyenne en ${unitTex} ?`;
|
|
16
16
|
};
|
|
17
17
|
const getAnswer = (identifiers, optsIn) => {
|
|
18
18
|
const { distance, minutes } = identifiers;
|
|
19
19
|
const opts = optsIn ?? optsDefault;
|
|
20
20
|
const { unitTex } = opts;
|
|
21
|
+
const unlatexedUnit = unitTex.substring(1, unitTex.length - 1);
|
|
21
22
|
const nodeAnswer = multiply(distance, frac(60, minutes));
|
|
22
|
-
return `${nodeAnswer.simplify().toTex()} \\ ${
|
|
23
|
+
return `${nodeAnswer.simplify().toTex()} \\ ${unlatexedUnit}`;
|
|
23
24
|
};
|
|
24
25
|
const isAnswerValid = (ans, { distance, minutes }) => {
|
|
25
26
|
const nodeAnswer = multiply(distance, frac(60, minutes));
|
|
@@ -33,21 +34,23 @@ const getCorrection = (identifiers, optsIn) => {
|
|
|
33
34
|
const { distance, minutes } = identifiers;
|
|
34
35
|
const opts = optsIn ?? optsDefault;
|
|
35
36
|
const { unitTex } = opts;
|
|
37
|
+
const unlatexedUnit = unitTex.substring(1, unitTex.length - 1);
|
|
36
38
|
return `En $60$ minutes, on parcourt $${multiply(distance, frac(60, minutes)).toTex()} \\ \\textrm{km}$
|
|
37
39
|
donc la vitesse est de $${multiply(distance, frac(60, minutes).simplify()).toTex()} = ${multiply(distance, frac(60, minutes))
|
|
38
40
|
.simplify()
|
|
39
|
-
.toTex()} \\ ${
|
|
41
|
+
.toTex()} \\ ${unlatexedUnit}$`;
|
|
40
42
|
};
|
|
41
43
|
const getPropositions = (n, { answer, distance, minutes }, optsIn) => {
|
|
42
44
|
const opts = optsIn ?? optsDefault;
|
|
43
45
|
const { unitTex } = opts;
|
|
46
|
+
const unlatexedUnit = unitTex.substring(1, unitTex.length - 1);
|
|
44
47
|
const propositions = [];
|
|
45
48
|
addValidProp(propositions, answer);
|
|
46
|
-
tryToAddWrongProp(propositions, `${multiply(60, minutes).simplify().toTex()} \\ ${
|
|
47
|
-
tryToAddWrongProp(propositions, `${frac(distance, minutes).simplify().toTex()} \\ ${
|
|
49
|
+
tryToAddWrongProp(propositions, `${multiply(60, minutes).simplify().toTex()} \\ ${unlatexedUnit}`);
|
|
50
|
+
tryToAddWrongProp(propositions, `${frac(distance, minutes).simplify().toTex()} \\ ${unlatexedUnit}`);
|
|
48
51
|
tryToAddWrongProp(propositions, `${multiply(3.6, frac(distance, minutes))
|
|
49
52
|
.simplify()
|
|
50
|
-
.toTex()} \\ ${
|
|
53
|
+
.toTex()} \\ ${unlatexedUnit}`);
|
|
51
54
|
return shuffleProps(propositions, n);
|
|
52
55
|
};
|
|
53
56
|
const getKmPerMinToKmPerHourConversionQuestion = (optsIn) => {
|
|
@@ -62,17 +65,18 @@ const getKmPerMinToKmPerHourConversionQuestion = (optsIn) => {
|
|
|
62
65
|
};
|
|
63
66
|
const getQuestionFromIdentifiers = (identifiers, optsIn) => {
|
|
64
67
|
const opts = optsIn ?? optsDefault;
|
|
68
|
+
const unlatexedUnit = opts.unitTex.substring(1, opts.unitTex.length - 1);
|
|
65
69
|
const question = {
|
|
66
70
|
answer: getAnswer(identifiers, opts),
|
|
67
71
|
instruction: getInstruction(identifiers, opts),
|
|
68
72
|
keys: [
|
|
69
73
|
{
|
|
70
74
|
id: "custom",
|
|
71
|
-
label:
|
|
75
|
+
label: unlatexedUnit,
|
|
72
76
|
labelType: "tex",
|
|
73
77
|
mathfieldInstructions: {
|
|
74
78
|
method: "write",
|
|
75
|
-
content:
|
|
79
|
+
content: unlatexedUnit,
|
|
76
80
|
},
|
|
77
81
|
},
|
|
78
82
|
],
|
|
@@ -85,7 +89,7 @@ const getQuestionFromIdentifiers = (identifiers, optsIn) => {
|
|
|
85
89
|
return question;
|
|
86
90
|
};
|
|
87
91
|
const optsDefault = {
|
|
88
|
-
unitTex: "
|
|
92
|
+
unitTex: "$\\textrm{km/h}$",
|
|
89
93
|
};
|
|
90
94
|
const options = [
|
|
91
95
|
{
|
|
@@ -93,7 +97,7 @@ const options = [
|
|
|
93
97
|
label: "Unité affichée",
|
|
94
98
|
target: GeneratorOptionTarget.generation,
|
|
95
99
|
type: GeneratorOptionType.select,
|
|
96
|
-
values: ["
|
|
100
|
+
values: ["$\\textrm{km/h}$", "$\\textrm{km}\\cdot \\textrm{h}^{-1}$"],
|
|
97
101
|
defaultValue: optsDefault.unitTex,
|
|
98
102
|
},
|
|
99
103
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/lengthConversion.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,QAAQ,EAiBT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;
|
|
1
|
+
{"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/lengthConversion.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,QAAQ,EAiBT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAwKF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkB3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefixToNumber.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/prefixToNumber.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAiBT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"prefixToNumber.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/prefixToNumber.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAiBT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAyNF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AA0EF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAuBzD,CAAC"}
|
|
@@ -105,20 +105,24 @@ const getMdTable = (prefixes, indexBold = -1) => {
|
|
|
105
105
|
].map((str) => (i === indexBold ? boldify(str) : str))),
|
|
106
106
|
]);
|
|
107
107
|
};
|
|
108
|
-
const getInstruction = (identifiers) => {
|
|
109
|
-
const
|
|
108
|
+
const getInstruction = (identifiers, optsIn) => {
|
|
109
|
+
const opts = optsIn ?? optsDefault;
|
|
110
|
+
const { prefixIndex } = identifiers;
|
|
111
|
+
const { isFromSymbol, isToPow10 } = opts;
|
|
110
112
|
const prefix = prefixes[prefixIndex];
|
|
111
113
|
return `Quelle est la valeur du préfixe ${isFromSymbol ? `$${prefix.symbol}$` : prefix.name} ?
|
|
112
114
|
|
|
113
|
-
|
|
115
|
+
Écrire la réponse sous la forme ${isToPow10 ? `d'une puissance de $10$` : `d'un nombre décimal`}.`;
|
|
114
116
|
};
|
|
115
117
|
const getHint = (identifiers) => {
|
|
116
118
|
const { prefixIndexesPool } = identifiers;
|
|
117
119
|
const prefixPool = prefixIndexesPool.map((i) => prefixes[i]);
|
|
118
120
|
return getMdTable(prefixPool);
|
|
119
121
|
};
|
|
120
|
-
const getCorrection = (identifiers) => {
|
|
121
|
-
const
|
|
122
|
+
const getCorrection = (identifiers, optsIn) => {
|
|
123
|
+
const opts = optsIn ?? optsDefault;
|
|
124
|
+
const { prefixIndexesPool, prefixIndex } = identifiers;
|
|
125
|
+
const { isToPow10 } = opts;
|
|
122
126
|
const prefix = prefixes[prefixIndex];
|
|
123
127
|
const prefixPool = prefixIndexesPool.map((i) => prefixes[i]);
|
|
124
128
|
const indexBold = (() => {
|
|
@@ -135,13 +139,17 @@ ${!isToPow10
|
|
|
135
139
|
? `$${prefix.texPow10}$ correspond à l'écriture décimale $${prefix.texValue}$.`
|
|
136
140
|
: ``}`;
|
|
137
141
|
};
|
|
138
|
-
const getAnswer = (identifiers) => {
|
|
139
|
-
const
|
|
142
|
+
const getAnswer = (identifiers, optsIn) => {
|
|
143
|
+
const opts = optsIn ?? optsDefault;
|
|
144
|
+
const { prefixIndex } = identifiers;
|
|
145
|
+
const { isToPow10 } = opts;
|
|
140
146
|
const prefix = prefixes[prefixIndex];
|
|
141
147
|
return isToPow10 ? prefix.texPow10 : prefix.texValue;
|
|
142
148
|
};
|
|
143
|
-
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
144
|
-
const
|
|
149
|
+
const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
|
|
150
|
+
const opts = optsIn ?? optsDefault;
|
|
151
|
+
const { prefixIndexesPool, prefixIndex } = identifiers;
|
|
152
|
+
const { isToPow10 } = opts;
|
|
145
153
|
const propositions = [];
|
|
146
154
|
addValidProp(propositions, answer);
|
|
147
155
|
const wrongIndexesPool = prefixIndexesPool.filter((i) => i !== prefixIndex);
|
|
@@ -162,10 +170,10 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
162
170
|
const nodeAnswer = parseAlgebraic(answer);
|
|
163
171
|
return substract(nodeAns, nodeAnswer).evaluate() === 0;
|
|
164
172
|
};
|
|
165
|
-
const
|
|
173
|
+
const optsDefault = {
|
|
166
174
|
prefixPool: prefixes.map((prefix) => prefix.name),
|
|
167
|
-
isToPow10:
|
|
168
|
-
isFromSymbol:
|
|
175
|
+
isToPow10: true,
|
|
176
|
+
isFromSymbol: true,
|
|
169
177
|
};
|
|
170
178
|
const options = [
|
|
171
179
|
{
|
|
@@ -174,24 +182,25 @@ const options = [
|
|
|
174
182
|
type: GeneratorOptionType.multiselect,
|
|
175
183
|
target: GeneratorOptionTarget.generation,
|
|
176
184
|
values: prefixes.map((prefix) => prefix.name),
|
|
185
|
+
defaultValue: optsDefault.prefixPool,
|
|
177
186
|
},
|
|
178
187
|
{
|
|
179
188
|
id: "isToPow10",
|
|
180
189
|
label: "Réponse sous forme de puissance de 10 ?",
|
|
181
190
|
type: GeneratorOptionType.checkbox,
|
|
182
191
|
target: GeneratorOptionTarget.generation,
|
|
183
|
-
|
|
192
|
+
defaultValue: optsDefault.isToPow10,
|
|
184
193
|
},
|
|
185
194
|
{
|
|
186
|
-
id: "
|
|
195
|
+
id: "isFromSymbol",
|
|
187
196
|
label: "Utiliser le symbole pour la question ?",
|
|
188
197
|
type: GeneratorOptionType.checkbox,
|
|
189
198
|
target: GeneratorOptionTarget.generation,
|
|
190
|
-
|
|
199
|
+
defaultValue: optsDefault.isFromSymbol,
|
|
191
200
|
},
|
|
192
201
|
];
|
|
193
202
|
const getPrefixToNumberQuestion = (optsIn) => {
|
|
194
|
-
const opts = optsIn
|
|
203
|
+
const opts = optsIn ?? optsDefault;
|
|
195
204
|
const prefixIndexesPool = opts.prefixPool.map((prefixName) => {
|
|
196
205
|
const prefixIndex = (() => {
|
|
197
206
|
for (let i = 0; i < prefixes.length; i++) {
|
|
@@ -200,15 +209,11 @@ const getPrefixToNumberQuestion = (optsIn) => {
|
|
|
200
209
|
}
|
|
201
210
|
})();
|
|
202
211
|
return prefixIndex;
|
|
203
|
-
})
|
|
212
|
+
});
|
|
204
213
|
const prefixIndex = random(prefixIndexesPool);
|
|
205
|
-
const isFromSymbol = optsIn?.isFromSymbol ?? random(optionsDefault.isFromSymbol);
|
|
206
|
-
const isToPow10 = optsIn?.isToPow10 ?? random(optionsDefault.isToPow10);
|
|
207
214
|
const identifiers = {
|
|
208
215
|
prefixIndexesPool,
|
|
209
216
|
prefixIndex,
|
|
210
|
-
isFromSymbol,
|
|
211
|
-
isToPow10,
|
|
212
217
|
};
|
|
213
218
|
return getQuestionFromIdentifiers(identifiers, optsIn);
|
|
214
219
|
};
|
|
@@ -219,8 +224,9 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
219
224
|
keys: [],
|
|
220
225
|
answerFormat: "tex",
|
|
221
226
|
identifiers,
|
|
222
|
-
hint: getHint(identifiers),
|
|
223
|
-
correction: getCorrection(identifiers),
|
|
227
|
+
hint: getHint(identifiers, opts),
|
|
228
|
+
correction: getCorrection(identifiers, opts),
|
|
229
|
+
options: opts,
|
|
224
230
|
};
|
|
225
231
|
return question;
|
|
226
232
|
};
|
|
@@ -229,7 +235,8 @@ export const prefixToNumber = {
|
|
|
229
235
|
connector: "=",
|
|
230
236
|
label: "Convertir un préfixe en nombre",
|
|
231
237
|
isSingleStep: true,
|
|
232
|
-
generator: (nb, opts) => getDistinctQuestions(() => getPrefixToNumberQuestion(opts), nb),
|
|
238
|
+
generator: (nb, opts) => getDistinctQuestions(() => getPrefixToNumberQuestion(opts), nb, 10, () => false),
|
|
239
|
+
maxAllowedQuestions: 10,
|
|
233
240
|
qcmTimer: 60,
|
|
234
241
|
freeTimer: 60,
|
|
235
242
|
getPropositions,
|
|
@@ -102,7 +102,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
102
102
|
const question = {
|
|
103
103
|
answer: getAnswer(identifiers),
|
|
104
104
|
instruction: getInstruction(identifiers),
|
|
105
|
-
keys: ["hours", "
|
|
105
|
+
keys: ["hours", "seconds"],
|
|
106
106
|
answerFormat: "tex",
|
|
107
107
|
identifiers,
|
|
108
108
|
hint: getHint(identifiers),
|
|
@@ -14,6 +14,7 @@ import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
|
14
14
|
const getHint = () => {
|
|
15
15
|
return `Si $f$ est une fonction telle que $f(x) = y$,
|
|
16
16
|
alors la droite représentative de f passe par le point de coordonnées $(x;y)$.
|
|
17
|
+
|
|
17
18
|
Si le coefficient directeur vaut $\\frac{v}{h}$ alors le point de coordonnées $(x+h;y+v)$
|
|
18
19
|
appartient aussi à la droite représentative de $f$.`;
|
|
19
20
|
};
|
|
@@ -50,8 +51,7 @@ const getInstruction = (identifiers) => {
|
|
|
50
51
|
const pointA = PointConstructor.fromIdentifiers(pointIdsA);
|
|
51
52
|
const coeff = NodeConstructor.fromIdentifiers(leadingCoeff);
|
|
52
53
|
const texCoeff = numberType === "Fraction" ? coeff.toTex() : coeff.evaluate().frenchify();
|
|
53
|
-
return `La fonction $${funcName}$
|
|
54
|
-
$ ${funcName}(${pointA.x.toTex()}) = ${pointA.y.toTex()} $.
|
|
54
|
+
return `La fonction affine $${funcName}$ a pour représentation graphique une droite de coefficient directeur $${texCoeff}$ et qui passe par le point de coordonnées $\\left(${pointA.x.toTex()}; ${pointA.y.toTex()}\\right)$.
|
|
55
55
|
|
|
56
56
|
Dans le repère, tracer la représentation graphique de la fonction $${funcName}$.`;
|
|
57
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawAffineFromProgCalc.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/drawAffineFromProgCalc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,mBAAmB,EAEpB,MAAM,iCAAiC,CAAC;AAOzC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,mBAAmB,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAkOF,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"drawAffineFromProgCalc.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/drawAffineFromProgCalc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,mBAAmB,EAEpB,MAAM,iCAAiC,CAAC;AAOzC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,mBAAmB,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAkOF,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC;AAuBF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBjE,CAAC"}
|
|
@@ -164,7 +164,7 @@ const getDrawAffineFromProgCalcQuestion = (opts) => {
|
|
|
164
164
|
const opGenConfigAddsub = random(arrOpGenAddsub);
|
|
165
165
|
const opGenConfigMuldiv = random(arrOpGenMuldiv);
|
|
166
166
|
const arrOpGenConfigMandatory = [opGenConfigAddsub, opGenConfigMuldiv];
|
|
167
|
-
const progCalc = ProgCalcConstructor.randomWithMandatory(nbSteps, isSingleUseOperators, arrOpGenConfigMandatory, arrOpGenConfigAll);
|
|
167
|
+
const progCalc = ProgCalcConstructor.randomWithMandatory(Number(nbSteps), isSingleUseOperators, arrOpGenConfigMandatory, arrOpGenConfigAll);
|
|
168
168
|
const identifiers = {
|
|
169
169
|
progCalcIds: progCalc.toIdentifiers(),
|
|
170
170
|
funcName: random(["f", "g", "h"]),
|
|
@@ -182,7 +182,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
182
182
|
};
|
|
183
183
|
};
|
|
184
184
|
const optsDefault = {
|
|
185
|
-
nbSteps: 2,
|
|
185
|
+
nbSteps: "2",
|
|
186
186
|
isSingleUseOperators: true,
|
|
187
187
|
};
|
|
188
188
|
const options = [
|
|
@@ -190,7 +190,7 @@ const options = [
|
|
|
190
190
|
id: "nbSteps",
|
|
191
191
|
label: "Nombre d'étapes de transformation",
|
|
192
192
|
defaultValue: optsDefault.nbSteps,
|
|
193
|
-
values: [2, 3, 4, 5],
|
|
193
|
+
values: ["2", "3", "4", "5"],
|
|
194
194
|
target: GeneratorOptionTarget.generation,
|
|
195
195
|
type: GeneratorOptionType.select,
|
|
196
196
|
},
|
|
@@ -198,9 +198,8 @@ const options = [
|
|
|
198
198
|
id: "isSingleUseOperators",
|
|
199
199
|
label: "Opérateurs à usage unique",
|
|
200
200
|
defaultValue: optsDefault.isSingleUseOperators,
|
|
201
|
-
values: [true, false],
|
|
202
201
|
target: GeneratorOptionTarget.generation,
|
|
203
|
-
type: GeneratorOptionType.
|
|
202
|
+
type: GeneratorOptionType.checkbox,
|
|
204
203
|
},
|
|
205
204
|
];
|
|
206
205
|
export const drawAffineFromProgCalc = {
|
|
@@ -121,7 +121,7 @@ const options = [
|
|
|
121
121
|
target: GeneratorOptionTarget.generation,
|
|
122
122
|
type: GeneratorOptionType.select,
|
|
123
123
|
values: ["Affines", "Linéaires", "Les deux"],
|
|
124
|
-
defaultValue:
|
|
124
|
+
defaultValue: "Les deux",
|
|
125
125
|
},
|
|
126
126
|
];
|
|
127
127
|
export const leadingCoefficient = {
|
|
@@ -16,7 +16,7 @@ type Identifiers = {
|
|
|
16
16
|
type Options = {
|
|
17
17
|
angleTypes: ("alternes-internes" | "correspondants" | "alternes-externes" | "autres")[];
|
|
18
18
|
isFakeDisplay: boolean;
|
|
19
|
-
nbDigits: 0 | 1 | 2;
|
|
19
|
+
nbDigits: "0" | "1" | "2";
|
|
20
20
|
};
|
|
21
21
|
export declare const anglesUsingIsParallel: Exercise<Identifiers, Options>;
|
|
22
22
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anglesUsingIsParallel.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/anglesUsingIsParallel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAuItC,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AA6HF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EACL,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CAAC;IAGb,kBAAkB,EAAE,eAAe,EAAE,CAAC;IACtC,aAAa,EAAE,MAAM,EAAE,CAAC;IAGxB,gBAAgB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACxC,CAAC;AAwMF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,CACR,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CACX,EAAE,CAAC;IACJ,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"anglesUsingIsParallel.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/anglesUsingIsParallel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAuItC,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AA6HF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EACL,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CAAC;IAGb,kBAAkB,EAAE,eAAe,EAAE,CAAC;IACtC,aAAa,EAAE,MAAM,EAAE,CAAC;IAGxB,gBAAgB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACxC,CAAC;AAwMF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,CACR,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CACX,EAAE,CAAC;IACJ,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAC3B,CAAC;AAsNF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBhE,CAAC"}
|
|
@@ -152,7 +152,7 @@ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
|
|
|
152
152
|
tryToAddWrongProp(propositions, substract(180, arrAngleUsed[0]).toTex(), "tex");
|
|
153
153
|
const arrAngleGeom = getGeomAngles(identifiers);
|
|
154
154
|
//l'élève fait une mesure sur la figure
|
|
155
|
-
tryToAddWrongProp(propositions, round(arrAngleGeom[1].evaluate(), opts.nbDigits).frenchify(), "tex");
|
|
155
|
+
tryToAddWrongProp(propositions, round(arrAngleGeom[1].evaluate(), Number(opts.nbDigits)).frenchify(), "tex");
|
|
156
156
|
tryToAddWrongProp(propositions, "\\text{On ne peut pas savoir.}", "tex");
|
|
157
157
|
return shuffleProps(propositions, n);
|
|
158
158
|
};
|
|
@@ -241,7 +241,7 @@ const getGGBOptions = (identifiers, opts) => {
|
|
|
241
241
|
`ShowLabel(${a.name}, false)`,
|
|
242
242
|
...a.getFitCaptionCommands({
|
|
243
243
|
text: [
|
|
244
|
-
round(arrAngleForLabel ? arrAngleForLabel[i] : a.evaluate(), nbDigits).frenchify(),
|
|
244
|
+
round(arrAngleForLabel ? arrAngleForLabel[i] : a.evaluate(), Number(nbDigits)).frenchify(),
|
|
245
245
|
"?",
|
|
246
246
|
][i],
|
|
247
247
|
size: "small",
|
|
@@ -285,7 +285,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
285
285
|
const optsDefault = {
|
|
286
286
|
angleTypes: ["alternes-internes"],
|
|
287
287
|
isFakeDisplay: true,
|
|
288
|
-
nbDigits: 0,
|
|
288
|
+
nbDigits: "0",
|
|
289
289
|
};
|
|
290
290
|
const options = [
|
|
291
291
|
{
|
|
@@ -313,7 +313,7 @@ const options = [
|
|
|
313
313
|
label: "Nombre de décimales",
|
|
314
314
|
target: GeneratorOptionTarget.generation,
|
|
315
315
|
type: GeneratorOptionType.select,
|
|
316
|
-
values: [0, 1, 2],
|
|
316
|
+
values: ["0", "1", "2"],
|
|
317
317
|
defaultValue: optsDefault.nbDigits,
|
|
318
318
|
},
|
|
319
319
|
];
|
|
@@ -325,11 +325,11 @@ const getAnglesUsingIsParallelQuestion = (optsIn) => {
|
|
|
325
325
|
function createConfigGeom(isParallelInGeom, isLookingParallel) {
|
|
326
326
|
const deviation = isLookingParallel ? 1 : 5;
|
|
327
327
|
const cAngleInDegreesMin = 30;
|
|
328
|
-
const cAngleInDegreesTop = randfloat(cAngleInDegreesMin, 180 - cAngleInDegreesMin, opts.nbDigits);
|
|
328
|
+
const cAngleInDegreesTop = randfloat(cAngleInDegreesMin, 180 - cAngleInDegreesMin, Number(opts.nbDigits));
|
|
329
329
|
const cAngleInDegreesBottom = isParallelInGeom
|
|
330
330
|
? cAngleInDegreesTop
|
|
331
331
|
: cAngleInDegreesTop +
|
|
332
|
-
randfloat(-deviation, deviation, opts.nbDigits, [0]);
|
|
332
|
+
randfloat(-deviation, deviation, Number(opts.nbDigits), [0]);
|
|
333
333
|
return {
|
|
334
334
|
cAngleInDegreesTop,
|
|
335
335
|
cAngleInDegreesBottom,
|
|
@@ -391,19 +391,18 @@ const getAnglesUsingIsParallelQuestion = (optsIn) => {
|
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
const arrAngleIndex = randomArrAngleIndex(angleType);
|
|
394
|
+
const nbDigits = Number(opts.nbDigits);
|
|
394
395
|
//this is the fake display part:
|
|
395
396
|
let arrAngleForLabel;
|
|
396
397
|
if (opts.isFakeDisplay) {
|
|
397
398
|
const angleInDegreesMin = 25;
|
|
398
|
-
const cAngleInDegreesTop = round(randfloat(angleInDegreesMin, 180 - angleInDegreesMin,
|
|
399
|
+
const cAngleInDegreesTop = round(randfloat(angleInDegreesMin, 180 - angleInDegreesMin, nbDigits), nbDigits);
|
|
399
400
|
const cAngleInDegreesBottom = isParallel
|
|
400
401
|
? cAngleInDegreesTop
|
|
401
|
-
: round(cAngleInDegreesTop + randfloat(-25, 50,
|
|
402
|
+
: round(cAngleInDegreesTop + randfloat(-25, 50, nbDigits, [0]), nbDigits);
|
|
402
403
|
//angles at angleIndexes 0 and 2 have same value. Same for angleIndexes 1 and 3.
|
|
403
404
|
arrAngleForLabel = [cAngleInDegreesTop, cAngleInDegreesBottom].map((angle, i) => {
|
|
404
|
-
return arrAngleIndex[i] % 2 == 0
|
|
405
|
-
? angle
|
|
406
|
-
: round(180 - angle, opts.nbDigits);
|
|
405
|
+
return arrAngleIndex[i] % 2 == 0 ? angle : round(180 - angle, nbDigits);
|
|
407
406
|
});
|
|
408
407
|
}
|
|
409
408
|
const identifiers = {
|
|
@@ -16,7 +16,7 @@ type Identifiers = {
|
|
|
16
16
|
type Options = {
|
|
17
17
|
angleTypes: ("alternes-internes" | "correspondants" | "alternes-externes" | "autres")[];
|
|
18
18
|
isFakeDisplay: boolean;
|
|
19
|
-
nbDigits: 0 | 1 | 2;
|
|
19
|
+
nbDigits: "0" | "1" | "2";
|
|
20
20
|
};
|
|
21
21
|
export declare const isParallelUsingAngles: Exercise<Identifiers, Options>;
|
|
22
22
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isParallelUsingAngles.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/isParallelUsingAngles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAuItC,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AA6HF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EACL,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CAAC;IAGb,kBAAkB,EAAE,eAAe,EAAE,CAAC;IACtC,aAAa,EAAE,MAAM,EAAE,CAAC;IAGxB,gBAAgB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACxC,CAAC;AAuIF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,CACR,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CACX,EAAE,CAAC;IACJ,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"isParallelUsingAngles.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/isParallelUsingAngles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAuItC,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AA6HF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EACL,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CAAC;IAGb,kBAAkB,EAAE,eAAe,EAAE,CAAC;IACtC,aAAa,EAAE,MAAM,EAAE,CAAC;IAGxB,gBAAgB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACxC,CAAC;AAuIF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,CACR,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CACX,EAAE,CAAC;IACJ,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAC3B,CAAC;AAuNF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBhE,CAAC"}
|