math-exercises 3.0.73 → 3.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/calcul/arithmetics/divisorsList.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/divisorsList.js +37 -2
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +2 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +2 -0
- package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.js +123 -0
- package/lib/exercises/math/calcul/arithmetics/paritySumsAndProducts.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/paritySumsAndProducts.js +114 -0
- package/lib/exercises/math/calcul/arithmetics/pgcdCalcul.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/pgcdCalcul.js +28 -1
- package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.js +1 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +37 -2
- package/lib/exercises/math/calcul/arithmetics/whichMultipleAmI.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/whichMultipleAmI.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/whichMultipleAmI.js +131 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.js +52 -4
- package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.js +109 -4
- package/lib/exercises/math/functions/basics/index.d.ts +0 -1
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +19 -0
- package/lib/exercises/math/functions/cube/cubicEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/cube/cubicEquation.js +16 -8
- package/lib/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.js +39 -8
- package/lib/exercises/math/probaStat/cardBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/cardBasicProbas.js +37 -0
- package/lib/exercises/math/probaStat/issuesCountingForCards.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/issuesCountingForCards.js +27 -0
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts +3 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.js +126 -7
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +131 -3
- package/lib/exercises/math/python/index.d.ts +1 -0
- package/lib/exercises/math/python/index.d.ts.map +1 -1
- package/lib/exercises/math/python/index.js +1 -0
- package/lib/exercises/math/python/whileLoopCount.d.ts +8 -0
- package/lib/exercises/math/python/whileLoopCount.d.ts.map +1 -0
- package/lib/exercises/math/python/whileLoopCount.js +94 -0
- package/lib/exercises/math/squareRoots/simpifySquareRoot.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/simpifySquareRoot.js +41 -0
- package/lib/exercises/math/squareRoots/squareRootEquation.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootEquation.js +25 -0
- package/lib/exercises/math/squareRoots/squareRootIdentities.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootIdentities.js +106 -5
- package/lib/exercises/math/squareRoots/squareRootsDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsDistributivity.js +29 -2
- package/lib/exercises/math/squareRoots/squareRootsFractions.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsFractions.js +33 -4
- package/lib/exercises/math/squareRoots/squareRootsProducts.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsProducts.js +27 -4
- package/lib/exercises/math/squareRoots/squareRootsSum.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsSum.js +33 -1
- package/lib/exercises/math/squareRoots/squareRootsToSquare.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsToSquare.js +46 -4
- package/lib/index.d.ts +13 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +9 -5
- package/lib/tree/nodes/functions/absNode.d.ts +2 -2
- package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.js +5 -2
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +15 -6
- package/package.json +1 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
5
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
6
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
7
|
+
const getPropositions = (n, { answer }) => {
|
|
8
|
+
const propositions = [];
|
|
9
|
+
addValidProp(propositions, answer);
|
|
10
|
+
const numberAnswer = parseInt(answer);
|
|
11
|
+
tryToAddWrongProp(propositions, (numberAnswer + 1).frenchify());
|
|
12
|
+
tryToAddWrongProp(propositions, (numberAnswer - 1).frenchify());
|
|
13
|
+
while (propositions.length < n) {
|
|
14
|
+
const random = randint(1, 200);
|
|
15
|
+
tryToAddWrongProp(propositions, random.frenchify());
|
|
16
|
+
}
|
|
17
|
+
return shuffleProps(propositions, n);
|
|
18
|
+
};
|
|
19
|
+
const getKeys = (identifiers) => {
|
|
20
|
+
return [];
|
|
21
|
+
};
|
|
22
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
23
|
+
try {
|
|
24
|
+
const parsedAnswer = parseAlgebraic(answer).simplify();
|
|
25
|
+
const parsedAns = parseAlgebraic(ans).simplify();
|
|
26
|
+
return parsedAnswer.equals(parsedAns);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return handleVEAError(err);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const getAnswer = (identifiers) => {
|
|
33
|
+
const { n, threshold, mode } = identifiers;
|
|
34
|
+
if (mode === "supérieur") {
|
|
35
|
+
const k = Math.ceil(threshold / n);
|
|
36
|
+
return (n * k).frenchify();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const k = Math.floor(threshold / n);
|
|
40
|
+
return (n * k).frenchify();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const getInstruction = (identifiers) => {
|
|
44
|
+
const { n, threshold, mode } = identifiers;
|
|
45
|
+
return `Je suis le plus ${mode == "supérieur" ? "petit" : "grand"} multiple de $${n}$ ${mode} à $${threshold}$. Qui suis-je ?`;
|
|
46
|
+
};
|
|
47
|
+
const getHint = (identifiers) => {
|
|
48
|
+
const { n, threshold, mode } = identifiers;
|
|
49
|
+
if (mode === "supérieur") {
|
|
50
|
+
return `Fais la division euclidienne de $${threshold}$ par $${n}$. Ajoute ensuite $1$ au quotient, et multiplie ce résultat par $15$. `;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return `Fais la division euclidienne de $${threshold}$ par $${n}$. Multiplie ensuite le quotient par $15$. `;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const getCorrection = (identifiers) => {
|
|
57
|
+
const { n, threshold, mode } = identifiers;
|
|
58
|
+
const div = threshold / n;
|
|
59
|
+
const floor = Math.floor(div);
|
|
60
|
+
const ceil = Math.ceil(div);
|
|
61
|
+
const quotient = Math.floor(threshold / n);
|
|
62
|
+
const left = threshold % n;
|
|
63
|
+
if (mode === "supérieur") {
|
|
64
|
+
return `On fais la division euclidienne de $${threshold}$ par $${n}$ :
|
|
65
|
+
|
|
66
|
+
$$
|
|
67
|
+
${threshold} = ${quotient} \\times ${n} + ${left}
|
|
68
|
+
$$
|
|
69
|
+
|
|
70
|
+
On ajoute $1$ au quotient : $${quotient}+1 = ${quotient + 1}$
|
|
71
|
+
|
|
72
|
+
On multiplie enfin par $${n}$ :
|
|
73
|
+
|
|
74
|
+
$$
|
|
75
|
+
${quotient + 1}\\times ${n} = ${getAnswer(identifiers)}
|
|
76
|
+
$$
|
|
77
|
+
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
return `On fais la division euclidienne de $${threshold}$ par $${n}$ :
|
|
82
|
+
|
|
83
|
+
$$
|
|
84
|
+
${threshold} = ${quotient} \\times ${n} + ${left}
|
|
85
|
+
$$
|
|
86
|
+
|
|
87
|
+
On multiplie le quotient par $${n}$ :
|
|
88
|
+
|
|
89
|
+
$$
|
|
90
|
+
${quotient}\\times ${n} = ${getAnswer(identifiers)}
|
|
91
|
+
$$
|
|
92
|
+
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const getWhichMultipleAmIQuestion = (ops) => {
|
|
97
|
+
const x = randint(2, 20);
|
|
98
|
+
let y = 0;
|
|
99
|
+
do {
|
|
100
|
+
y = randint(21, 200);
|
|
101
|
+
} while (y % x === 0);
|
|
102
|
+
const mode = coinFlip() ? "supérieur" : "inférieur";
|
|
103
|
+
const identifiers = { n: x, threshold: y, mode };
|
|
104
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
105
|
+
};
|
|
106
|
+
const getQuestionFromIdentifiers = (identifiers) => ({
|
|
107
|
+
answer: getAnswer(identifiers),
|
|
108
|
+
instruction: getInstruction(identifiers),
|
|
109
|
+
hint: getHint(identifiers),
|
|
110
|
+
correction: getCorrection(identifiers),
|
|
111
|
+
answerFormat: "tex",
|
|
112
|
+
identifiers,
|
|
113
|
+
keys: [],
|
|
114
|
+
});
|
|
115
|
+
export const whichMultipleAmI = {
|
|
116
|
+
id: "whichMultipleAmI",
|
|
117
|
+
label: "Trouver le multiple d’un nombre vérifiant des conditions",
|
|
118
|
+
isSingleStep: true,
|
|
119
|
+
generator: (nb, opts) => getDistinctQuestions(() => getWhichMultipleAmIQuestion(opts), nb),
|
|
120
|
+
qcmTimer: 60,
|
|
121
|
+
freeTimer: 60,
|
|
122
|
+
getPropositions,
|
|
123
|
+
isAnswerValid,
|
|
124
|
+
subject: "Mathématiques",
|
|
125
|
+
getInstruction,
|
|
126
|
+
getHint,
|
|
127
|
+
getCorrection,
|
|
128
|
+
getAnswer,
|
|
129
|
+
getQuestionFromIdentifiers,
|
|
130
|
+
hasHintAndCorrection: true,
|
|
131
|
+
};
|
package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doubleDistributivitySubstract.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"doubleDistributivitySubstract.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AASjD,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,OAAO,EAAE,wBAAwB,CAAC;IAClC,OAAO,EAAE,wBAAwB,CAAC;IAElC,OAAO,EAAE,wBAAwB,CAAC;IAElC,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC,CAAC;AAoLF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAiB/D,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
|
7
7
|
import { square } from "../../../../tree/nodes/operators/powerNode.js";
|
|
8
8
|
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
9
9
|
import { TrinomNodeConstructor } from "../../../../tree/nodes/polynomials/trinomNode.js";
|
|
10
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
10
11
|
//(ax+b)(cx+d)-ex(gx+h)
|
|
11
12
|
//(ax+b)(cx+d)-(ex+f)(gx+h)
|
|
12
13
|
//(ax+b)(cx+d)-(ex+-f)^2
|
|
@@ -70,8 +71,54 @@ ${getStatementNode(identifiers).toTex()}
|
|
|
70
71
|
$$
|
|
71
72
|
`;
|
|
72
73
|
};
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
const getHint = (identifiers) => {
|
|
75
|
+
return "Développe et réduit chacun des produits d'abord. Puis, soustrait les deux résultats.";
|
|
76
|
+
};
|
|
77
|
+
const getCorrection = (identifiers) => {
|
|
78
|
+
const { affine1, affine2, affine3, type, affine4 } = identifiers;
|
|
79
|
+
const affs = [
|
|
80
|
+
GeneralAffineConstructor.fromIdentifiers(affine1),
|
|
81
|
+
GeneralAffineConstructor.fromIdentifiers(affine2),
|
|
82
|
+
GeneralAffineConstructor.fromIdentifiers(affine3),
|
|
83
|
+
affine4 ? GeneralAffineConstructor.fromIdentifiers(affine4) : 0,
|
|
84
|
+
].map((e) => e.toTree());
|
|
85
|
+
const first = multiply(affs[0], affs[1]);
|
|
86
|
+
const second = type === 3 ? square(affs[2]) : multiply(affs[2], affs[3]);
|
|
87
|
+
const firstSimp = first.simplify({
|
|
88
|
+
towardsDistribute: true,
|
|
89
|
+
forbidFactorize: true,
|
|
90
|
+
});
|
|
91
|
+
const secondSimp = second.simplify({
|
|
92
|
+
towardsDistribute: true,
|
|
93
|
+
forbidFactorize: true,
|
|
94
|
+
});
|
|
95
|
+
return `D'une part :
|
|
96
|
+
|
|
97
|
+
${alignTex([
|
|
98
|
+
["", first.toTex()],
|
|
99
|
+
["=", firstSimp.toTex()],
|
|
100
|
+
])}
|
|
101
|
+
|
|
102
|
+
D'autre part :
|
|
103
|
+
${alignTex([
|
|
104
|
+
["", second.toTex()],
|
|
105
|
+
["=", secondSimp.toTex()],
|
|
106
|
+
])}
|
|
107
|
+
|
|
108
|
+
On soustrait les deux résultats :
|
|
109
|
+
|
|
110
|
+
${alignTex([
|
|
111
|
+
["", substract(first, second).toTex()],
|
|
112
|
+
["=", substract(firstSimp, secondSimp).toTex()],
|
|
113
|
+
[
|
|
114
|
+
"=",
|
|
115
|
+
substract(first, second)
|
|
116
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
117
|
+
.toTex(),
|
|
118
|
+
],
|
|
119
|
+
])}
|
|
120
|
+
`;
|
|
121
|
+
};
|
|
75
122
|
const getKeys = (identifiers) => {
|
|
76
123
|
return ["x"];
|
|
77
124
|
};
|
|
@@ -105,8 +152,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
105
152
|
keys: getKeys(identifiers),
|
|
106
153
|
answerFormat: "tex",
|
|
107
154
|
identifiers,
|
|
108
|
-
|
|
109
|
-
|
|
155
|
+
hint: getHint(identifiers),
|
|
156
|
+
correction: getCorrection(identifiers),
|
|
110
157
|
};
|
|
111
158
|
return question;
|
|
112
159
|
};
|
|
@@ -122,4 +169,5 @@ export const doubleDistributivitySubstract = {
|
|
|
122
169
|
isAnswerValid,
|
|
123
170
|
subject: "Mathématiques",
|
|
124
171
|
getQuestionFromIdentifiers,
|
|
172
|
+
hasHintAndCorrection: true,
|
|
125
173
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identitiesWithNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"identitiesWithNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AAgQF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAc3D,CAAC"}
|
|
@@ -12,6 +12,7 @@ import { TrinomNodeConstructor } from "../../../../tree/nodes/polynomials/trinom
|
|
|
12
12
|
import { polynomialParser } from "../../../../tree/parsers/polynomialParser.js";
|
|
13
13
|
import { random } from "../../../../utils/alea/random.js";
|
|
14
14
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
15
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
15
16
|
const getPropositions = (n, { answer, a, b, type }) => {
|
|
16
17
|
const propositions = [];
|
|
17
18
|
addValidProp(propositions, answer);
|
|
@@ -57,11 +58,114 @@ $$
|
|
|
57
58
|
${statement.toTex()}
|
|
58
59
|
$$`;
|
|
59
60
|
};
|
|
60
|
-
// const getHint: GetHint<Identifiers> = (identifiers) => {};
|
|
61
|
-
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
|
|
62
61
|
const getKeys = (identifiers) => {
|
|
63
62
|
return ["x"];
|
|
64
63
|
};
|
|
64
|
+
const getHint = (identifiers) => {
|
|
65
|
+
const { type } = identifiers;
|
|
66
|
+
switch (type) {
|
|
67
|
+
case 1:
|
|
68
|
+
return `Utilise l'identité remarquable :
|
|
69
|
+
|
|
70
|
+
$$
|
|
71
|
+
(a+b)^2 = a^2 + 2ab+b^2
|
|
72
|
+
$$`;
|
|
73
|
+
case 2:
|
|
74
|
+
return `Utilise l'identité remarquable :
|
|
75
|
+
|
|
76
|
+
$$
|
|
77
|
+
(a-b)^2 = a^2 - 2ab+b^2
|
|
78
|
+
$$`;
|
|
79
|
+
case 3:
|
|
80
|
+
default:
|
|
81
|
+
return `Utilise l'identité remarquable :
|
|
82
|
+
|
|
83
|
+
$$
|
|
84
|
+
(a-b)(a+b) = a^2 - b^2
|
|
85
|
+
$$
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const getCorrection = (identifiers) => {
|
|
90
|
+
const { type, a, b } = identifiers;
|
|
91
|
+
const firstTerm = multiply(reifyAlgebraic(a), "x");
|
|
92
|
+
const simpOpts = {
|
|
93
|
+
towardsDistribute: true,
|
|
94
|
+
forbidFactorize: true,
|
|
95
|
+
forceDistributeFractions: true,
|
|
96
|
+
};
|
|
97
|
+
const secondTerm = reifyAlgebraic(b);
|
|
98
|
+
switch (type) {
|
|
99
|
+
case 1:
|
|
100
|
+
return `On utilise l'identité remarquable :
|
|
101
|
+
|
|
102
|
+
$$
|
|
103
|
+
(a+b)^2 = a^2 + 2ab+b^2
|
|
104
|
+
$$
|
|
105
|
+
|
|
106
|
+
On a donc :
|
|
107
|
+
|
|
108
|
+
${alignTex([
|
|
109
|
+
["", square(add(firstTerm, secondTerm)).toTex()],
|
|
110
|
+
[
|
|
111
|
+
"=",
|
|
112
|
+
add(square(firstTerm), add(multiply(multiply(2, firstTerm), secondTerm), square(secondTerm))).toTex(),
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
"=",
|
|
116
|
+
add(square(firstTerm).simplify(simpOpts), add(multiply(multiply(2, firstTerm), secondTerm).simplify(), square(secondTerm).simplify(simpOpts))).toTex(),
|
|
117
|
+
],
|
|
118
|
+
])}
|
|
119
|
+
|
|
120
|
+
`;
|
|
121
|
+
case 2:
|
|
122
|
+
return `On utilise l'identité remarquable :
|
|
123
|
+
|
|
124
|
+
$$
|
|
125
|
+
(a-b)^2 = a^2 - 2ab+b^2
|
|
126
|
+
$$
|
|
127
|
+
|
|
128
|
+
On a donc :
|
|
129
|
+
|
|
130
|
+
${alignTex([
|
|
131
|
+
["", square(substract(firstTerm, secondTerm)).toTex()],
|
|
132
|
+
[
|
|
133
|
+
"=",
|
|
134
|
+
add(square(firstTerm), add(multiply(multiply(-2, firstTerm), secondTerm), square(secondTerm))).toTex(),
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
"=",
|
|
138
|
+
add(square(firstTerm).simplify(simpOpts), add(multiply(-2, multiply(firstTerm, secondTerm)).simplify(), square(secondTerm).simplify(simpOpts)).simplify()).toTex(),
|
|
139
|
+
],
|
|
140
|
+
["=", getAnswer(identifiers)],
|
|
141
|
+
])}
|
|
142
|
+
|
|
143
|
+
`;
|
|
144
|
+
case 3:
|
|
145
|
+
default:
|
|
146
|
+
return `On utilise l'identité remarquable :
|
|
147
|
+
|
|
148
|
+
$$
|
|
149
|
+
(a+b)(a-b) = a^2 - b^2
|
|
150
|
+
$$
|
|
151
|
+
|
|
152
|
+
On a donc :
|
|
153
|
+
|
|
154
|
+
${alignTex([
|
|
155
|
+
[
|
|
156
|
+
"",
|
|
157
|
+
multiply(add(firstTerm, secondTerm), substract(firstTerm, secondTerm)).toTex(),
|
|
158
|
+
],
|
|
159
|
+
["=", substract(square(firstTerm), square(secondTerm)).toTex()],
|
|
160
|
+
[
|
|
161
|
+
"=",
|
|
162
|
+
substract(square(firstTerm).simplify(simpOpts), square(secondTerm).simplify(simpOpts)).toTex(),
|
|
163
|
+
],
|
|
164
|
+
["=", getAnswer(identifiers)],
|
|
165
|
+
])}
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
65
169
|
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
66
170
|
try {
|
|
67
171
|
//this is either genius or dumb
|
|
@@ -116,8 +220,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
116
220
|
keys: getKeys(identifiers),
|
|
117
221
|
answerFormat: "tex",
|
|
118
222
|
identifiers,
|
|
119
|
-
|
|
120
|
-
|
|
223
|
+
hint: getHint(identifiers),
|
|
224
|
+
correction: getCorrection(identifiers),
|
|
121
225
|
};
|
|
122
226
|
return question;
|
|
123
227
|
};
|
|
@@ -133,4 +237,5 @@ export const identitiesWithNonIntegers = {
|
|
|
133
237
|
isAnswerValid,
|
|
134
238
|
subject: "Mathématiques",
|
|
135
239
|
getQuestionFromIdentifiers,
|
|
240
|
+
hasHintAndCorrection: true,
|
|
136
241
|
};
|
|
@@ -9,5 +9,4 @@ export * from "./twoFunctionsInequation.js";
|
|
|
9
9
|
export * from "./inverseImageFunctionTable.js";
|
|
10
10
|
export * from "./imageAntecedentFromSentence.js";
|
|
11
11
|
export * from "./graphicInequationAffine.js";
|
|
12
|
-
export * from "./valueTableCompletion.js";
|
|
13
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC"}
|
|
@@ -9,4 +9,4 @@ export * from "./twoFunctionsInequation.js";
|
|
|
9
9
|
export * from "./inverseImageFunctionTable.js";
|
|
10
10
|
export * from "./imageAntecedentFromSentence.js";
|
|
11
11
|
export * from "./graphicInequationAffine.js";
|
|
12
|
-
export * from "./valueTableCompletion.js";
|
|
12
|
+
// export * from "./valueTableCompletion.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inverseImageFunctionTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunctionTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"inverseImageFunctionTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunctionTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAwIF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAc3D,CAAC"}
|
|
@@ -48,6 +48,22 @@ const getInverseImageFunctionTableQuestion = () => {
|
|
|
48
48
|
};
|
|
49
49
|
return getQuestionFromIdentifiers(identifiers);
|
|
50
50
|
};
|
|
51
|
+
const getHint = (identifiers) => {
|
|
52
|
+
return `- L'image d'un nombre $x$ par la fonction $f$ est le nombre $f(x)$.
|
|
53
|
+
- L'antécédent d'un nombre $y$ par la fonction $f$ est un nombre $x$ tel que $f(x) = y$.`;
|
|
54
|
+
};
|
|
55
|
+
const getCorrection = (identifiers) => {
|
|
56
|
+
const { xValues, imageValues, isAskingImage, value: valueAsked, } = identifiers;
|
|
57
|
+
if (isAskingImage) {
|
|
58
|
+
return `D'après le tableau de valeurs, l'image de $${valueAsked}$ par la fonction $f$ est $f(${valueAsked}) = ${imageValues[xValues.indexOf(valueAsked)]}$.`;
|
|
59
|
+
}
|
|
60
|
+
const xs = xValues
|
|
61
|
+
.filter((el, index) => imageValues[index] === valueAsked)
|
|
62
|
+
.map((e) => `$${e}$`);
|
|
63
|
+
return `On cherche les nombres $x$ tels que $f(x) = ${valueAsked}$. D'après le tableau, ${xs.length > 1
|
|
64
|
+
? `ce sont les nombres ${xs.join(" et ")}.`
|
|
65
|
+
: `c'est le nombre ${xs[0]}.`}`;
|
|
66
|
+
};
|
|
51
67
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
52
68
|
const question = {
|
|
53
69
|
answer: getAnswer(identifiers),
|
|
@@ -56,6 +72,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
56
72
|
answerFormat: "tex",
|
|
57
73
|
style: { tableHasNoHeader: true },
|
|
58
74
|
identifiers,
|
|
75
|
+
hint: getHint(identifiers),
|
|
76
|
+
correction: getCorrection(identifiers),
|
|
59
77
|
};
|
|
60
78
|
return question;
|
|
61
79
|
};
|
|
@@ -91,4 +109,5 @@ export const inverseImageFunctionTable = {
|
|
|
91
109
|
isAnswerValid,
|
|
92
110
|
subject: "Mathématiques",
|
|
93
111
|
getQuestionFromIdentifiers,
|
|
112
|
+
hasHintAndCorrection: true,
|
|
94
113
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cubicEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/cube/cubicEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"cubicEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/cube/cubicEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4EF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAiB/C,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
|
|
|
3
3
|
import { equationKeys } from "../../../../exercises/utils/keys/equationKeys.js";
|
|
4
4
|
import { equationVEA } from "../../../../exercises/vea/equationVEA.js";
|
|
5
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
7
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
7
8
|
const getInstruction = (identifiers) => {
|
|
8
9
|
const k = identifiers.k;
|
|
@@ -18,12 +19,18 @@ const getAnswer = (identifiers) => {
|
|
|
18
19
|
const answer = `S=\\left\\{${x}\\right\\}`;
|
|
19
20
|
return answer;
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const getHint = (identifiers) => {
|
|
23
|
+
return `Quel est le nombre qui, quand on le mulitplie $3$ fois par lui-même, donne $${identifiers.k}$ ?`;
|
|
24
|
+
};
|
|
25
|
+
const getCorrection = (identifiers) => {
|
|
26
|
+
const k = identifiers.k;
|
|
27
|
+
const x = Math.cbrt(k);
|
|
28
|
+
return `Puisque $${x}^3 = ${multiply(multiply(x, x), x).toTex()} = ${k}$, la solution de cette équation est :
|
|
29
|
+
|
|
30
|
+
$$
|
|
31
|
+
${getAnswer(identifiers)}
|
|
32
|
+
$$ `;
|
|
33
|
+
};
|
|
27
34
|
const getCubicEquationQuestion = () => {
|
|
28
35
|
const x = randint(-10, 11);
|
|
29
36
|
const k = x ** 3;
|
|
@@ -37,8 +44,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
37
44
|
keys: equationKeys,
|
|
38
45
|
answerFormat: "tex",
|
|
39
46
|
identifiers,
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
hint: getHint(identifiers),
|
|
48
|
+
correction: getCorrection(identifiers),
|
|
42
49
|
};
|
|
43
50
|
return question;
|
|
44
51
|
};
|
|
@@ -70,4 +77,5 @@ export const cubicEquation = {
|
|
|
70
77
|
getInstruction,
|
|
71
78
|
getAnswer,
|
|
72
79
|
getQuestionFromIdentifiers,
|
|
80
|
+
hasHintAndCorrection: true,
|
|
73
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findRightCalculForPriceEvolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;
|
|
1
|
+
{"version":3,"file":"findRightCalculForPriceEvolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAmLF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAelE,CAAC"}
|
|
@@ -54,12 +54,42 @@ const getInstruction = (identifiers) => {
|
|
|
54
54
|
}
|
|
55
55
|
return "";
|
|
56
56
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
const getHint = (identifiers) => {
|
|
58
|
+
const { askingFinalPrice, evolution, price, type } = identifiers;
|
|
59
|
+
const isHausse = evolution > 0;
|
|
60
|
+
if (askingFinalPrice) {
|
|
61
|
+
return `On doit ${isHausse ? "augmenter" : "diminuer"} $${price}€$ de $${Math.abs(evolution)}\\%$.
|
|
62
|
+
|
|
63
|
+
Pour ${isHausse ? "augmenter" : "diminuer"} un nombre $x$ de $t\\%$, on multiplie $x$ par $1${isHausse ? "+" : "-"}\\frac{t}{100}$.`;
|
|
64
|
+
}
|
|
65
|
+
return `On cherche ce que vaut $${Math.abs(evolution)}\\%$ de $${price}€$.
|
|
66
|
+
|
|
67
|
+
Pour calculer $t\\%$ d'un nombre, on le multiplie par $\\frac{t}{100}$.`;
|
|
68
|
+
};
|
|
69
|
+
const getCorrection = (identifiers) => {
|
|
70
|
+
const { askingFinalPrice, evolution, price, type } = identifiers;
|
|
71
|
+
const isHausse = evolution > 0;
|
|
72
|
+
if (askingFinalPrice) {
|
|
73
|
+
return `On doit ${isHausse ? "augmenter" : "diminuer"} $${price}€$ de $${Math.abs(evolution)}\\%$.
|
|
74
|
+
|
|
75
|
+
Pour ${isHausse ? "augmenter" : "diminuer"} un nombre $x$ de $t\\%$, on multiplie $x$ par $1${isHausse ? "+" : "-"}\\frac{t}{100}$.
|
|
76
|
+
|
|
77
|
+
Le calcul à faire ici est donc :
|
|
78
|
+
|
|
79
|
+
$$
|
|
80
|
+
${getAnswer(identifiers)}
|
|
81
|
+
$$`;
|
|
82
|
+
}
|
|
83
|
+
return `On cherche ce que vaut $${Math.abs(evolution)}\\%$ de $${price}€$.
|
|
84
|
+
|
|
85
|
+
Pour calculer $t\\%$ d'un nombre, on le multiplie par $\\frac{t}{100}$.
|
|
86
|
+
|
|
87
|
+
Le calcul à faire ici est donc :
|
|
88
|
+
|
|
89
|
+
$$
|
|
90
|
+
${getAnswer(identifiers)}
|
|
91
|
+
$$`;
|
|
92
|
+
};
|
|
63
93
|
const getKeys = (identifiers) => {
|
|
64
94
|
return [];
|
|
65
95
|
};
|
|
@@ -92,8 +122,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
92
122
|
keys: getKeys(identifiers),
|
|
93
123
|
answerFormat: "tex",
|
|
94
124
|
identifiers,
|
|
95
|
-
|
|
96
|
-
|
|
125
|
+
hint: getHint(identifiers),
|
|
126
|
+
correction: getCorrection(identifiers),
|
|
97
127
|
};
|
|
98
128
|
return question;
|
|
99
129
|
};
|
|
@@ -110,4 +140,5 @@ export const findRightCalculForPriceEvolution = {
|
|
|
110
140
|
subject: "Mathématiques",
|
|
111
141
|
answerType: "QCU",
|
|
112
142
|
getQuestionFromIdentifiers,
|
|
143
|
+
hasHintAndCorrection: true,
|
|
113
144
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cardBasicProbas.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/cardBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,
|
|
1
|
+
{"version":3,"file":"cardBasicProbas.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/cardBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAAE,UAAU,EAAe,MAAM,oCAAoC,CAAC;AAI7E,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAoJF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAgBjD,CAAC"}
|
|
@@ -60,6 +60,40 @@ const getCardBasicProbasQuestion = () => {
|
|
|
60
60
|
const identifiers = { questionType, value, color: color };
|
|
61
61
|
return getQuestionFromIdentifiers(identifiers);
|
|
62
62
|
};
|
|
63
|
+
const getHint = (identifiers) => {
|
|
64
|
+
const { questionType, value, color } = identifiers;
|
|
65
|
+
return `Dans un jeu de cartes de $52$ cartes, il y a $13$ piques, $13$ trèfles, $13$ coeurs et $13$ carreaux.
|
|
66
|
+
|
|
67
|
+
Chaque couleur est composé de l'as, du deux, du trois, etc.. jusqu'au dix, puis du valet, de la dame et du roi.`;
|
|
68
|
+
};
|
|
69
|
+
const getCorrection = (identifiers) => {
|
|
70
|
+
const { questionType, value, color } = identifiers;
|
|
71
|
+
let target = "";
|
|
72
|
+
switch (questionType) {
|
|
73
|
+
case "oneCard":
|
|
74
|
+
return `Il n'y a qu'${value === "dame" ? "une" : "un"} ${value} de ${color} dans le jeu de $52$ cartes. Puisque chaque carte a la même probabilité d'être tirée, la probabilité d'obtenir un ${value} de ${color} est de :
|
|
75
|
+
|
|
76
|
+
$$
|
|
77
|
+
\\frac{1}{52}
|
|
78
|
+
$$`;
|
|
79
|
+
break;
|
|
80
|
+
case "valueCard":
|
|
81
|
+
return `Dans un jeu de $52$ cartes, il y a $4$ ${value} (${value === "dame" ? "une" : "un"} de chaque couleur). Puisque chaque carte a la même probabilité d'être tirée, la probabilité d'obtenir un ${value} est de :
|
|
82
|
+
|
|
83
|
+
$$
|
|
84
|
+
\\frac{4}{52} = \\frac{1}{13}
|
|
85
|
+
$$`;
|
|
86
|
+
break;
|
|
87
|
+
case "colorCard":
|
|
88
|
+
default:
|
|
89
|
+
return `Il y a $13$ cartes de ${color} dans un jeu de $52$ cartes. Puisque chaque carte a la même probabilité d'être tirée, la probabilité d'obtenir une carte de ${color} est de :
|
|
90
|
+
|
|
91
|
+
$$
|
|
92
|
+
\\frac{13}{52} = \\frac{1}{4}
|
|
93
|
+
$$`;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
63
97
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
64
98
|
const question = {
|
|
65
99
|
answer: getAnswer(identifiers),
|
|
@@ -67,6 +101,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
67
101
|
keys: [],
|
|
68
102
|
answerFormat: "tex",
|
|
69
103
|
identifiers,
|
|
104
|
+
hint: getHint(identifiers),
|
|
105
|
+
correction: getCorrection(identifiers),
|
|
70
106
|
};
|
|
71
107
|
return question;
|
|
72
108
|
};
|
|
@@ -113,4 +149,5 @@ export const cardBasicProbas = {
|
|
|
113
149
|
isAnswerValid,
|
|
114
150
|
subject: "Mathématiques",
|
|
115
151
|
getQuestionFromIdentifiers,
|
|
152
|
+
hasHintAndCorrection: true,
|
|
116
153
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issuesCountingForCards.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/issuesCountingForCards.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"issuesCountingForCards.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/issuesCountingForCards.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA+HF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
|
|
@@ -72,6 +72,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
72
72
|
keys: [],
|
|
73
73
|
answerFormat: "tex",
|
|
74
74
|
identifiers,
|
|
75
|
+
hint: getHint(identifiers),
|
|
76
|
+
correction: getCorrection(identifiers),
|
|
75
77
|
};
|
|
76
78
|
return question;
|
|
77
79
|
};
|
|
@@ -84,6 +86,30 @@ const getPropositions = (n, { answer }) => {
|
|
|
84
86
|
}
|
|
85
87
|
return shuffleProps(propositions, n);
|
|
86
88
|
};
|
|
89
|
+
const getHint = (identifiers) => {
|
|
90
|
+
const { questionType, value, color } = identifiers;
|
|
91
|
+
return `Dans un jeu de cartes de $52$ cartes, il y a des cartes de pique, des cartes de trèfle, des cartes de coeur et des cartes de carreau. Les couleurs pique et trèfle sont des couleurs noires, et les couleurs carreau et coeur sont des couleurs rouges.
|
|
92
|
+
|
|
93
|
+
Chaque couleur est composé de l'as, du deux, du trois, etc.. jusqu'au dix, puis du valet, de la dame et du roi.`;
|
|
94
|
+
};
|
|
95
|
+
const getCorrection = (identifiers) => {
|
|
96
|
+
const { questionType, value, color } = identifiers;
|
|
97
|
+
let target = "";
|
|
98
|
+
switch (questionType) {
|
|
99
|
+
case "oneCard":
|
|
100
|
+
return `Il n'y a qu'${value === "dame" ? "une" : "un"} ${value} de ${color} dans le jeu de $52$ cartes.`;
|
|
101
|
+
break;
|
|
102
|
+
case "valueCard":
|
|
103
|
+
return `Dans un jeu de $52$ cartes, il y a $4$ ${value} (${value === "dame" ? "une" : "un"} de chaque couleur).`;
|
|
104
|
+
break;
|
|
105
|
+
case "colorCard":
|
|
106
|
+
return `Les cartes ${color} sont les cartes de ${color === "rouge" ? "coeur et de carreau" : "pique et de trèfle"}. Puisqu'il y a $13$ cartes de chaque couleur, il y a donc $26$ cartes ${color} dans le jeu.`;
|
|
107
|
+
case "suitCard":
|
|
108
|
+
default:
|
|
109
|
+
return `Il y a $13$ cartes de ${color} dans un jeu de $52$ cartes.`;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
87
113
|
const isAnswerValid = (ans, { answer }) => {
|
|
88
114
|
return ans === answer;
|
|
89
115
|
};
|
|
@@ -99,4 +125,5 @@ export const issuesCountingForCards = {
|
|
|
99
125
|
isAnswerValid,
|
|
100
126
|
subject: "Mathématiques",
|
|
101
127
|
getQuestionFromIdentifiers,
|
|
128
|
+
hasHintAndCorrection: true,
|
|
102
129
|
};
|