math-exercises 1.3.38 → 1.3.40
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/calcul/addAndSub.d.ts.map +1 -1
- package/lib/exercises/calcul/addAndSub.js +29 -2
- package/lib/exercises/calcul/addAndSubWithoutRelatives.d.ts.map +1 -1
- package/lib/exercises/calcul/addAndSubWithoutRelatives.js +26 -0
- package/lib/exercises/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
- package/lib/exercises/calcul/arithmetics/primeNumbers.js +48 -9
- package/lib/exercises/calcul/fractions/fractionAndIntegerDivision.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionAndIntegerDivision.js +29 -0
- package/lib/exercises/calcul/fractions/fractionAndIntegerProduct.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionAndIntegerProduct.js +27 -0
- package/lib/exercises/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionAndIntegerSum.js +27 -0
- package/lib/exercises/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionToPercentToDecimal.js +48 -1
- package/lib/exercises/calcul/fractions/fractionsDivision.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionsDivision.js +27 -0
- package/lib/exercises/calcul/fractions/fractionsProduct.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionsProduct.js +27 -0
- package/lib/exercises/calcul/fractions/fractionsSum.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionsSum.js +27 -0
- package/lib/exercises/calcul/fractions/simplifyFraction.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/simplifyFraction.js +26 -0
- package/lib/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.d.ts.map +1 -1
- package/lib/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.js +30 -0
- package/lib/exercises/calcul/mentalCaluls.ts/mentalDivisions.d.ts.map +1 -1
- package/lib/exercises/calcul/mentalCaluls.ts/mentalDivisions.js +29 -0
- package/lib/exercises/calcul/mentalCaluls.ts/mentalMultiplications.d.ts.map +1 -1
- package/lib/exercises/calcul/mentalCaluls.ts/mentalMultiplications.js +26 -0
- package/lib/exercises/calcul/mentalCaluls.ts/mentalPercentage.d.ts.map +1 -1
- package/lib/exercises/calcul/mentalCaluls.ts/mentalPercentage.js +65 -0
- package/lib/exercises/calcul/operations/operationsPriorities.d.ts.map +1 -1
- package/lib/exercises/calcul/operations/operationsPriorities.js +25 -0
- package/lib/exercises/calcul/operations/operationsPrioritiesWithoutRelative.d.ts.map +1 -1
- package/lib/exercises/calcul/operations/operationsPrioritiesWithoutRelative.js +25 -0
- package/lib/exercises/calcul/proportionality/proportionalityTable.d.ts +4 -0
- package/lib/exercises/calcul/proportionality/proportionalityTable.d.ts.map +1 -0
- package/lib/exercises/calcul/proportionality/proportionalityTable.js +78 -0
- package/lib/exercises/calcul/rounding/rounding.d.ts.map +1 -1
- package/lib/exercises/calcul/rounding/rounding.js +49 -0
- package/lib/exercises/calculLitteral/distributivity/doubleDistributivity.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/distributivity/doubleDistributivity.js +45 -0
- package/lib/exercises/calculLitteral/distributivity/firstIdentity.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/distributivity/firstIdentity.js +45 -0
- package/lib/exercises/calculLitteral/distributivity/secondIdentity.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/distributivity/secondIdentity.js +45 -0
- package/lib/exercises/calculLitteral/distributivity/simpleDistributivity.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/distributivity/simpleDistributivity.js +45 -1
- package/lib/exercises/calculLitteral/distributivity/thirdIdentity.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/distributivity/thirdIdentity.js +45 -0
- package/lib/exercises/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationSimpleSquare.js +106 -0
- package/lib/exercises/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType1Exercise.js +27 -0
- package/lib/exercises/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType2Exercise.js +27 -0
- package/lib/exercises/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType3Exercise.js +27 -0
- package/lib/exercises/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType4Exercise.js +27 -0
- package/lib/exercises/calculLitteral/equation/evaluateExpression.d.ts +4 -0
- package/lib/exercises/calculLitteral/equation/evaluateExpression.d.ts.map +1 -0
- package/lib/exercises/calculLitteral/equation/evaluateExpression.js +61 -0
- package/lib/exercises/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/firstDegreeEquation.js +25 -0
- package/lib/exercises/calculLitteral/equation/fractionEquation.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/fractionEquation.js +32 -0
- package/lib/exercises/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/multiplicationEquation.js +35 -0
- package/lib/exercises/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/factorisation/factoIdRmq1.js +32 -0
- package/lib/exercises/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/factorisation/factoIdRmq2.js +38 -0
- package/lib/exercises/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/factorisation/factoIdRmq3.js +44 -0
- package/lib/exercises/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/factorisation/factoType1Exercise.js +42 -0
- package/lib/exercises/calculLitteral/simplifying/reduceExpression.d.ts +4 -0
- package/lib/exercises/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -0
- package/lib/exercises/calculLitteral/simplifying/reduceExpression.js +118 -0
- package/lib/exercises/conversion/aeraConversion.d.ts.map +1 -1
- package/lib/exercises/conversion/aeraConversion.js +27 -0
- package/lib/exercises/conversion/capacityConversion.d.ts.map +1 -1
- package/lib/exercises/conversion/capacityConversion.js +27 -0
- package/lib/exercises/conversion/lengthConversion.d.ts.map +1 -1
- package/lib/exercises/conversion/lengthConversion.js +26 -0
- package/lib/exercises/conversion/massConversion.d.ts.map +1 -1
- package/lib/exercises/conversion/massConversion.js +26 -0
- package/lib/exercises/conversion/volumeCapacityConversion.d.ts.map +1 -1
- package/lib/exercises/conversion/volumeCapacityConversion.js +29 -3
- package/lib/exercises/conversion/volumeConversion.d.ts.map +1 -1
- package/lib/exercises/conversion/volumeConversion.js +26 -0
- package/lib/exercises/derivation/derivative/constanteDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/constanteDerivative.js +26 -0
- package/lib/exercises/derivation/derivative/firstDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/firstDegreeDerivative.js +26 -0
- package/lib/exercises/derivation/derivative/inverseFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/inverseFunctionDerivative.js +26 -0
- package/lib/exercises/derivation/derivative/powerFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/powerFunctionDerivative.js +26 -0
- package/lib/exercises/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/rootFunctionDerivative.js +36 -0
- package/lib/exercises/derivation/derivative/secondDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/secondDegreeDerivative.js +31 -0
- package/lib/exercises/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/thirdDegreeDerivative.js +30 -0
- package/lib/exercises/derivation/derivativeNumberReading.d.ts.map +1 -1
- package/lib/exercises/derivation/derivativeNumberReading.js +30 -0
- package/lib/exercises/exercise.d.ts +6 -0
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/exercises.d.ts.map +1 -1
- package/lib/exercises/exercises.js +8 -0
- package/lib/exercises/geometry/cartesian/distanceBetweenTwoPoints.d.ts +4 -0
- package/lib/exercises/geometry/cartesian/distanceBetweenTwoPoints.d.ts.map +1 -0
- package/lib/exercises/geometry/cartesian/distanceBetweenTwoPoints.js +101 -0
- package/lib/exercises/geometry/cartesian/leadingCoefficient.d.ts.map +1 -1
- package/lib/exercises/geometry/cartesian/leadingCoefficient.js +30 -0
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.d.ts.map +1 -1
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.js +26 -0
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.d.ts.map +1 -1
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.js +26 -0
- package/lib/exercises/geometry/cartesian/midpoint.d.ts.map +1 -1
- package/lib/exercises/geometry/cartesian/midpoint.js +29 -0
- package/lib/exercises/geometry/euclidean/circleArea.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/circleArea.js +28 -1
- package/lib/exercises/geometry/euclidean/circleCircumference.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/circleCircumference.js +28 -1
- package/lib/exercises/geometry/euclidean/pythagore.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/pythagore.js +47 -0
- package/lib/exercises/geometry/euclidean/pythagoreCalcul.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/pythagoreCalcul.js +28 -0
- package/lib/exercises/geometry/euclidean/rectangleArea.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/rectangleArea.js +25 -0
- package/lib/exercises/geometry/euclidean/rectanglePerimeter.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/rectanglePerimeter.js +25 -0
- package/lib/exercises/geometry/euclidean/rightTriangleArea.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/rightTriangleArea.js +25 -0
- package/lib/exercises/geometry/euclidean/squareArea.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/squareArea.js +25 -0
- package/lib/exercises/geometry/euclidean/squarePerimeter.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/squarePerimeter.js +25 -0
- package/lib/exercises/geometry/euclidean/thales.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/thales.js +44 -1
- package/lib/exercises/geometry/euclidean/thalesCalcul.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/thalesCalcul.js +25 -0
- package/lib/exercises/geometry/euclidean/triangleArea.d.ts.map +1 -0
- package/lib/exercises/geometry/euclidean/{TriangleArea.js → triangleArea.js} +24 -0
- package/lib/exercises/geometry/euclidean/triangleAreaV2.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/triangleAreaV2.js +32 -1
- package/lib/exercises/geometry/euclidean/trianglePerimeter.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/trianglePerimeter.js +26 -0
- package/lib/exercises/geometry/euclidean/trigonometry.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/trigonometry.js +39 -0
- package/lib/exercises/geometry/euclidean/trigonometryAngleCalcul.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/trigonometryAngleCalcul.js +24 -0
- package/lib/exercises/geometry/euclidean/trigonometrySideCalcul.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/trigonometrySideCalcul.js +25 -0
- package/lib/exercises/geometry/vectors/scalarProductViaCoords.d.ts.map +1 -1
- package/lib/exercises/geometry/vectors/scalarProductViaCoords.js +28 -1
- package/lib/exercises/percent/applyPercent.d.ts.map +1 -1
- package/lib/exercises/percent/applyPercent.js +30 -0
- package/lib/exercises/percent/averageEvolutionRate.d.ts.map +1 -1
- package/lib/exercises/percent/averageEvolutionRate.js +32 -2
- package/lib/exercises/percent/globalPercent.d.ts.map +1 -1
- package/lib/exercises/percent/globalPercent.js +30 -0
- package/lib/exercises/percent/reciprocalPercentage.d.ts.map +1 -1
- package/lib/exercises/percent/reciprocalPercentage.js +30 -0
- package/lib/exercises/powers/powersDivision.d.ts.map +1 -1
- package/lib/exercises/powers/powersDivision.js +29 -1
- package/lib/exercises/powers/powersOfTenToDecimal.d.ts.map +1 -1
- package/lib/exercises/powers/powersOfTenToDecimal.js +28 -0
- package/lib/exercises/powers/powersPower.d.ts.map +1 -1
- package/lib/exercises/powers/powersPower.js +28 -0
- package/lib/exercises/powers/powersProduct.d.ts.map +1 -1
- package/lib/exercises/powers/powersProduct.js +29 -1
- package/lib/exercises/powers/scientificToDecimal.d.ts.map +1 -1
- package/lib/exercises/powers/scientificToDecimal.js +27 -0
- package/lib/exercises/proba/conditionalProbability.d.ts.map +1 -1
- package/lib/exercises/proba/conditionalProbability.js +25 -0
- package/lib/exercises/proba/marginalAndConditionalFrequency.d.ts.map +1 -1
- package/lib/exercises/proba/marginalAndConditionalFrequency.js +25 -0
- package/lib/exercises/proba/probabilityTree.d.ts.map +1 -1
- package/lib/exercises/proba/probabilityTree.js +33 -6
- package/lib/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.js +25 -0
- package/lib/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.js +25 -0
- package/lib/exercises/sequences/arithmetic/arithmeticFindReason.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticFindReason.js +25 -0
- package/lib/exercises/sequences/arithmetic/arithmeticReasonUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticReasonUsage.js +25 -0
- package/lib/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.js +25 -0
- package/lib/exercises/sequences/arithmetic/arithmeticThresholdFind.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticThresholdFind.js +25 -0
- package/lib/exercises/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricExplicitFormulaUsage.js +25 -0
- package/lib/exercises/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricFindExplicitFormula.js +31 -0
- package/lib/exercises/sequences/geometric/geometricFindReason.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricFindReason.js +31 -0
- package/lib/exercises/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricReasonUsage.js +31 -0
- package/lib/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.js +31 -0
- package/lib/exercises/squareRoots/simpifySquareRoot.d.ts.map +1 -1
- package/lib/exercises/squareRoots/simpifySquareRoot.js +29 -0
- package/lib/math/geometry/point.d.ts +1 -0
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +9 -0
- package/lib/math/polynomials/polynomial.d.ts +1 -0
- package/lib/math/polynomials/polynomial.d.ts.map +1 -1
- package/lib/math/polynomials/polynomial.js +8 -1
- package/lib/server.js +16 -20
- package/package.json +7 -6
- package/lib/exercises/geometry/cartesian/derivativeNumberReading.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/derivativeNumberReading.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/derivativeNumberReading.js +0 -51
- package/lib/exercises/geometry/cartesian/derivativeNumberReading2.d.ts +0 -1
- package/lib/exercises/geometry/cartesian/derivativeNumberReading2.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/derivativeNumberReading2.js +0 -91
- package/lib/exercises/geometry/euclidean/TriangleArea.d.ts.map +0 -1
- /package/lib/exercises/geometry/euclidean/{TriangleArea.d.ts → triangleArea.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addAndSub.d.ts","sourceRoot":"","sources":["../../../src/exercises/calcul/addAndSub.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addAndSub.d.ts","sourceRoot":"","sources":["../../../src/exercises/calcul/addAndSub.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAU/B,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAmDhD"}
|
|
@@ -4,7 +4,9 @@ exports.getAddAndSubQuestions = exports.addAndSubExercise = void 0;
|
|
|
4
4
|
const randint_1 = require("../../math/utils/random/randint");
|
|
5
5
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
6
6
|
const addNode_1 = require("../../tree/nodes/operators/addNode");
|
|
7
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
7
8
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
9
|
+
const uuid_1 = require("uuid");
|
|
8
10
|
/**
|
|
9
11
|
* a±b±c±d
|
|
10
12
|
*/
|
|
@@ -30,11 +32,36 @@ function getAddAndSubQuestions() {
|
|
|
30
32
|
for (let i = 2; i < allNumbersNodes.length; i++) {
|
|
31
33
|
statementTree = new addNode_1.AddNode(statementTree, allNumbersNodes[i]);
|
|
32
34
|
}
|
|
33
|
-
const answer = numbers.reduce((a, b) => a + b)
|
|
35
|
+
const answer = numbers.reduce((a, b) => a + b);
|
|
36
|
+
const getPropositions = (n) => {
|
|
37
|
+
const res = [];
|
|
38
|
+
res.push({
|
|
39
|
+
id: (0, uuid_1.v4)() + '',
|
|
40
|
+
statement: answer.toString(),
|
|
41
|
+
isRightAnswer: true,
|
|
42
|
+
});
|
|
43
|
+
for (let i = 0; i < n - 1; i++) {
|
|
44
|
+
let isDuplicate;
|
|
45
|
+
let proposition;
|
|
46
|
+
do {
|
|
47
|
+
const randomOffset = (0, randint_1.randint)(-9, 10, [0]);
|
|
48
|
+
const wrongAnswer = answer + randomOffset;
|
|
49
|
+
proposition = {
|
|
50
|
+
id: (0, uuid_1.v4)() + '',
|
|
51
|
+
statement: wrongAnswer.toString(),
|
|
52
|
+
isRightAnswer: false,
|
|
53
|
+
};
|
|
54
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
55
|
+
} while (isDuplicate);
|
|
56
|
+
res.push(proposition);
|
|
57
|
+
}
|
|
58
|
+
return (0, shuffle_1.shuffle)(res);
|
|
59
|
+
};
|
|
34
60
|
const question = {
|
|
35
61
|
startStatement: statementTree.toTex(),
|
|
36
|
-
answer: answer,
|
|
62
|
+
answer: answer + '',
|
|
37
63
|
keys: [],
|
|
64
|
+
getPropositions,
|
|
38
65
|
};
|
|
39
66
|
return question;
|
|
40
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addAndSubWithoutRelatives.d.ts","sourceRoot":"","sources":["../../../src/exercises/calcul/addAndSubWithoutRelatives.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addAndSubWithoutRelatives.d.ts","sourceRoot":"","sources":["../../../src/exercises/calcul/addAndSubWithoutRelatives.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,QAUvC,CAAC;AAEF,wBAAgB,4BAA4B,IAAI,QAAQ,CAgEvD"}
|
|
@@ -4,7 +4,9 @@ exports.getAddAndSubWithoutRelatives = exports.addAndSubWithoutRelatives = void
|
|
|
4
4
|
const randint_1 = require("../../math/utils/random/randint");
|
|
5
5
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
6
6
|
const addNode_1 = require("../../tree/nodes/operators/addNode");
|
|
7
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
7
8
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
9
|
+
const uuid_1 = require("uuid");
|
|
8
10
|
/**
|
|
9
11
|
* a±b±c±d
|
|
10
12
|
*/
|
|
@@ -41,10 +43,34 @@ function getAddAndSubWithoutRelatives() {
|
|
|
41
43
|
}
|
|
42
44
|
answer = numbers.reduce((a, b) => a + b);
|
|
43
45
|
}
|
|
46
|
+
const getPropositions = (n) => {
|
|
47
|
+
const propositions = [];
|
|
48
|
+
propositions.push({
|
|
49
|
+
id: (0, uuid_1.v4)() + '',
|
|
50
|
+
statement: answer.toString(),
|
|
51
|
+
isRightAnswer: true,
|
|
52
|
+
});
|
|
53
|
+
for (let i = 0; i < n - 1; i++) {
|
|
54
|
+
let isDuplicate;
|
|
55
|
+
let proposition;
|
|
56
|
+
do {
|
|
57
|
+
const incorrectAnswer = answer + (0, randint_1.randint)(-5, 6, [0]);
|
|
58
|
+
proposition = {
|
|
59
|
+
id: (0, uuid_1.v4)() + '',
|
|
60
|
+
statement: incorrectAnswer.toString(),
|
|
61
|
+
isRightAnswer: false,
|
|
62
|
+
};
|
|
63
|
+
isDuplicate = propositions.some((p) => p.statement === proposition.statement);
|
|
64
|
+
} while (isDuplicate);
|
|
65
|
+
propositions.push(proposition);
|
|
66
|
+
}
|
|
67
|
+
return (0, shuffle_1.shuffle)(propositions);
|
|
68
|
+
};
|
|
44
69
|
const question = {
|
|
45
70
|
startStatement: statementTree.toTex(),
|
|
46
71
|
answer: answer.toString(),
|
|
47
72
|
keys: [],
|
|
73
|
+
getPropositions,
|
|
48
74
|
};
|
|
49
75
|
return question;
|
|
50
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primeNumbers.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/arithmetics/primeNumbers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"primeNumbers.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/arithmetics/primeNumbers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAGjE;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,QAU1B,CAAC;AAQF,wBAAgB,eAAe,IAAI,QAAQ,CAyE1C"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPrimeNumbers = exports.primeNumbers = void 0;
|
|
4
4
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
5
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
6
|
+
const uuid_1 = require("uuid");
|
|
5
7
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
6
8
|
/**
|
|
7
9
|
* a±b±c±d
|
|
@@ -17,10 +19,16 @@ exports.primeNumbers = {
|
|
|
17
19
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getPrimeNumbers, nb),
|
|
18
20
|
keys: [],
|
|
19
21
|
};
|
|
22
|
+
function prodNumbers(tab) {
|
|
23
|
+
let temp = 1;
|
|
24
|
+
for (let i = 0; i < tab.length; i++)
|
|
25
|
+
temp *= tab[i];
|
|
26
|
+
return temp;
|
|
27
|
+
}
|
|
20
28
|
function getPrimeNumbers() {
|
|
21
29
|
const primes = [2, 3, 5, 7, 11];
|
|
22
30
|
const rand = (0, randint_1.randint)(3, 5);
|
|
23
|
-
let
|
|
31
|
+
let choosenNumbers = [];
|
|
24
32
|
let elevenCount = 0;
|
|
25
33
|
for (let i = 0; i < rand; i++) {
|
|
26
34
|
let temp = (0, randint_1.randint)(0, 5);
|
|
@@ -28,20 +36,51 @@ function getPrimeNumbers() {
|
|
|
28
36
|
elevenCount++;
|
|
29
37
|
while (elevenCount >= 2 && temp === 4)
|
|
30
38
|
temp = (0, randint_1.randint)(0, 5);
|
|
31
|
-
|
|
39
|
+
choosenNumbers.push(primes[temp]);
|
|
32
40
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
for (let i = 1; i < choosenNumebrs.length; i++) {
|
|
39
|
-
answer += `\\times` + choosenNumebrs[i];
|
|
41
|
+
const prod = prodNumbers(choosenNumbers);
|
|
42
|
+
choosenNumbers = choosenNumbers.sort((a, b) => a - b);
|
|
43
|
+
let answer = `${prod} = ${choosenNumbers[0]}`;
|
|
44
|
+
for (let i = 1; i < choosenNumbers.length; i++) {
|
|
45
|
+
answer += `\\times` + choosenNumbers[i];
|
|
40
46
|
}
|
|
47
|
+
const getPropositions = (n) => {
|
|
48
|
+
const res = [];
|
|
49
|
+
res.push({
|
|
50
|
+
id: (0, uuid_1.v4)() + '',
|
|
51
|
+
statement: answer,
|
|
52
|
+
isRightAnswer: true,
|
|
53
|
+
});
|
|
54
|
+
const wrongFactors = [...choosenNumbers];
|
|
55
|
+
for (let i = 0; i < n - 1; i++) {
|
|
56
|
+
let wrongFactor, newFactor, randomIndex, wrongAnswer;
|
|
57
|
+
do {
|
|
58
|
+
randomIndex = (0, randint_1.randint)(0, wrongFactors.length);
|
|
59
|
+
wrongFactor = wrongFactors[randomIndex];
|
|
60
|
+
newFactor = wrongFactor;
|
|
61
|
+
while (newFactor === wrongFactor) {
|
|
62
|
+
const temp = (0, randint_1.randint)(0, primes.length);
|
|
63
|
+
newFactor = primes[temp];
|
|
64
|
+
}
|
|
65
|
+
wrongFactors[randomIndex] = newFactor;
|
|
66
|
+
wrongAnswer = `${prod} = ${wrongFactors[0]}`;
|
|
67
|
+
for (let j = 1; j < wrongFactors.length; j++) {
|
|
68
|
+
wrongAnswer += `\\times` + wrongFactors[j];
|
|
69
|
+
}
|
|
70
|
+
} while (res.find((el) => el.statement === wrongAnswer));
|
|
71
|
+
res.push({
|
|
72
|
+
id: (0, uuid_1.v4)() + '',
|
|
73
|
+
statement: wrongAnswer,
|
|
74
|
+
isRightAnswer: false,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return (0, shuffle_1.shuffle)(res);
|
|
78
|
+
};
|
|
41
79
|
const question = {
|
|
42
80
|
startStatement: `${prod} = ?`,
|
|
43
81
|
answer,
|
|
44
82
|
keys: [],
|
|
83
|
+
getPropositions,
|
|
45
84
|
};
|
|
46
85
|
return question;
|
|
47
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionAndIntegerDivision.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionAndIntegerDivision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"fractionAndIntegerDivision.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionAndIntegerDivision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU3E,eAAO,MAAM,0BAA0B,EAAE,QAUxC,CAAC;AAEF,wBAAgB,6BAA6B,IAAI,QAAQ,CAqDxD"}
|
|
@@ -7,6 +7,8 @@ const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
|
7
7
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
8
8
|
const divideNode_1 = require("../../../tree/nodes/operators/divideNode");
|
|
9
9
|
const coinFlip_1 = require("../../../utils/coinFlip");
|
|
10
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
11
|
+
const uuid_1 = require("uuid");
|
|
10
12
|
exports.fractionAndIntegerDivision = {
|
|
11
13
|
id: 'fractionAndIntegerDivision',
|
|
12
14
|
connector: '=',
|
|
@@ -26,11 +28,38 @@ function getFractionAndIntegerDivision() {
|
|
|
26
28
|
? new divideNode_1.DivideNode(integer.toTree(), rational.toTree())
|
|
27
29
|
: new divideNode_1.DivideNode(rational.toTree(), integer.toTree());
|
|
28
30
|
const answerTree = integerFirst ? integer.divide(rational).toTree() : rational.divide(integer).toTree();
|
|
31
|
+
const getPropositions = (n) => {
|
|
32
|
+
const res = [];
|
|
33
|
+
res.push({
|
|
34
|
+
id: (0, uuid_1.v4)() + '',
|
|
35
|
+
statement: answerTree.toTex(),
|
|
36
|
+
isRightAnswer: true,
|
|
37
|
+
});
|
|
38
|
+
for (let i = 0; i < n - 1; i++) {
|
|
39
|
+
let isDuplicate;
|
|
40
|
+
let proposition;
|
|
41
|
+
do {
|
|
42
|
+
const wrongRational = rational_1.RationalConstructor.randomIrreductible();
|
|
43
|
+
const wrongAnswerTree = integerFirst
|
|
44
|
+
? integer.divide(wrongRational).toTree()
|
|
45
|
+
: wrongRational.divide(integer).toTree();
|
|
46
|
+
proposition = {
|
|
47
|
+
id: (0, uuid_1.v4)() + '',
|
|
48
|
+
statement: wrongAnswerTree.toTex(),
|
|
49
|
+
isRightAnswer: false,
|
|
50
|
+
};
|
|
51
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
52
|
+
} while (isDuplicate);
|
|
53
|
+
res.push(proposition);
|
|
54
|
+
}
|
|
55
|
+
return (0, shuffle_1.shuffle)(res);
|
|
56
|
+
};
|
|
29
57
|
const question = {
|
|
30
58
|
instruction: '',
|
|
31
59
|
startStatement: statementTree.toTex(),
|
|
32
60
|
answer: answerTree.toTex(),
|
|
33
61
|
keys: [],
|
|
62
|
+
getPropositions,
|
|
34
63
|
};
|
|
35
64
|
return question;
|
|
36
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionAndIntegerProduct.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionAndIntegerProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"fractionAndIntegerProduct.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionAndIntegerProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS3E,eAAO,MAAM,yBAAyB,EAAE,QAUvC,CAAC;AAEF,wBAAgB,4BAA4B,IAAI,QAAQ,CA6CvD"}
|
|
@@ -6,6 +6,8 @@ const integer_1 = require("../../../math/numbers/integer/integer");
|
|
|
6
6
|
const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
7
7
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
8
8
|
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
9
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
10
|
+
const uuid_1 = require("uuid");
|
|
9
11
|
exports.fractionAndIntegerProduct = {
|
|
10
12
|
id: 'fractionAndIntegerProduct',
|
|
11
13
|
connector: '=',
|
|
@@ -23,11 +25,36 @@ function getFractionAndIntegerProduct() {
|
|
|
23
25
|
const statementTree = new multiplyNode_1.MultiplyNode(rational.toTree(), integer.toTree());
|
|
24
26
|
statementTree.shuffle();
|
|
25
27
|
const answerTree = rational.multiply(integer).toTree();
|
|
28
|
+
const getPropositions = (n) => {
|
|
29
|
+
const res = [];
|
|
30
|
+
res.push({
|
|
31
|
+
id: (0, uuid_1.v4)() + '',
|
|
32
|
+
statement: answerTree.toTex(),
|
|
33
|
+
isRightAnswer: true,
|
|
34
|
+
});
|
|
35
|
+
for (let i = 0; i < n - 1; i++) {
|
|
36
|
+
let isDuplicate;
|
|
37
|
+
let proposition;
|
|
38
|
+
do {
|
|
39
|
+
const randomMultiplier = (0, randint_1.randint)(-10, 10);
|
|
40
|
+
const wrongAnswerTree = rational.multiply(new integer_1.Integer(randomMultiplier)).toTree();
|
|
41
|
+
proposition = {
|
|
42
|
+
id: (0, uuid_1.v4)() + '',
|
|
43
|
+
statement: wrongAnswerTree.toTex(),
|
|
44
|
+
isRightAnswer: false,
|
|
45
|
+
};
|
|
46
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
47
|
+
} while (isDuplicate);
|
|
48
|
+
res.push(proposition);
|
|
49
|
+
}
|
|
50
|
+
return (0, shuffle_1.shuffle)(res);
|
|
51
|
+
};
|
|
26
52
|
const question = {
|
|
27
53
|
instruction: '',
|
|
28
54
|
startStatement: statementTree.toTex(),
|
|
29
55
|
answer: answerTree.toTex(),
|
|
30
56
|
keys: [],
|
|
57
|
+
getPropositions,
|
|
31
58
|
};
|
|
32
59
|
return question;
|
|
33
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionAndIntegerSum.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionAndIntegerSum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"fractionAndIntegerSum.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionAndIntegerSum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS3E,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CA8CnD"}
|
|
@@ -6,6 +6,8 @@ const integer_1 = require("../../../math/numbers/integer/integer");
|
|
|
6
6
|
const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
7
7
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
8
8
|
const addNode_1 = require("../../../tree/nodes/operators/addNode");
|
|
9
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
10
|
+
const uuid_1 = require("uuid");
|
|
9
11
|
exports.fractionAndIntegerSum = {
|
|
10
12
|
id: 'fractionAndIntegerSum',
|
|
11
13
|
connector: '=',
|
|
@@ -23,11 +25,36 @@ function getFractionAndIntegerSum() {
|
|
|
23
25
|
const statementTree = new addNode_1.AddNode(rational.toTree(), integer.toTree());
|
|
24
26
|
statementTree.shuffle();
|
|
25
27
|
const answerTree = rational.add(integer).toTree();
|
|
28
|
+
const getPropositions = (n) => {
|
|
29
|
+
const res = [];
|
|
30
|
+
res.push({
|
|
31
|
+
id: (0, uuid_1.v4)() + '',
|
|
32
|
+
statement: answerTree.toTex(),
|
|
33
|
+
isRightAnswer: true,
|
|
34
|
+
});
|
|
35
|
+
for (let i = 0; i < n - 1; i++) {
|
|
36
|
+
let isDuplicate;
|
|
37
|
+
let proposition;
|
|
38
|
+
do {
|
|
39
|
+
const rational = rational_1.RationalConstructor.randomIrreductible();
|
|
40
|
+
const wrongAnswerTree = rational.add(integer).toTree();
|
|
41
|
+
proposition = {
|
|
42
|
+
id: (0, uuid_1.v4)() + '',
|
|
43
|
+
statement: wrongAnswerTree.toTex(),
|
|
44
|
+
isRightAnswer: false,
|
|
45
|
+
};
|
|
46
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
47
|
+
} while (isDuplicate);
|
|
48
|
+
res.push(proposition);
|
|
49
|
+
}
|
|
50
|
+
return (0, shuffle_1.shuffle)(res);
|
|
51
|
+
};
|
|
26
52
|
const question = {
|
|
27
53
|
instruction: '',
|
|
28
54
|
startStatement: statementTree.toTex(),
|
|
29
55
|
answer: answerTree.toTex(),
|
|
30
56
|
keys: [],
|
|
57
|
+
getPropositions,
|
|
31
58
|
};
|
|
32
59
|
return question;
|
|
33
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionToPercentToDecimal.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionToPercentToDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"fractionToPercentToDecimal.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionToPercentToDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU3E,eAAO,MAAM,0BAA0B,EAAE,QASxC,CAAC;AAEF,wBAAgB,6BAA6B,IAAI,QAAQ,CAqHxD"}
|
|
@@ -7,6 +7,8 @@ const round_1 = require("../../../math/utils/round");
|
|
|
7
7
|
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
8
8
|
const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
|
|
9
9
|
const simplify_1 = require("../../../tree/parsers/simplify");
|
|
10
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
11
|
+
const uuid_1 = require("uuid");
|
|
10
12
|
exports.fractionToPercentToDecimal = {
|
|
11
13
|
id: 'fractionToPercentToDecimal',
|
|
12
14
|
connector: '\\iff',
|
|
@@ -58,11 +60,56 @@ function getFractionToPercentToDecimal() {
|
|
|
58
60
|
break;
|
|
59
61
|
}
|
|
60
62
|
}
|
|
63
|
+
const getPropositions = (n) => {
|
|
64
|
+
const propositions = [];
|
|
65
|
+
propositions.push({
|
|
66
|
+
id: (0, uuid_1.v4)(),
|
|
67
|
+
statement: answer,
|
|
68
|
+
isRightAnswer: true,
|
|
69
|
+
});
|
|
70
|
+
for (let i = 0; i < n - 1; i++) {
|
|
71
|
+
let isDuplicate;
|
|
72
|
+
let proposition;
|
|
73
|
+
do {
|
|
74
|
+
let statement = '';
|
|
75
|
+
switch (rand) {
|
|
76
|
+
case 1:
|
|
77
|
+
const temp1 = (0, randint_1.randint)(-5, 3, [0]);
|
|
78
|
+
statement = `${(0, round_1.round)(percent * 10 ** temp1, -temp1 + 2)}\\%`;
|
|
79
|
+
break;
|
|
80
|
+
case 2:
|
|
81
|
+
statement = `${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(numerator * (0, randint_1.randint)(1, 20, [0, 1])), new numberNode_1.NumberNode(denominator * (0, randint_1.randint)(1, 20, [0, 1])))).toTex()}`;
|
|
82
|
+
break;
|
|
83
|
+
case 3:
|
|
84
|
+
const temp3 = (0, randint_1.randint)(-5, 3, [0]);
|
|
85
|
+
statement = `${(0, round_1.round)(percent * 10 ** temp3, -temp3 + 2)}`;
|
|
86
|
+
break;
|
|
87
|
+
case 4:
|
|
88
|
+
statement = `${(0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(numerator * (0, randint_1.randint)(1, 20, [0, 1])), new numberNode_1.NumberNode(denominator * (0, randint_1.randint)(1, 20, [0, 1])))).toTex()}`;
|
|
89
|
+
break;
|
|
90
|
+
case 5:
|
|
91
|
+
statement = `${(0, round_1.round)(decimal + Math.random() * 10, 2)}`;
|
|
92
|
+
break;
|
|
93
|
+
case 6:
|
|
94
|
+
statement = `${(0, round_1.round)(percent + Math.random() * 10, 2)}\\%`;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
proposition = {
|
|
98
|
+
id: (0, uuid_1.v4)(),
|
|
99
|
+
statement,
|
|
100
|
+
isRightAnswer: false,
|
|
101
|
+
};
|
|
102
|
+
isDuplicate = propositions.some((p) => p.statement === proposition.statement);
|
|
103
|
+
} while (isDuplicate);
|
|
104
|
+
propositions.push(proposition);
|
|
105
|
+
}
|
|
106
|
+
return (0, shuffle_1.shuffle)(propositions);
|
|
107
|
+
};
|
|
61
108
|
const question = {
|
|
62
109
|
instruction,
|
|
63
|
-
//startStatement: `${numerator} et ${denominator}`,
|
|
64
110
|
answer,
|
|
65
111
|
keys: ['percent'],
|
|
112
|
+
getPropositions,
|
|
66
113
|
};
|
|
67
114
|
return question;
|
|
68
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsDivision.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionsDivision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"fractionsDivision.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionsDivision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,iBAAiB,EAAE,QAU/B,CAAC;AAEF,wBAAgB,oBAAoB,IAAI,QAAQ,CA6C/C"}
|
|
@@ -4,6 +4,8 @@ exports.getFractionsDivision = exports.fractionsDivision = void 0;
|
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
6
6
|
const divideNode_1 = require("../../../tree/nodes/operators/divideNode");
|
|
7
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
7
9
|
exports.fractionsDivision = {
|
|
8
10
|
id: 'fractionsDivision',
|
|
9
11
|
connector: '=',
|
|
@@ -20,11 +22,36 @@ function getFractionsDivision() {
|
|
|
20
22
|
const rational2 = rational_1.RationalConstructor.randomIrreductible();
|
|
21
23
|
const statementTree = new divideNode_1.DivideNode(rational.toTree(), rational2.toTree());
|
|
22
24
|
const answerTree = rational.divide(rational2).toTree();
|
|
25
|
+
const getPropositions = (n) => {
|
|
26
|
+
const res = [];
|
|
27
|
+
res.push({
|
|
28
|
+
id: (0, uuid_1.v4)() + '',
|
|
29
|
+
statement: answerTree.toTex(),
|
|
30
|
+
isRightAnswer: true,
|
|
31
|
+
});
|
|
32
|
+
for (let i = 0; i < n - 1; i++) {
|
|
33
|
+
let isDuplicate;
|
|
34
|
+
let proposition;
|
|
35
|
+
do {
|
|
36
|
+
const randomRational = rational_1.RationalConstructor.randomIrreductible();
|
|
37
|
+
const wrongAnswerTree = randomRational.divide(rational2).toTree();
|
|
38
|
+
proposition = {
|
|
39
|
+
id: (0, uuid_1.v4)() + '',
|
|
40
|
+
statement: wrongAnswerTree.toTex(),
|
|
41
|
+
isRightAnswer: false,
|
|
42
|
+
};
|
|
43
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
44
|
+
} while (isDuplicate);
|
|
45
|
+
res.push(proposition);
|
|
46
|
+
}
|
|
47
|
+
return (0, shuffle_1.shuffle)(res);
|
|
48
|
+
};
|
|
23
49
|
const question = {
|
|
24
50
|
instruction: '',
|
|
25
51
|
startStatement: statementTree.toTex(),
|
|
26
52
|
answer: answerTree.toTex(),
|
|
27
53
|
keys: [],
|
|
54
|
+
getPropositions,
|
|
28
55
|
};
|
|
29
56
|
return question;
|
|
30
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsProduct.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionsProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"fractionsProduct.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionsProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,gBAAgB,EAAE,QAU9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CA4C9C"}
|
|
@@ -4,6 +4,8 @@ exports.getFractionsProduct = exports.fractionsProduct = void 0;
|
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
6
6
|
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
7
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
7
9
|
exports.fractionsProduct = {
|
|
8
10
|
id: 'fractionsProduct',
|
|
9
11
|
connector: '=',
|
|
@@ -20,10 +22,35 @@ function getFractionsProduct() {
|
|
|
20
22
|
const rational2 = rational_1.RationalConstructor.randomIrreductible();
|
|
21
23
|
const statementTree = new multiplyNode_1.MultiplyNode(rational.toTree(), rational2.toTree());
|
|
22
24
|
const answerTree = rational.multiply(rational2).toTree();
|
|
25
|
+
const getPropositions = (n) => {
|
|
26
|
+
const res = [];
|
|
27
|
+
res.push({
|
|
28
|
+
id: (0, uuid_1.v4)() + '',
|
|
29
|
+
statement: answerTree.toTex(),
|
|
30
|
+
isRightAnswer: true,
|
|
31
|
+
});
|
|
32
|
+
for (let i = 0; i < n - 1; i++) {
|
|
33
|
+
let isDuplicate;
|
|
34
|
+
let proposition;
|
|
35
|
+
do {
|
|
36
|
+
const randomRational = rational_1.RationalConstructor.randomIrreductible();
|
|
37
|
+
const wrongAnswerTree = randomRational.multiply(rational2).toTree();
|
|
38
|
+
proposition = {
|
|
39
|
+
id: (0, uuid_1.v4)() + '',
|
|
40
|
+
statement: wrongAnswerTree.toTex(),
|
|
41
|
+
isRightAnswer: false,
|
|
42
|
+
};
|
|
43
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
44
|
+
} while (isDuplicate);
|
|
45
|
+
res.push(proposition);
|
|
46
|
+
}
|
|
47
|
+
return (0, shuffle_1.shuffle)(res);
|
|
48
|
+
};
|
|
23
49
|
const question = {
|
|
24
50
|
startStatement: statementTree.toTex(),
|
|
25
51
|
answer: answerTree.toTex(),
|
|
26
52
|
keys: [],
|
|
53
|
+
getPropositions,
|
|
27
54
|
};
|
|
28
55
|
return question;
|
|
29
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSum.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"fractionsSum.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/fractionsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,YAAY,EAAE,QAU1B,CAAC;AAEF,wBAAgB,eAAe,IAAI,QAAQ,CA4C1C"}
|
|
@@ -4,6 +4,8 @@ exports.getFractionsSum = exports.fractionsSum = void 0;
|
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
6
6
|
const addNode_1 = require("../../../tree/nodes/operators/addNode");
|
|
7
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
7
9
|
exports.fractionsSum = {
|
|
8
10
|
id: 'fractionsSum',
|
|
9
11
|
connector: '=',
|
|
@@ -20,10 +22,35 @@ function getFractionsSum() {
|
|
|
20
22
|
const rational2 = rational_1.RationalConstructor.randomIrreductible();
|
|
21
23
|
const statementTree = new addNode_1.AddNode(rational.toTree(), rational2.toTree());
|
|
22
24
|
const answerTree = rational.add(rational2).toTree();
|
|
25
|
+
const getPropositions = (n) => {
|
|
26
|
+
const propositions = [];
|
|
27
|
+
propositions.push({
|
|
28
|
+
id: (0, uuid_1.v4)(),
|
|
29
|
+
statement: answerTree.toTex(),
|
|
30
|
+
isRightAnswer: true,
|
|
31
|
+
});
|
|
32
|
+
for (let i = 0; i < n - 1; i++) {
|
|
33
|
+
let isDuplicate;
|
|
34
|
+
let proposition;
|
|
35
|
+
do {
|
|
36
|
+
const incorrectRational = rational_1.RationalConstructor.randomIrreductible();
|
|
37
|
+
const incorrectRational2 = rational_1.RationalConstructor.randomIrreductible();
|
|
38
|
+
proposition = {
|
|
39
|
+
id: (0, uuid_1.v4)(),
|
|
40
|
+
statement: incorrectRational.add(incorrectRational2).toTree().toTex(),
|
|
41
|
+
isRightAnswer: false,
|
|
42
|
+
};
|
|
43
|
+
isDuplicate = propositions.some((p) => p.statement === proposition.statement);
|
|
44
|
+
} while (isDuplicate);
|
|
45
|
+
propositions.push(proposition);
|
|
46
|
+
}
|
|
47
|
+
return (0, shuffle_1.shuffle)(propositions);
|
|
48
|
+
};
|
|
23
49
|
const question = {
|
|
24
50
|
startStatement: statementTree.toTex(),
|
|
25
51
|
answer: answerTree.toTex(),
|
|
26
52
|
keys: [],
|
|
53
|
+
getPropositions,
|
|
27
54
|
};
|
|
28
55
|
return question;
|
|
29
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplifyFraction.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/simplifyFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"simplifyFraction.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/fractions/simplifyFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,gBAAgB,EAAE,QAU9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAwC9C"}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getSimplifyFraction = exports.simplifyFraction = void 0;
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
6
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
6
8
|
exports.simplifyFraction = {
|
|
7
9
|
id: 'simplifyFrac',
|
|
8
10
|
connector: '=',
|
|
@@ -16,10 +18,34 @@ exports.simplifyFraction = {
|
|
|
16
18
|
};
|
|
17
19
|
function getSimplifyFraction() {
|
|
18
20
|
const rational = rational_1.RationalConstructor.randomSimplifiable(10);
|
|
21
|
+
const getPropositions = (n) => {
|
|
22
|
+
const propositions = [];
|
|
23
|
+
propositions.push({
|
|
24
|
+
id: (0, uuid_1.v4)(),
|
|
25
|
+
statement: rational.simplify().toTree().toTex(),
|
|
26
|
+
isRightAnswer: true,
|
|
27
|
+
});
|
|
28
|
+
for (let i = 0; i < n - 1; i++) {
|
|
29
|
+
let isDuplicate;
|
|
30
|
+
let proposition;
|
|
31
|
+
do {
|
|
32
|
+
const incorrectRational = rational_1.RationalConstructor.randomSimplifiable(10);
|
|
33
|
+
proposition = {
|
|
34
|
+
id: (0, uuid_1.v4)(),
|
|
35
|
+
statement: incorrectRational.simplify().toTree().toTex(),
|
|
36
|
+
isRightAnswer: false,
|
|
37
|
+
};
|
|
38
|
+
isDuplicate = propositions.some((p) => p.statement === proposition.statement);
|
|
39
|
+
} while (isDuplicate);
|
|
40
|
+
propositions.push(proposition);
|
|
41
|
+
}
|
|
42
|
+
return (0, shuffle_1.shuffle)(propositions);
|
|
43
|
+
};
|
|
19
44
|
const question = {
|
|
20
45
|
startStatement: rational.toTree().toTex(),
|
|
21
46
|
answer: rational.simplify().toTree().toTex(),
|
|
22
47
|
keys: [],
|
|
48
|
+
getPropositions,
|
|
23
49
|
};
|
|
24
50
|
return question;
|
|
25
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mentalAddAndSub.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"mentalAddAndSub.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAU3E,eAAO,MAAM,eAAe,EAAE,QAU7B,CAAC;AAEF,wBAAgB,kBAAkB,IAAI,QAAQ,CA+D7C"}
|