math-exercises 2.2.54 → 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.js +3 -3
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +3 -3
- 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.js
CHANGED
|
@@ -67,7 +67,7 @@ const getFindCoeffInProportionalTableNonIntegersQuestion = () => {
|
|
|
67
67
|
for (let i = 0; i < 3; i++) {
|
|
68
68
|
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
69
69
|
? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
|
|
70
|
-
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) =>
|
|
70
|
+
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => xValues.some((x) => x.equals(y)));
|
|
71
71
|
xValues.push(x);
|
|
72
72
|
}
|
|
73
73
|
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
@@ -78,7 +78,7 @@ const getFindCoeffInProportionalTableNonIntegersQuestion = () => {
|
|
|
78
78
|
for (let i = 0; i < 3; i++) {
|
|
79
79
|
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
80
80
|
? (0, randint_1.randint)(1, 10).toTree()
|
|
81
|
-
: (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) =>
|
|
81
|
+
: (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) => xValues.some((x) => x.equals(y)));
|
|
82
82
|
xValues.push(x);
|
|
83
83
|
}
|
|
84
84
|
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
@@ -90,7 +90,7 @@ const getFindCoeffInProportionalTableNonIntegersQuestion = () => {
|
|
|
90
90
|
for (let i = 0; i < 3; i++) {
|
|
91
91
|
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
92
92
|
? (0, randint_1.randint)(1, 10).toTree()
|
|
93
|
-
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) =>
|
|
93
|
+
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => xValues.some((x) => x.equals(y)));
|
|
94
94
|
xValues.push(x);
|
|
95
95
|
}
|
|
96
96
|
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
@@ -55,7 +55,7 @@ const getIsTableProportionalNonIntegerQuestion = () => {
|
|
|
55
55
|
for (let i = 0; i < 3; i++) {
|
|
56
56
|
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
57
57
|
? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
|
|
58
|
-
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) =>
|
|
58
|
+
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => xValues.some((x) => x.equals(y)));
|
|
59
59
|
xValues.push(x);
|
|
60
60
|
}
|
|
61
61
|
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
@@ -66,7 +66,7 @@ const getIsTableProportionalNonIntegerQuestion = () => {
|
|
|
66
66
|
for (let i = 0; i < 3; i++) {
|
|
67
67
|
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
68
68
|
? (0, randint_1.randint)(1, 10).toTree()
|
|
69
|
-
: (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) =>
|
|
69
|
+
: (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) => xValues.some((x) => x.equals(y)));
|
|
70
70
|
xValues.push(x);
|
|
71
71
|
}
|
|
72
72
|
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
@@ -78,7 +78,7 @@ const getIsTableProportionalNonIntegerQuestion = () => {
|
|
|
78
78
|
for (let i = 0; i < 3; i++) {
|
|
79
79
|
let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
|
|
80
80
|
? (0, randint_1.randint)(1, 10).toTree()
|
|
81
|
-
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) =>
|
|
81
|
+
: rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => xValues.some((x) => x.equals(y)));
|
|
82
82
|
xValues.push(x);
|
|
83
83
|
}
|
|
84
84
|
xValues.sort((a, b) => a.evaluate() - b.evaluate());
|
|
@@ -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
|