math-exercises 2.2.53 → 2.2.55
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/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +25 -13
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +30 -18
- package/lib/exercises/math/conversion/aeraConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/aeraConversion.js +2 -1
- package/lib/exercises/math/conversion/capacityConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/capacityConversion.js +2 -1
- package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/lengthConversion.js +2 -1
- package/lib/exercises/math/conversion/massConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/massConversion.js +2 -1
- package/lib/exercises/math/conversion/volumeCapacityConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/volumeCapacityConversion.js +2 -1
- package/lib/exercises/math/conversion/volumeConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/volumeConversion.js +2 -1
- package/package.json +1 -1
package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findCoeffInProportionalTableNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"findCoeffInProportionalTableNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAkIF,eAAO,MAAM,uCAAuC,EAAE,QAAQ,CAAC,WAAW,CAoBzE,CAAC"}
|
package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js
CHANGED
|
@@ -10,6 +10,7 @@ const nodeConstructor_1 = require("../../../../tree/nodes/nodeConstructor");
|
|
|
10
10
|
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
11
11
|
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
12
12
|
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
13
|
+
const doWhile_1 = require("../../../../utils/doWhile");
|
|
13
14
|
const dollarize_1 = require("../../../../utils/latex/dollarize");
|
|
14
15
|
const mdTable_1 = require("../../../../utils/markdown/mdTable");
|
|
15
16
|
const getPropositions = (n, { answer, type }) => {
|
|
@@ -63,28 +64,36 @@ const getFindCoeffInProportionalTableNonIntegersQuestion = () => {
|
|
|
63
64
|
case 1:
|
|
64
65
|
//coeff entier, valeurs décimal/frac
|
|
65
66
|
coeff = (0, randint_1.randint)(2, 10).toTree();
|
|
66
|
-
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
.
|
|
67
|
+
for (let i = 0; i < 3; i++) {
|
|
68
|
+
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
69
|
+
? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
|
|
70
|
+
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => xValues.some((x) => x.equals(y)));
|
|
71
|
+
xValues.push(x);
|
|
72
|
+
}
|
|
73
|
+
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
71
74
|
break;
|
|
72
75
|
case 2:
|
|
73
76
|
//coeff décimal, valeurs entieres/décimal
|
|
74
77
|
coeff = (0, randfloat_1.randfloat)(1.1, 10, 1).toTree();
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
for (let i = 0; i < 3; i++) {
|
|
79
|
+
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
80
|
+
? (0, randint_1.randint)(1, 10).toTree()
|
|
81
|
+
: (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) => xValues.some((x) => x.equals(y)));
|
|
82
|
+
xValues.push(x);
|
|
83
|
+
}
|
|
84
|
+
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
78
85
|
break;
|
|
79
86
|
case 3:
|
|
80
87
|
//coeff frac, valeurs frac / entieres
|
|
81
88
|
default:
|
|
82
89
|
coeff = rational_1.RationalConstructor.randomPureRational().toTree();
|
|
83
|
-
|
|
84
|
-
.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.
|
|
90
|
+
for (let i = 0; i < 3; i++) {
|
|
91
|
+
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
92
|
+
? (0, randint_1.randint)(1, 10).toTree()
|
|
93
|
+
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => xValues.some((x) => x.equals(y)));
|
|
94
|
+
xValues.push(x);
|
|
95
|
+
}
|
|
96
|
+
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
88
97
|
}
|
|
89
98
|
const yValues = xValues.map((x) => (0, multiplyNode_1.multiply)(x, coeff).simplify());
|
|
90
99
|
const identifiers = {
|
|
@@ -101,6 +110,9 @@ const getFindCoeffInProportionalTableNonIntegersQuestion = () => {
|
|
|
101
110
|
identifiers,
|
|
102
111
|
// hint: getHint(identifiers),
|
|
103
112
|
// correction: getCorrection(identifiers),
|
|
113
|
+
style: {
|
|
114
|
+
tableHasNoHeader: true,
|
|
115
|
+
},
|
|
104
116
|
};
|
|
105
117
|
return question;
|
|
106
118
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isTableProportionalNonInteger.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/isTableProportionalNonInteger.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"isTableProportionalNonInteger.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/isTableProportionalNonInteger.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA0HF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAgB/D,CAAC"}
|
|
@@ -11,14 +11,15 @@ const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
|
11
11
|
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
12
12
|
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
13
13
|
const random_1 = require("../../../../utils/alea/random");
|
|
14
|
+
const doWhile_1 = require("../../../../utils/doWhile");
|
|
14
15
|
const dollarize_1 = require("../../../../utils/latex/dollarize");
|
|
15
16
|
const mdTable_1 = require("../../../../utils/markdown/mdTable");
|
|
16
17
|
const getPropositions = (n, { answer }) => {
|
|
17
18
|
const propositions = [];
|
|
18
|
-
(0, exercise_1.addValidProp)(propositions, answer);
|
|
19
|
-
(0, exercise_1.tryToAddWrongProp)(propositions, "Non");
|
|
20
|
-
(0, exercise_1.tryToAddWrongProp)(propositions, "On ne peut pas savoir");
|
|
21
|
-
(0, exercise_1.tryToAddWrongProp)(propositions, "Oui");
|
|
19
|
+
(0, exercise_1.addValidProp)(propositions, answer, "raw");
|
|
20
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Non", "raw");
|
|
21
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "On ne peut pas savoir", "raw");
|
|
22
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Oui", "raw");
|
|
22
23
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
23
24
|
};
|
|
24
25
|
const getAnswer = (identifiers) => {
|
|
@@ -51,28 +52,36 @@ const getIsTableProportionalNonIntegerQuestion = () => {
|
|
|
51
52
|
case 1:
|
|
52
53
|
//coeff entier, valeurs décimal/frac
|
|
53
54
|
coeff = (0, randint_1.randint)(2, 10).toTree();
|
|
54
|
-
|
|
55
|
-
.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
.
|
|
55
|
+
for (let i = 0; i < 3; i++) {
|
|
56
|
+
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
57
|
+
? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
|
|
58
|
+
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => xValues.some((x) => x.equals(y)));
|
|
59
|
+
xValues.push(x);
|
|
60
|
+
}
|
|
61
|
+
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
59
62
|
break;
|
|
60
63
|
case 2:
|
|
61
64
|
//coeff décimal, valeurs entieres/décimal
|
|
62
65
|
coeff = (0, randfloat_1.randfloat)(1.1, 10, 1).toTree();
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
for (let i = 0; i < 3; i++) {
|
|
67
|
+
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
68
|
+
? (0, randint_1.randint)(1, 10).toTree()
|
|
69
|
+
: (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) => xValues.some((x) => x.equals(y)));
|
|
70
|
+
xValues.push(x);
|
|
71
|
+
}
|
|
72
|
+
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
66
73
|
break;
|
|
67
74
|
case 3:
|
|
68
75
|
//coeff frac, valeurs frac / entieres
|
|
69
76
|
default:
|
|
70
77
|
coeff = rational_1.RationalConstructor.randomPureRational().toTree();
|
|
71
|
-
|
|
72
|
-
.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
.
|
|
78
|
+
for (let i = 0; i < 3; i++) {
|
|
79
|
+
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
80
|
+
? (0, randint_1.randint)(1, 10).toTree()
|
|
81
|
+
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => xValues.some((x) => x.equals(y)));
|
|
82
|
+
xValues.push(x);
|
|
83
|
+
}
|
|
84
|
+
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
76
85
|
}
|
|
77
86
|
const yValues = isProportionnal
|
|
78
87
|
? xValues.map((x) => (0, multiplyNode_1.multiply)(x, coeff).simplify())
|
|
@@ -88,10 +97,13 @@ const getIsTableProportionalNonIntegerQuestion = () => {
|
|
|
88
97
|
answer: getAnswer(identifiers),
|
|
89
98
|
instruction: getInstruction(identifiers),
|
|
90
99
|
keys: getKeys(identifiers),
|
|
91
|
-
answerFormat: "
|
|
100
|
+
answerFormat: "raw",
|
|
92
101
|
identifiers,
|
|
93
102
|
// hint: getHint(identifiers),
|
|
94
103
|
// correction: getCorrection(identifiers),
|
|
104
|
+
style: {
|
|
105
|
+
tableHasNoHeader: true,
|
|
106
|
+
},
|
|
95
107
|
};
|
|
96
108
|
return question;
|
|
97
109
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aeraConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/aeraConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aeraConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/aeraConversion.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAExB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA+DF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
|
|
@@ -4,6 +4,7 @@ exports.aeraConversion = void 0;
|
|
|
4
4
|
const decimal_1 = require("../../../math/numbers/decimals/decimal");
|
|
5
5
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
6
6
|
const shuffle_1 = require("../../../utils/alea/shuffle");
|
|
7
|
+
const doWhile_1 = require("../../../utils/doWhile");
|
|
7
8
|
const exercise_1 = require("../../exercise");
|
|
8
9
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
9
10
|
const units = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
|
|
@@ -12,7 +13,7 @@ const getAeraConversion = () => {
|
|
|
12
13
|
const randomUnitInstructionIndex = (0, randint_1.randint)(
|
|
13
14
|
// cette manip a pour but d'éviter des conversion de type km² --> cm² ou le contraire (chiffre trop grand/petit)
|
|
14
15
|
randomUnitIndex - 2 < 0 ? 0 : randomUnitIndex - 2, randomUnitIndex + 2 > 7 ? 7 : randomUnitIndex + 3, [randomUnitIndex]);
|
|
15
|
-
const randomAera = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
|
|
16
|
+
const randomAera = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
|
|
16
17
|
const answer = (randomAera.multiplyByPowerOfTen(2 * (randomUnitIndex - randomUnitInstructionIndex)).value + "").replace(".", ",");
|
|
17
18
|
const question = {
|
|
18
19
|
instruction: `Compléter : $${randomAera.value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capacityConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/capacityConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"capacityConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/capacityConversion.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AA0DF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
|
|
@@ -4,13 +4,14 @@ exports.capacityConversion = void 0;
|
|
|
4
4
|
const decimal_1 = require("../../../math/numbers/decimals/decimal");
|
|
5
5
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
6
6
|
const shuffle_1 = require("../../../utils/alea/shuffle");
|
|
7
|
+
const doWhile_1 = require("../../../utils/doWhile");
|
|
7
8
|
const exercise_1 = require("../../exercise");
|
|
8
9
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
9
10
|
const units = ["mL", "cL", "dL", "L", "daL", "hL", "kL"];
|
|
10
11
|
const getCapacityConversion = () => {
|
|
11
12
|
const randomUnitIndex = (0, randint_1.randint)(0, 7);
|
|
12
13
|
const randomUnitInstructionIndex = (0, randint_1.randint)(0, 7, [randomUnitIndex]);
|
|
13
|
-
const randomCapacity = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
|
|
14
|
+
const randomCapacity = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
|
|
14
15
|
const answer = (randomCapacity.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + "").replace(".", ",");
|
|
15
16
|
const question = {
|
|
16
17
|
instruction: `Compléter : $${randomCapacity.value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/lengthConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/lengthConversion.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,QAAQ,EAaT,MAAM,gBAAgB,CAAC;AAIxB,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;AAwHF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkB3D,CAAC"}
|
|
@@ -8,6 +8,7 @@ const measure_1 = require("../../../pc/measure/measure");
|
|
|
8
8
|
const distanceUnits_1 = require("../../../pc/units/distanceUnits");
|
|
9
9
|
const random_1 = require("../../../utils/alea/random");
|
|
10
10
|
const shuffle_1 = require("../../../utils/alea/shuffle");
|
|
11
|
+
const doWhile_1 = require("../../../utils/doWhile");
|
|
11
12
|
const exercise_1 = require("../../exercise");
|
|
12
13
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
13
14
|
const units = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
|
|
@@ -43,7 +44,7 @@ const getLengthConversion = (options) => {
|
|
|
43
44
|
const randomUnitInstructionIndex = (0, random_1.random)(availableUnitsIndexes, [
|
|
44
45
|
randomUnitIndex,
|
|
45
46
|
]);
|
|
46
|
-
const randomLength = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
|
|
47
|
+
const randomLength = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
|
|
47
48
|
const identifiers = {
|
|
48
49
|
randomLength: randomLength.value,
|
|
49
50
|
randomUnitIndex,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"massConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/massConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"massConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/massConversion.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA8DF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
|
|
@@ -5,13 +5,14 @@ const decimal_1 = require("../../../math/numbers/decimals/decimal");
|
|
|
5
5
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
6
6
|
const numberParser_1 = require("../../../tree/parsers/numberParser");
|
|
7
7
|
const shuffle_1 = require("../../../utils/alea/shuffle");
|
|
8
|
+
const doWhile_1 = require("../../../utils/doWhile");
|
|
8
9
|
const exercise_1 = require("../../exercise");
|
|
9
10
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
10
11
|
const units = ["mg", "cg", "dg", "g", "dag", "hg", "kg"];
|
|
11
12
|
const getMassConversion = () => {
|
|
12
13
|
const randomUnitIndex = (0, randint_1.randint)(0, 7);
|
|
13
14
|
const randomUnitInstructionIndex = (0, randint_1.randint)(0, 7, [randomUnitIndex]);
|
|
14
|
-
const randomMass = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
|
|
15
|
+
const randomMass = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
|
|
15
16
|
const answer = (randomMass.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + "").replace(".", ",");
|
|
16
17
|
const question = {
|
|
17
18
|
instruction: `Compléter : $${randomMass.value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumeCapacityConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeCapacityConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"volumeCapacityConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeCapacityConversion.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAoEF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAe1D,CAAC"}
|
|
@@ -5,6 +5,7 @@ const decimal_1 = require("../../../math/numbers/decimals/decimal");
|
|
|
5
5
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
6
6
|
const coinFlip_1 = require("../../../utils/alea/coinFlip");
|
|
7
7
|
const shuffle_1 = require("../../../utils/alea/shuffle");
|
|
8
|
+
const doWhile_1 = require("../../../utils/doWhile");
|
|
8
9
|
const exercise_1 = require("../../exercise");
|
|
9
10
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
10
11
|
const volumeUnits = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
|
|
@@ -14,7 +15,7 @@ const getVolumeCapacityConversion = () => {
|
|
|
14
15
|
const randomUnitIndex = (0, randint_1.randint)(
|
|
15
16
|
// cette manip a pour but d'éviter des conversion avec des nombres trop grand/petit
|
|
16
17
|
randomUnitInstructionIndex - 1 < 0 ? 0 : randomUnitInstructionIndex - 1, randomUnitInstructionIndex + 2 > 7 ? 7 : randomUnitInstructionIndex + 2);
|
|
17
|
-
const random = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
|
|
18
|
+
const random = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
|
|
18
19
|
let instructionUnit;
|
|
19
20
|
let answerUnit;
|
|
20
21
|
let answer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeConversion.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAExB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAiEF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
|
|
@@ -4,6 +4,7 @@ exports.volumeConversion = void 0;
|
|
|
4
4
|
const decimal_1 = require("../../../math/numbers/decimals/decimal");
|
|
5
5
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
6
6
|
const shuffle_1 = require("../../../utils/alea/shuffle");
|
|
7
|
+
const doWhile_1 = require("../../../utils/doWhile");
|
|
7
8
|
const exercise_1 = require("../../exercise");
|
|
8
9
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
9
10
|
const units = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
|
|
@@ -12,7 +13,7 @@ const getVolumeConversion = () => {
|
|
|
12
13
|
const randomUnitInstructionIndex = (0, randint_1.randint)(
|
|
13
14
|
// cette manip a pour but d'éviter des conversion de type km³ --> cm³ ou le contraire (chiffre trop grand/petit)
|
|
14
15
|
randomUnitIndex - 2 < 0 ? 0 : randomUnitIndex - 2, randomUnitIndex + 2 > 6 ? 6 : randomUnitIndex + 2, [randomUnitIndex]);
|
|
15
|
-
const randomVolume = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
|
|
16
|
+
const randomVolume = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
|
|
16
17
|
const answer = (randomVolume.multiplyByPowerOfTen(3 * (randomUnitIndex - randomUnitInstructionIndex)).value + "").replace(".", ",");
|
|
17
18
|
const question = {
|
|
18
19
|
instruction: `Compléter : $${randomVolume.value
|