math-exercises 2.2.10 → 2.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/exercise.d.ts +2 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/decimals/index.d.ts +3 -0
- package/lib/exercises/math/calcul/decimals/index.d.ts.map +1 -0
- package/lib/exercises/math/calcul/decimals/index.js +18 -0
- package/lib/exercises/math/calcul/decimals/multiplyDecimalByNegativeTens.d.ts +8 -0
- package/lib/exercises/math/calcul/decimals/multiplyDecimalByNegativeTens.d.ts.map +1 -0
- package/lib/exercises/math/calcul/decimals/multiplyDecimalByNegativeTens.js +53 -0
- package/lib/exercises/math/calcul/decimals/multiplyDecimalByTens.d.ts +9 -0
- package/lib/exercises/math/calcul/decimals/multiplyDecimalByTens.d.ts.map +1 -0
- package/lib/exercises/math/calcul/decimals/multiplyDecimalByTens.js +63 -0
- package/lib/exercises/math/calcul/index.d.ts +2 -0
- package/lib/exercises/math/calcul/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/index.js +2 -0
- package/lib/exercises/math/calcul/operations/index.d.ts +2 -0
- package/lib/exercises/math/calcul/operations/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/index.js +2 -0
- package/lib/exercises/math/calcul/operations/operationsPriorities.d.ts +1 -1
- package/lib/exercises/math/calcul/operations/operationsPriorities.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/operationsPriorities.js +20 -5
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.d.ts +8 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.d.ts.map +1 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.js +111 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.d.ts +8 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.d.ts.map +1 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.js +127 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.js +18 -1
- package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts +9 -0
- package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/decimalOrdering.js +77 -0
- package/lib/exercises/math/calcul/ordering/framing.d.ts +10 -0
- package/lib/exercises/math/calcul/ordering/framing.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/framing.js +143 -0
- package/lib/exercises/math/calcul/ordering/index.d.ts +4 -0
- package/lib/exercises/math/calcul/ordering/index.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/index.js +19 -0
- package/lib/exercises/math/calcul/ordering/integerOrdering.d.ts +8 -0
- package/lib/exercises/math/calcul/ordering/integerOrdering.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/integerOrdering.js +61 -0
- package/lib/exercises/math/derivation/derivative/powerFunctionDerivative.js +1 -1
- package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.js +1 -1
- package/lib/exercises/math/functions/basics/graphicInequation.js +6 -6
- package/lib/exercises/math/functions/basics/twoFunctionsInequation.js +6 -6
- package/lib/exercises/math/percent/htToTTC.d.ts +8 -0
- package/lib/exercises/math/percent/htToTTC.d.ts.map +1 -0
- package/lib/exercises/math/percent/htToTTC.js +50 -0
- package/lib/exercises/math/percent/index.d.ts +2 -0
- package/lib/exercises/math/percent/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/index.js +2 -0
- package/lib/exercises/math/percent/ttcToHT.d.ts +8 -0
- package/lib/exercises/math/percent/ttcToHT.d.ts.map +1 -0
- package/lib/exercises/math/percent/ttcToHT.js +50 -0
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +2 -11
- package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.js +1 -1
- package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.js +1 -1
- package/lib/exercises/pc/motion/typeOfAcceleration.js +1 -1
- package/lib/exercises/pc/motion/typeOfMovement.js +1 -1
- package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.js +1 -1
- package/lib/index.d.ts +32 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.d.ts +2 -0
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.js +18 -0
- package/lib/math/sets/intervals/intervals.d.ts.map +1 -1
- package/lib/math/sets/intervals/intervals.js +2 -2
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +0 -5
- package/lib/tree/nodes/inequations/inequationSolutionNode.js +1 -1
- package/lib/tree/nodes/node.d.ts +2 -0
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +9 -6
- package/lib/tree/nodes/sets/intervalNode.js +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.js +1 -1
- package/lib/types/keyProps.d.ts +13 -0
- package/lib/types/keyProps.d.ts.map +1 -0
- package/lib/types/keyProps.js +2 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { KeyId } from "../types/keyIds";
|
|
2
|
+
import { KeyProps } from "../types/keyProps";
|
|
2
3
|
export declare const addValidProp: (props: Proposition[], statement: string, format?: "tex" | "raw") => void;
|
|
3
4
|
export declare const addWrongProp: (props: Proposition[], statement: string, format?: "tex" | "raw") => void;
|
|
4
5
|
export declare const tryToAddWrongProp: (props: Proposition[], statement: string, format?: "tex" | "raw") => void;
|
|
@@ -18,7 +19,7 @@ export interface Question<TIdentifiers = {}> {
|
|
|
18
19
|
answer?: string;
|
|
19
20
|
answerFormat?: "tex" | "raw";
|
|
20
21
|
ggbAnswer?: string[];
|
|
21
|
-
keys?: KeyId[];
|
|
22
|
+
keys?: (KeyId | KeyProps)[];
|
|
22
23
|
commands?: string[];
|
|
23
24
|
coords?: number[];
|
|
24
25
|
options?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIhD,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAQtB,CAAC;AACF,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAQtB,CAAC;AACF,eAAO,MAAM,iBAAiB,UACrB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAUtB,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,WAAW,EAAE,KAAK,MAAM,kBAE3D,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAElC,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC;CACvB,CAAC;AACF,MAAM,WAAW,QAAQ,CAAC,YAAY,GAAG,EAAE;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM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ACjB,cAAc,GACd,cAAc,GACd,QAAQ,GACR,UAAU,GACV,uBAAuB,GACvB,oBAAoB,GACpB,eAAe,GACf,gBAAgB,GAChB,UAAU,CAAC;AAEf,MAAM,MAAM,SAAS,GACjB,mBAAmB,GACnB,sBAAsB,GACtB,QAAQ,GACR,kBAAkB,GAClB,WAAW,GACX,SAAS,GACT,cAAc,GACd,+CAA+C,GAC/C,OAAO,GACP,KAAK,GACL,wBAAwB,GACxB,SAAS,GACT,KAAK,GACL,aAAa,GACb,4BAA4B,GAC5B,oBAAoB,GACpB,WAAW,GACX,iBAAiB,GACjB,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/decimals/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./multiplyDecimalByTens"), exports);
|
|
18
|
+
__exportStar(require("./multiplyDecimalByNegativeTens"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
dec: number;
|
|
4
|
+
pow: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const multiplyDecimalByNegativeTens: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=multiplyDecimalByNegativeTens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiplyDecimalByNegativeTens.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/decimals/multiplyDecimalByNegativeTens.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAgDF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAc/D,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.multiplyDecimalByNegativeTens = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const decimal_1 = require("../../../../math/numbers/decimals/decimal");
|
|
7
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
9
|
+
const getMultiplyDecimalByNegativeTensQuestion = () => {
|
|
10
|
+
const dec = decimal_1.DecimalConstructor.random(-200, 200, (0, randint_1.randint)(1, 5));
|
|
11
|
+
const pow = -(0, randint_1.randint)(1, 4);
|
|
12
|
+
const factor = Math.pow(10, pow);
|
|
13
|
+
const answer = dec.multiplyByPowerOfTen(pow).toTree().toTex();
|
|
14
|
+
const statement = new multiplyNode_1.MultiplyNode(dec.toTree(), factor.toTree());
|
|
15
|
+
const question = {
|
|
16
|
+
answer,
|
|
17
|
+
instruction: `Calculer : $${statement.toTex()}$`,
|
|
18
|
+
keys: [],
|
|
19
|
+
answerFormat: "tex",
|
|
20
|
+
identifiers: { dec: dec.value, pow },
|
|
21
|
+
};
|
|
22
|
+
return question;
|
|
23
|
+
};
|
|
24
|
+
const getPropositions = (n, { answer, dec, pow }) => {
|
|
25
|
+
const propositions = [];
|
|
26
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
27
|
+
const decimal = new decimal_1.Decimal(dec);
|
|
28
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, decimal.multiplyByPowerOfTen(-pow).toTree().toTex());
|
|
29
|
+
while (propositions.length < n) {
|
|
30
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, decimal
|
|
31
|
+
.multiplyByPowerOfTen((0, randint_1.randint)(-5, 5, [pow, -pow]))
|
|
32
|
+
.toTree()
|
|
33
|
+
.toTex());
|
|
34
|
+
}
|
|
35
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
36
|
+
};
|
|
37
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
38
|
+
return ans === answer;
|
|
39
|
+
};
|
|
40
|
+
exports.multiplyDecimalByNegativeTens = {
|
|
41
|
+
id: "multiplyDecimalByNegativeTens",
|
|
42
|
+
connector: "=",
|
|
43
|
+
label: "Multiplier un décimal par $0,1$, par $0,01$ ou par $0,001$",
|
|
44
|
+
levels: [],
|
|
45
|
+
isSingleStep: true,
|
|
46
|
+
sections: [],
|
|
47
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getMultiplyDecimalByNegativeTensQuestion, nb),
|
|
48
|
+
qcmTimer: 60,
|
|
49
|
+
freeTimer: 60,
|
|
50
|
+
getPropositions,
|
|
51
|
+
isAnswerValid,
|
|
52
|
+
subject: "Mathématiques",
|
|
53
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
dec: number;
|
|
4
|
+
pow: number;
|
|
5
|
+
isDivide: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const multiplyDecimalByTens: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=multiplyDecimalByTens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiplyDecimalByTens.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/decimals/multiplyDecimalByTens.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAsDF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.multiplyDecimalByTens = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const decimal_1 = require("../../../../math/numbers/decimals/decimal");
|
|
7
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
|
+
const divideNode_1 = require("../../../../tree/nodes/operators/divideNode");
|
|
9
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
10
|
+
const coinFlip_1 = require("../../../../utils/coinFlip");
|
|
11
|
+
const getMultiplyDecimalByTensQuestion = () => {
|
|
12
|
+
const dec = decimal_1.DecimalConstructor.random(-200, 200, (0, randint_1.randint)(1, 5));
|
|
13
|
+
const pow = (0, randint_1.randint)(1, 4);
|
|
14
|
+
const factor = Math.pow(10, pow);
|
|
15
|
+
const isDivide = (0, coinFlip_1.coinFlip)();
|
|
16
|
+
const answer = dec
|
|
17
|
+
.multiplyByPowerOfTen(isDivide ? -pow : pow)
|
|
18
|
+
.toTree()
|
|
19
|
+
.toTex();
|
|
20
|
+
const statement = new (isDivide ? divideNode_1.DivideNode : multiplyNode_1.MultiplyNode)(dec.toTree(), factor.toTree());
|
|
21
|
+
const question = {
|
|
22
|
+
answer,
|
|
23
|
+
instruction: `Calculer : $${statement.toTex()}$`,
|
|
24
|
+
keys: [],
|
|
25
|
+
answerFormat: "tex",
|
|
26
|
+
identifiers: { dec: dec.value, pow, isDivide },
|
|
27
|
+
};
|
|
28
|
+
return question;
|
|
29
|
+
};
|
|
30
|
+
const getPropositions = (n, { answer, dec, isDivide, pow }) => {
|
|
31
|
+
const propositions = [];
|
|
32
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
33
|
+
const decimal = new decimal_1.Decimal(dec);
|
|
34
|
+
const opposite = decimal
|
|
35
|
+
.multiplyByPowerOfTen(isDivide ? pow : -pow)
|
|
36
|
+
.toTree()
|
|
37
|
+
.toTex();
|
|
38
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, opposite);
|
|
39
|
+
while (propositions.length < n) {
|
|
40
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, decimal
|
|
41
|
+
.multiplyByPowerOfTen((0, randint_1.randint)(-5, 5, [pow, -pow]))
|
|
42
|
+
.toTree()
|
|
43
|
+
.toTex());
|
|
44
|
+
}
|
|
45
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
46
|
+
};
|
|
47
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
48
|
+
return ans === answer;
|
|
49
|
+
};
|
|
50
|
+
exports.multiplyDecimalByTens = {
|
|
51
|
+
id: "multiplyDecimalByTens",
|
|
52
|
+
connector: "=",
|
|
53
|
+
label: "Multiplier/diviser un décimal par une puissance de 10",
|
|
54
|
+
levels: [],
|
|
55
|
+
isSingleStep: true,
|
|
56
|
+
sections: [],
|
|
57
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getMultiplyDecimalByTensQuestion, nb),
|
|
58
|
+
qcmTimer: 60,
|
|
59
|
+
freeTimer: 60,
|
|
60
|
+
getPropositions,
|
|
61
|
+
isAnswerValid,
|
|
62
|
+
subject: "Mathématiques",
|
|
63
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
|
@@ -26,3 +26,5 @@ __exportStar(require("./digitRank"), exports);
|
|
|
26
26
|
__exportStar(require("./digitDecimalRank"), exports);
|
|
27
27
|
__exportStar(require("./digitRankNumber"), exports);
|
|
28
28
|
__exportStar(require("./digitDecimalRankNumber"), exports);
|
|
29
|
+
__exportStar(require("./ordering"), exports);
|
|
30
|
+
__exportStar(require("./decimals"), exports);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from "./operationsPriorities";
|
|
2
2
|
export * from "./operationsPrioritiesWithoutRelative";
|
|
3
3
|
export * from "./expressionNature";
|
|
4
|
+
export * from "./operationsPrioritiesParenthesis";
|
|
5
|
+
export * from "./operationsPrioritiesParenthesisNoRelatives";
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,uCAAuC,CAAC;AACtD,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,uCAAuC,CAAC;AACtD,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,8CAA8C,CAAC"}
|
|
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./operationsPriorities"), exports);
|
|
18
18
|
__exportStar(require("./operationsPrioritiesWithoutRelative"), exports);
|
|
19
19
|
__exportStar(require("./expressionNature"), exports);
|
|
20
|
+
__exportStar(require("./operationsPrioritiesParenthesis"), exports);
|
|
21
|
+
__exportStar(require("./operationsPrioritiesParenthesisNoRelatives"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operationsPriorities.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPriorities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"operationsPriorities.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPriorities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AAmJF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
|
|
@@ -18,7 +18,7 @@ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
|
18
18
|
const coinFlip_1 = require("../../../../utils/coinFlip");
|
|
19
19
|
const shuffle_1 = require("../../../../utils/shuffle");
|
|
20
20
|
const getPriorityQuestions = () => {
|
|
21
|
-
const type = (0, randint_1.randint)(1,
|
|
21
|
+
const type = (0, randint_1.randint)(1, 9);
|
|
22
22
|
let startStatement = "";
|
|
23
23
|
let answer = "";
|
|
24
24
|
let a, b, c, d;
|
|
@@ -71,15 +71,30 @@ const getPriorityQuestions = () => {
|
|
|
71
71
|
startStatement = statement.toTex();
|
|
72
72
|
answer = (a / b + c / d).toString();
|
|
73
73
|
break;
|
|
74
|
-
case
|
|
75
|
-
[b, d] = [1, 2].map((el) => (0, randint_1.randint)(-10, 11, [0]));
|
|
76
|
-
a = b * (0, randint_1.randint)(0, 11);
|
|
77
|
-
c = d * (0, randint_1.randint)(0, 11);
|
|
74
|
+
case 6: // a*b*c ± d
|
|
75
|
+
[a, b, c, d] = [1, 2, 3, 4].map((el) => (0, randint_1.randint)(-10, 11, [0]));
|
|
78
76
|
statement = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new numberNode_1.NumberNode(c)), new numberNode_1.NumberNode(d));
|
|
79
77
|
statement.shuffle();
|
|
80
78
|
startStatement = statement.toTex();
|
|
81
79
|
answer = (a * b * c + d).toString();
|
|
82
80
|
break;
|
|
81
|
+
case 7: //a/b*c et c*a/b
|
|
82
|
+
b = (0, randint_1.randint)(2, 10);
|
|
83
|
+
a = b * (0, randint_1.randint)(2, 10);
|
|
84
|
+
c = (0, randint_1.randint)(2, 10);
|
|
85
|
+
statement = new multiplyNode_1.MultiplyNode(new divideNode_1.DivideNode(a.toTree(), b.toTree()), c.toTree());
|
|
86
|
+
statement.shuffle();
|
|
87
|
+
answer = ((a / b) * c).frenchify();
|
|
88
|
+
startStatement = statement.toTex();
|
|
89
|
+
break;
|
|
90
|
+
case 8: //a+-b+-c
|
|
91
|
+
a = (0, randint_1.randint)(-15, 15);
|
|
92
|
+
b = (0, randint_1.randint)(-10, 10);
|
|
93
|
+
c = b > 0 ? (0, randint_1.randint)(-10, 0) : (0, randint_1.randint)(-10, 10);
|
|
94
|
+
statement = new addNode_1.AddNode(new addNode_1.AddNode(a.toTree(), b.toTree()), c.toTree());
|
|
95
|
+
answer = (a + b + c).frenchify();
|
|
96
|
+
startStatement = statement.toTex();
|
|
97
|
+
break;
|
|
83
98
|
default:
|
|
84
99
|
throw Error("impossible");
|
|
85
100
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
nodeIds: any;
|
|
4
|
+
type: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const operationsPrioritiesParenthesis: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=operationsPrioritiesParenthesis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationsPrioritiesParenthesis.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPrioritiesParenthesis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAkHF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAcjE,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.operationsPrioritiesParenthesis = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
7
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
8
|
+
const divideNode_1 = require("../../../../tree/nodes/operators/divideNode");
|
|
9
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
10
|
+
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
11
|
+
const coinFlip_1 = require("../../../../utils/coinFlip");
|
|
12
|
+
const getOperationsPrioritiesParenthesisQuestion = () => {
|
|
13
|
+
const type = (0, randint_1.randint)(1, 5);
|
|
14
|
+
let a, b, c, d;
|
|
15
|
+
let statement;
|
|
16
|
+
let answer = "";
|
|
17
|
+
switch (type) {
|
|
18
|
+
case 1: //a*(b+-c)
|
|
19
|
+
a = (0, randint_1.randint)(-10, 11, [0, 1, -1]);
|
|
20
|
+
[b, c] = [1, 2].map((el) => (0, randint_1.randint)(-10, 11, [0]));
|
|
21
|
+
statement = new multiplyNode_1.MultiplyNode(a.toTree(), new addNode_1.AddNode(b.toTree(), c.toTree()));
|
|
22
|
+
statement.shuffle();
|
|
23
|
+
answer = (a * (b + c)).frenchify();
|
|
24
|
+
break;
|
|
25
|
+
case 2: //a/(b+-c) ou (b+-c)/a
|
|
26
|
+
if ((0, coinFlip_1.coinFlip)()) {
|
|
27
|
+
//a/(b+-c)
|
|
28
|
+
b = (0, randint_1.randint)(-10, 11);
|
|
29
|
+
c = (0, randint_1.randint)(-10, 11, [-b]);
|
|
30
|
+
a = (b + c) * (0, randint_1.randint)(2, 10);
|
|
31
|
+
statement = new divideNode_1.DivideNode(a.toTree(), new addNode_1.AddNode(b.toTree(), c.toTree()));
|
|
32
|
+
answer = (a / (b + c)).frenchify();
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
//(b+-c)/a
|
|
36
|
+
a = (0, randint_1.randint)(2, 10);
|
|
37
|
+
let k = a * (0, randint_1.randint)(2, 10);
|
|
38
|
+
b = k - (0, randint_1.randint)(-10, 11, [0]);
|
|
39
|
+
c = k - b;
|
|
40
|
+
statement = new divideNode_1.DivideNode(new addNode_1.AddNode(b.toTree(), c.toTree()), a.toTree());
|
|
41
|
+
answer = ((b + c) / a).frenchify();
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
case 3: // (a+-b)*/(c+-d)
|
|
45
|
+
if ((0, coinFlip_1.coinFlip)()) {
|
|
46
|
+
//(a+-b)*(c+-d)
|
|
47
|
+
[a, b, c, d] = [1, 2, 3, 4].map((el) => (0, randint_1.randint)(-10, 11, [0]));
|
|
48
|
+
statement = new multiplyNode_1.MultiplyNode(new addNode_1.AddNode(a.toTree(), b.toTree()), new addNode_1.AddNode(c.toTree(), d.toTree()));
|
|
49
|
+
answer = ((a + b) * (c + d)).frenchify();
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
//(a+-b)/(c+-d)
|
|
53
|
+
c = (0, randint_1.randint)(-10, 11, [0]);
|
|
54
|
+
d = (0, randint_1.randint)(-10, 11, [0, -c]);
|
|
55
|
+
let k = (0, randint_1.randint)(2, 10) * (c + d);
|
|
56
|
+
a = k - (0, randint_1.randint)(-10, 11, [0]);
|
|
57
|
+
b = k - a;
|
|
58
|
+
statement = new divideNode_1.DivideNode(new addNode_1.AddNode(a.toTree(), b.toTree()), new addNode_1.AddNode(c.toTree(), d.toTree()));
|
|
59
|
+
answer = ((a + b) / (c + d)).frenchify();
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
case 4: // a +- (b+- c/*d)
|
|
63
|
+
default:
|
|
64
|
+
a = (0, randint_1.randint)(-10, 11, [0]);
|
|
65
|
+
b = (0, randint_1.randint)(-10, 11, [0]);
|
|
66
|
+
d = (0, randint_1.randint)(2, 10);
|
|
67
|
+
const isAdd = (0, coinFlip_1.coinFlip)();
|
|
68
|
+
const isDivide = (0, coinFlip_1.coinFlip)();
|
|
69
|
+
if (isDivide)
|
|
70
|
+
c = d * (0, randint_1.randint)(2, 10);
|
|
71
|
+
else
|
|
72
|
+
c = (0, randint_1.randint)(-10, 11, [0]);
|
|
73
|
+
const isAdd2 = (0, coinFlip_1.coinFlip)();
|
|
74
|
+
statement = new (isAdd ? addNode_1.AddNode : substractNode_1.SubstractNode)(a.toTree(), new (isAdd2 ? addNode_1.AddNode : substractNode_1.SubstractNode)(b.toTree(), new (isDivide ? divideNode_1.DivideNode : multiplyNode_1.MultiplyNode)(c.toTree(), d.toTree()), { forceParenthesis: isAdd }));
|
|
75
|
+
answer = statement.evaluate({}).toString();
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
const question = {
|
|
79
|
+
answer,
|
|
80
|
+
instruction: `Calculer : $${statement.toTex()}$`,
|
|
81
|
+
keys: [],
|
|
82
|
+
answerFormat: "tex",
|
|
83
|
+
identifiers: { nodeIds: statement.toIdentifiers(), type },
|
|
84
|
+
};
|
|
85
|
+
return question;
|
|
86
|
+
};
|
|
87
|
+
const getPropositions = (n, { answer }) => {
|
|
88
|
+
const propositions = [];
|
|
89
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
90
|
+
while (propositions.length < n) {
|
|
91
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(-100, 100) + "");
|
|
92
|
+
}
|
|
93
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
94
|
+
};
|
|
95
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
96
|
+
return ans === answer;
|
|
97
|
+
};
|
|
98
|
+
exports.operationsPrioritiesParenthesis = {
|
|
99
|
+
id: "operationsPrioritiesParenthesis",
|
|
100
|
+
connector: "=",
|
|
101
|
+
label: "Priorités opératoires avec parenthèses",
|
|
102
|
+
levels: [],
|
|
103
|
+
isSingleStep: true,
|
|
104
|
+
sections: [],
|
|
105
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getOperationsPrioritiesParenthesisQuestion, nb),
|
|
106
|
+
qcmTimer: 60,
|
|
107
|
+
freeTimer: 60,
|
|
108
|
+
getPropositions,
|
|
109
|
+
isAnswerValid,
|
|
110
|
+
subject: "Mathématiques",
|
|
111
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
nodeIds: any;
|
|
4
|
+
type: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const operationsPrioritiesParenthesisNoRelatives: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=operationsPrioritiesParenthesisNoRelatives.d.ts.map
|
package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operationsPrioritiesParenthesisNoRelatives.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAoIF,eAAO,MAAM,0CAA0C,EAAE,QAAQ,CAAC,WAAW,CAkB1E,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.operationsPrioritiesParenthesisNoRelatives = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
7
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
8
|
+
const divideNode_1 = require("../../../../tree/nodes/operators/divideNode");
|
|
9
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
10
|
+
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
11
|
+
const coinFlip_1 = require("../../../../utils/coinFlip");
|
|
12
|
+
const getOperationsPrioritiesParenthesisNoRelativesQuestion = () => {
|
|
13
|
+
const type = (0, randint_1.randint)(1, 5);
|
|
14
|
+
let a, b, c, d;
|
|
15
|
+
let statement;
|
|
16
|
+
let answer = "";
|
|
17
|
+
switch (type) {
|
|
18
|
+
case 1: //a*(b+-c)
|
|
19
|
+
a = (0, randint_1.randint)(2, 11);
|
|
20
|
+
b = (0, randint_1.randint)(1, 11);
|
|
21
|
+
c = (0, randint_1.randint)(-b, 11, [0]);
|
|
22
|
+
statement = new multiplyNode_1.MultiplyNode(a.toTree(), new addNode_1.AddNode(b.toTree(), c.toTree()));
|
|
23
|
+
statement.shuffle();
|
|
24
|
+
answer = (a * (b + c)).frenchify();
|
|
25
|
+
break;
|
|
26
|
+
case 2: //a/(b+-c) ou (b+-c)/a
|
|
27
|
+
if ((0, coinFlip_1.coinFlip)()) {
|
|
28
|
+
//a/(b+-c)
|
|
29
|
+
b = (0, randint_1.randint)(1, 11);
|
|
30
|
+
c = (0, randint_1.randint)(-b + 1, 11);
|
|
31
|
+
a = (b + c) * (0, randint_1.randint)(2, 10);
|
|
32
|
+
statement = new divideNode_1.DivideNode(a.toTree(), new addNode_1.AddNode(b.toTree(), c.toTree()));
|
|
33
|
+
answer = (a / (b + c)).frenchify();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
//(b+-c)/a
|
|
37
|
+
a = (0, randint_1.randint)(2, 10);
|
|
38
|
+
let k = a * (0, randint_1.randint)(2, 10);
|
|
39
|
+
b = Math.max(k - (0, randint_1.randint)(-10, 11, [0]), 1);
|
|
40
|
+
c = k - b;
|
|
41
|
+
statement = new divideNode_1.DivideNode(new addNode_1.AddNode(b.toTree(), c.toTree()), a.toTree());
|
|
42
|
+
answer = ((b + c) / a).frenchify();
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
case 3: // (a+-b)*/(c+-d)
|
|
46
|
+
if ((0, coinFlip_1.coinFlip)()) {
|
|
47
|
+
//(a+-b)*(c+-d)
|
|
48
|
+
[a, c] = [1, 2].map((el) => (0, randint_1.randint)(1, 11));
|
|
49
|
+
b = (0, randint_1.randint)(-a, 11, [0]);
|
|
50
|
+
d = (0, randint_1.randint)(-c, 11, [0]);
|
|
51
|
+
statement = new multiplyNode_1.MultiplyNode(new addNode_1.AddNode(a.toTree(), b.toTree()), new addNode_1.AddNode(c.toTree(), d.toTree()));
|
|
52
|
+
answer = ((a + b) * (c + d)).frenchify();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
//(a+-b)/(c+-d)
|
|
56
|
+
c = (0, randint_1.randint)(1, 11);
|
|
57
|
+
d = (0, randint_1.randint)(-c + 1, 11, [0]);
|
|
58
|
+
let k = (0, randint_1.randint)(2, 10) * (c + d);
|
|
59
|
+
a = Math.max(k - (0, randint_1.randint)(-10, 11, [0]), 1);
|
|
60
|
+
b = k - a;
|
|
61
|
+
statement = new divideNode_1.DivideNode(new addNode_1.AddNode(a.toTree(), b.toTree()), new addNode_1.AddNode(c.toTree(), d.toTree()));
|
|
62
|
+
answer = ((a + b) / (c + d)).frenchify();
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
case 4: // a +- (b+- c/*d)
|
|
66
|
+
default:
|
|
67
|
+
d = (0, randint_1.randint)(2, 10);
|
|
68
|
+
const isAdd = (0, coinFlip_1.coinFlip)();
|
|
69
|
+
const isDivide = (0, coinFlip_1.coinFlip)();
|
|
70
|
+
const isAdd2 = (0, coinFlip_1.coinFlip)();
|
|
71
|
+
let secondValue = 0;
|
|
72
|
+
if (isDivide)
|
|
73
|
+
c = d * (0, randint_1.randint)(2, 10);
|
|
74
|
+
else
|
|
75
|
+
c = (0, randint_1.randint)(1, 11);
|
|
76
|
+
if (isAdd2) {
|
|
77
|
+
b = (0, randint_1.randint)(1, 11);
|
|
78
|
+
secondValue = b + (isDivide ? c / d : c * d);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
b = (0, randint_1.randint)(isDivide ? c / d + 1 : c * d + 1, isDivide ? c / d + 10 : c * d + 10);
|
|
82
|
+
secondValue = b - (isDivide ? c / d : c * d);
|
|
83
|
+
}
|
|
84
|
+
if (isAdd) {
|
|
85
|
+
a = (0, randint_1.randint)(1, 11);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
a = (0, randint_1.randint)(secondValue + 1, secondValue + 10);
|
|
89
|
+
}
|
|
90
|
+
statement = new (isAdd ? addNode_1.AddNode : substractNode_1.SubstractNode)(a.toTree(), new (isAdd2 ? addNode_1.AddNode : substractNode_1.SubstractNode)(b.toTree(), new (isDivide ? divideNode_1.DivideNode : multiplyNode_1.MultiplyNode)(c.toTree(), d.toTree()), { forceParenthesis: isAdd }));
|
|
91
|
+
answer = statement.evaluate({}).toString();
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
const question = {
|
|
95
|
+
answer,
|
|
96
|
+
instruction: `Calculer : $${statement.toTex()}$`,
|
|
97
|
+
keys: [],
|
|
98
|
+
answerFormat: "tex",
|
|
99
|
+
identifiers: { nodeIds: statement.toIdentifiers(), type },
|
|
100
|
+
};
|
|
101
|
+
return question;
|
|
102
|
+
};
|
|
103
|
+
const getPropositions = (n, { answer }) => {
|
|
104
|
+
const propositions = [];
|
|
105
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
106
|
+
while (propositions.length < n) {
|
|
107
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(10, 100) + "");
|
|
108
|
+
}
|
|
109
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
110
|
+
};
|
|
111
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
112
|
+
return ans === answer;
|
|
113
|
+
};
|
|
114
|
+
exports.operationsPrioritiesParenthesisNoRelatives = {
|
|
115
|
+
id: "operationsPrioritiesParenthesisNoRelatives",
|
|
116
|
+
connector: "=",
|
|
117
|
+
label: "Priorités opératoires avec parenthèses (sans relatifs)",
|
|
118
|
+
levels: [],
|
|
119
|
+
isSingleStep: true,
|
|
120
|
+
sections: [],
|
|
121
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getOperationsPrioritiesParenthesisNoRelativesQuestion, nb),
|
|
122
|
+
qcmTimer: 60,
|
|
123
|
+
freeTimer: 60,
|
|
124
|
+
getPropositions,
|
|
125
|
+
isAnswerValid,
|
|
126
|
+
subject: "Mathématiques",
|
|
127
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operationsPrioritiesWithoutRelative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"operationsPrioritiesWithoutRelative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiSF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAcrE,CAAC"}
|
|
@@ -18,7 +18,7 @@ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
|
18
18
|
const coinFlip_1 = require("../../../../utils/coinFlip");
|
|
19
19
|
const shuffle_1 = require("../../../../utils/shuffle");
|
|
20
20
|
const getOperationsPrioritiesWithoutRelative = () => {
|
|
21
|
-
const type = (0, randint_1.randint)(1,
|
|
21
|
+
const type = (0, randint_1.randint)(1, 9);
|
|
22
22
|
const flip = (0, randint_1.randint)(1, 4);
|
|
23
23
|
let startStatement = "";
|
|
24
24
|
let answer = "";
|
|
@@ -161,6 +161,23 @@ const getOperationsPrioritiesWithoutRelative = () => {
|
|
|
161
161
|
answer = (a * b * c + d).toString();
|
|
162
162
|
}
|
|
163
163
|
break;
|
|
164
|
+
case 7: //a/b*c et c*a/b
|
|
165
|
+
b = (0, randint_1.randint)(2, 10);
|
|
166
|
+
a = b * (0, randint_1.randint)(2, 10);
|
|
167
|
+
c = (0, randint_1.randint)(2, 10);
|
|
168
|
+
statement = new multiplyNode_1.MultiplyNode(new divideNode_1.DivideNode(a.toTree(), b.toTree()), c.toTree());
|
|
169
|
+
statement.shuffle();
|
|
170
|
+
answer = ((a / b) * c).frenchify();
|
|
171
|
+
startStatement = statement.toTex();
|
|
172
|
+
break;
|
|
173
|
+
case 8: //a+-b+-c
|
|
174
|
+
a = (0, randint_1.randint)(5, 15);
|
|
175
|
+
b = (0, randint_1.randint)(-a, 10);
|
|
176
|
+
c = b > 0 ? (0, randint_1.randint)(-(a + b), 0) : (0, randint_1.randint)(-(a + b), 10);
|
|
177
|
+
statement = new addNode_1.AddNode(new addNode_1.AddNode(a.toTree(), b.toTree()), c.toTree());
|
|
178
|
+
answer = (a + b + c).frenchify();
|
|
179
|
+
startStatement = statement.toTex();
|
|
180
|
+
break;
|
|
164
181
|
default:
|
|
165
182
|
throw Error("impossible");
|
|
166
183
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decimalOrdering.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/decimalOrdering.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA8D1D,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAejD,CAAC"}
|