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.
@@ -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;AAgBlC,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;AAkHF,eAAO,MAAM,uCAAuC,EAAE,QAAQ,CAAC,WAAW,CAoBzE,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"}
@@ -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
- xValues = [0, 1, 2]
67
- .map((e) => (0, coinFlip_1.coinFlip)()
68
- ? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
69
- : rational_1.RationalConstructor.randomIrreductible().toTree())
70
- .sort((a, b) => a.evaluate() - b.evaluate());
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
- xValues = [0, 1, 2]
76
- .map((e) => (0, coinFlip_1.coinFlip)() ? (0, randint_1.randint)(1, 10).toTree() : (0, randfloat_1.randfloat)(1.1, 10, 1).toTree())
77
- .sort((a, b) => a.evaluate() - b.evaluate());
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
- xValues = [0, 1, 2]
84
- .map((e) => (0, coinFlip_1.coinFlip)()
85
- ? (0, randint_1.randint)(1, 10).toTree()
86
- : rational_1.RationalConstructor.randomIrreductible().toTree())
87
- .sort((a, b) => a.evaluate() - b.evaluate());
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;AAelC,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;AAwGF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAgB/D,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
- xValues = [0, 1, 2]
55
- .map((e) => (0, coinFlip_1.coinFlip)()
56
- ? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
57
- : rational_1.RationalConstructor.randomIrreductible().toTree())
58
- .sort((a, b) => a.evaluate() - b.evaluate());
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
- xValues = [0, 1, 2]
64
- .map((e) => (0, coinFlip_1.coinFlip)() ? (0, randint_1.randint)(1, 10).toTree() : (0, randfloat_1.randfloat)(1.1, 10, 1).toTree())
65
- .sort((a, b) => a.evaluate() - b.evaluate());
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
- xValues = [0, 1, 2]
72
- .map((e) => (0, coinFlip_1.coinFlip)()
73
- ? (0, randint_1.randint)(1, 10).toTree()
74
- : rational_1.RationalConstructor.randomIrreductible().toTree())
75
- .sort((a, b) => a.evaluate() - b.evaluate());
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: "tex",
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":"AAMA,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;AA2DF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
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":"AAMA,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;AAuDF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
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":"AAUA,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;AAqHF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkB3D,CAAC"}
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":"AAOA,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;AAyDF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
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":"AAOA,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;AAkEF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAe1D,CAAC"}
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":"AAMA,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;AA4DF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.2.53",
3
+ "version": "2.2.55",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [