math-exercises 1.4.7 → 1.4.8
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/exercises.d.ts.map +1 -1
- package/lib/exercises/exercises.js +6 -0
- package/lib/exercises/probaStat/ballsBasicProbas.d.ts +4 -0
- package/lib/exercises/probaStat/ballsBasicProbas.d.ts.map +1 -0
- package/lib/exercises/probaStat/ballsBasicProbas.js +70 -0
- package/lib/exercises/probaStat/cardBasicProbas.d.ts +4 -0
- package/lib/exercises/probaStat/cardBasicProbas.d.ts.map +1 -0
- package/lib/exercises/probaStat/cardBasicProbas.js +102 -0
- package/lib/exercises/probaStat/diceBasicProbas.d.ts +4 -0
- package/lib/exercises/probaStat/diceBasicProbas.d.ts.map +1 -0
- package/lib/exercises/probaStat/diceBasicProbas.js +77 -0
- package/lib/exercises/utils/cardsData.d.ts +22 -0
- package/lib/exercises/utils/cardsData.d.ts.map +1 -0
- package/lib/exercises/utils/cardsData.js +26 -0
- package/lib/utils/enumToArray.d.ts +8 -0
- package/lib/utils/enumToArray.d.ts.map +1 -0
- package/lib/utils/enumToArray.js +16 -0
- package/lib/utils/probaFlip.d.ts +5 -0
- package/lib/utils/probaFlip.d.ts.map +1 -1
- package/lib/utils/probaFlip.js +5 -0
- package/lib/utils/probaLawFlip.d.ts +2 -0
- package/lib/utils/probaLawFlip.d.ts.map +1 -0
- package/lib/utils/probaLawFlip.js +19 -0
- package/lib/utils/randomEnumValue.d.ts +2 -0
- package/lib/utils/randomEnumValue.d.ts.map +1 -0
- package/lib/utils/randomEnumValue.js +9 -0
- package/package.json +1 -1
- package/lib/exercises/calculLitteral/equation/evaluateExpression.d.ts +0 -4
- package/lib/exercises/calculLitteral/equation/evaluateExpression.d.ts.map +0 -1
- package/lib/exercises/calculLitteral/equation/evaluateExpression.js +0 -61
- package/lib/exercises/calculLitteral/equation/firstDegreeGeneralEquation.d.ts +0 -4
- package/lib/exercises/calculLitteral/equation/firstDegreeGeneralEquation.d.ts.map +0 -1
- package/lib/exercises/calculLitteral/equation/firstDegreeGeneralEquation.js +0 -32
- package/lib/exercises/functions/affines/template.d.ts +0 -4
- package/lib/exercises/functions/affines/template.d.ts.map +0 -1
- package/lib/exercises/functions/affines/template.js +0 -51
- package/lib/exercises/geometry/cartesian/imageFunction.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/imageFunction.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/imageFunction.js +0 -65
- package/lib/exercises/geometry/cartesian/imageFunctionGeogebra.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/imageFunctionGeogebra.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/imageFunctionGeogebra.js +0 -89
- package/lib/exercises/geometry/cartesian/inverseImageFunction.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/inverseImageFunction.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/inverseImageFunction.js +0 -62
- package/lib/exercises/geometry/cartesian/inverseImageFunctionGeogebra.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/inverseImageFunctionGeogebra.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/inverseImageFunctionGeogebra.js +0 -154
- package/lib/exercises/geometry/cartesian/leadingCoefficient.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/leadingCoefficient.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/leadingCoefficient.js +0 -93
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.js +0 -59
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.js +0 -58
- package/lib/exercises/geometry/cartesian/signFunction.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/signFunction.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/signFunction.js +0 -84
- package/lib/exercises/limits/polynomeLimit.d.ts +0 -4
- package/lib/exercises/limits/polynomeLimit.d.ts.map +0 -1
- package/lib/exercises/limits/polynomeLimit.js +0 -134
- package/lib/exercises/proba/conditionalProbability.d.ts +0 -4
- package/lib/exercises/proba/conditionalProbability.d.ts.map +0 -1
- package/lib/exercises/proba/conditionalProbability.js +0 -99
- package/lib/exercises/proba/marginalAndConditionalFrequency.d.ts +0 -4
- package/lib/exercises/proba/marginalAndConditionalFrequency.d.ts.map +0 -1
- package/lib/exercises/proba/marginalAndConditionalFrequency.js +0 -106
- package/lib/exercises/proba/probabilityTree.d.ts +0 -4
- package/lib/exercises/proba/probabilityTree.d.ts.map +0 -1
- package/lib/exercises/proba/probabilityTree.js +0 -132
- package/lib/exercises/probaStat/frequencyTable.d.ts +0 -4
- package/lib/exercises/probaStat/frequencyTable.d.ts.map +0 -1
- package/lib/exercises/probaStat/frequencyTable.js +0 -76
- package/lib/exercises/sequences/arithmetic/arithmeticSum.d.ts +0 -1
- package/lib/exercises/sequences/arithmetic/arithmeticSum.d.ts.map +0 -1
- package/lib/exercises/sequences/arithmetic/arithmeticSum.js +0 -1
- package/lib/exercises/sets/intervalsUnion.d.ts +0 -4
- package/lib/exercises/sets/intervalsUnion.d.ts.map +0 -1
- package/lib/exercises/sets/intervalsUnion.js +0 -55
- package/lib/exercises/utils/sum.test.d.ts +0 -2
- package/lib/exercises/utils/sum.test.d.ts.map +0 -1
- package/lib/exercises/utils/sum.test.js +0 -22
- package/lib/math/numbers/reals/squareRoot.d.ts +0 -19
- package/lib/math/numbers/reals/squareRoot.d.ts.map +0 -1
- package/lib/math/numbers/reals/squareRoot.js +0 -63
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exercises.d.ts","sourceRoot":"","sources":["../../src/exercises/exercises.ts"],"names":[],"mappings":"AAkLA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"exercises.d.ts","sourceRoot":"","sources":["../../src/exercises/exercises.ts"],"names":[],"mappings":"AAkLA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAc1C,eAAO,MAAM,SAAS,EAAE,YAAY,EA+QnC,CAAC"}
|
|
@@ -179,6 +179,9 @@ const calculateNegativePower_1 = require("./powers/calculateNegativePower");
|
|
|
179
179
|
const decimalToScientific_1 = require("./powers/decimalToScientific");
|
|
180
180
|
const powerDefinition_1 = require("./powers/powerDefinition");
|
|
181
181
|
const niceRootsFromDevForm_1 = require("./functions/trinoms/niceRootsFromDevForm");
|
|
182
|
+
const diceBasicProbas_1 = require("./probaStat/diceBasicProbas");
|
|
183
|
+
const cardBasicProbas_1 = require("./probaStat/cardBasicProbas");
|
|
184
|
+
const ballsBasicProbas_1 = require("./probaStat/ballsBasicProbas");
|
|
182
185
|
exports.exercises = [
|
|
183
186
|
/**
|
|
184
187
|
* calcul litteral
|
|
@@ -338,6 +341,9 @@ exports.exercises = [
|
|
|
338
341
|
*/
|
|
339
342
|
probabilityTree_1.probabilityTree,
|
|
340
343
|
conditionalProbability_1.conditionalProbability,
|
|
344
|
+
diceBasicProbas_1.diceBasicProbas,
|
|
345
|
+
cardBasicProbas_1.cardBasicProbas,
|
|
346
|
+
ballsBasicProbas_1.ballsBasicProbas,
|
|
341
347
|
/**
|
|
342
348
|
* islam
|
|
343
349
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ballsBasicProbas.d.ts","sourceRoot":"","sources":["../../../src/exercises/probaStat/ballsBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAOhH,eAAO,MAAM,gBAAgB,EAAE,YAW9B,CAAC;AAEF,wBAAgB,2BAA2B,IAAI,QAAQ,CA0DtD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBallsBasicProbasQuestion = exports.ballsBasicProbas = void 0;
|
|
4
|
+
const exercise_1 = require("../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const rational_1 = require("../../math/numbers/rationals/rational");
|
|
7
|
+
const randint_1 = require("../../math/utils/random/randint");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
9
|
+
exports.ballsBasicProbas = {
|
|
10
|
+
id: 'ballsBasicProbas',
|
|
11
|
+
connector: '=',
|
|
12
|
+
instruction: '',
|
|
13
|
+
label: 'Calcul de probabilité simple avec des boules colorés',
|
|
14
|
+
levels: ['5ème', '4ème', '3ème', '2ndPro', '2nde', 'CAP'],
|
|
15
|
+
isSingleStep: true,
|
|
16
|
+
sections: ['Probabilités'],
|
|
17
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getBallsBasicProbasQuestion, nb),
|
|
18
|
+
qcmTimer: 60,
|
|
19
|
+
freeTimer: 60,
|
|
20
|
+
};
|
|
21
|
+
function getBallsBasicProbasQuestion() {
|
|
22
|
+
const colors = ['rouge', 'jaune', 'verte'];
|
|
23
|
+
const repartitions = [(0, randint_1.randint)(1, 4), (0, randint_1.randint)(1, 4), (0, randint_1.randint)(1, 4)];
|
|
24
|
+
const total = repartitions.reduce((acc, curr) => (acc += curr), 0);
|
|
25
|
+
const colorAskedIndex = (0, randint_1.randint)(0, 3);
|
|
26
|
+
const colorAsked = colors[colorAskedIndex];
|
|
27
|
+
const nbColorAsked = repartitions[colorAskedIndex];
|
|
28
|
+
const answer = new rational_1.Rational(nbColorAsked, total).simplify().tex;
|
|
29
|
+
const getPropositions = (n) => {
|
|
30
|
+
const res = [];
|
|
31
|
+
res.push({
|
|
32
|
+
id: (0, uuid_1.v4)(),
|
|
33
|
+
statement: answer,
|
|
34
|
+
isRightAnswer: true,
|
|
35
|
+
format: 'tex',
|
|
36
|
+
});
|
|
37
|
+
(0, exercise_1.tryToAddWrongProp)(res, nbColorAsked + '');
|
|
38
|
+
(0, exercise_1.tryToAddWrongProp)(res, `\\frac{1}{3}`);
|
|
39
|
+
if (total === 3) {
|
|
40
|
+
(0, exercise_1.tryToAddWrongProp)(res, `3`);
|
|
41
|
+
}
|
|
42
|
+
const missing = n - res.length;
|
|
43
|
+
for (let i = 0; i < missing; i++) {
|
|
44
|
+
let isDuplicate;
|
|
45
|
+
let proposition;
|
|
46
|
+
do {
|
|
47
|
+
const wrongAnswer = new rational_1.Rational((0, randint_1.randint)(1, total), total).simplify().tex;
|
|
48
|
+
proposition = {
|
|
49
|
+
id: (0, uuid_1.v4)() + ``,
|
|
50
|
+
statement: wrongAnswer,
|
|
51
|
+
isRightAnswer: false,
|
|
52
|
+
format: 'tex',
|
|
53
|
+
};
|
|
54
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
55
|
+
} while (isDuplicate);
|
|
56
|
+
res.push(proposition);
|
|
57
|
+
}
|
|
58
|
+
return (0, exercise_1.shuffleProps)(res, n);
|
|
59
|
+
};
|
|
60
|
+
const question = {
|
|
61
|
+
answer,
|
|
62
|
+
instruction: `Dans un sac, il y a ${repartitions[0]} boules ${colors[0]}${repartitions[0] > 1 ? 's' : ''},
|
|
63
|
+
${repartitions[1]} boules ${colors[1]}${repartitions[1] > 1 ? 's' : ''} et ${repartitions[2]} boules ${colors[2]}${repartitions[2] > 1 ? 's' : ''}. Quelle est la probabilité de tirer une boule ${colorAsked} ?`,
|
|
64
|
+
keys: [],
|
|
65
|
+
getPropositions,
|
|
66
|
+
answerFormat: 'tex',
|
|
67
|
+
};
|
|
68
|
+
return question;
|
|
69
|
+
}
|
|
70
|
+
exports.getBallsBasicProbasQuestion = getBallsBasicProbasQuestion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cardBasicProbas.d.ts","sourceRoot":"","sources":["../../../src/exercises/probaStat/cardBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAYhH,eAAO,MAAM,eAAe,EAAE,YAW7B,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CA0FrD"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCardBasicProbasQuestion = exports.cardBasicProbas = void 0;
|
|
4
|
+
const exercise_1 = require("../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const rational_1 = require("../../math/numbers/rationals/rational");
|
|
7
|
+
const randint_1 = require("../../math/utils/random/randint");
|
|
8
|
+
const probaLawFlip_1 = require("../../utils/probaLawFlip");
|
|
9
|
+
const uuid_1 = require("uuid");
|
|
10
|
+
const cardsData_1 = require("../utils/cardsData");
|
|
11
|
+
const randomEnumValue_1 = require("../../utils/randomEnumValue");
|
|
12
|
+
exports.cardBasicProbas = {
|
|
13
|
+
id: 'cardBasicProbas',
|
|
14
|
+
connector: '=',
|
|
15
|
+
instruction: '',
|
|
16
|
+
label: 'Calcul de probabilité simple avec un jeu de cartes',
|
|
17
|
+
levels: ['5ème', '4ème', '3ème', '2ndPro', '2nde', 'CAP'],
|
|
18
|
+
isSingleStep: true,
|
|
19
|
+
sections: ['Probabilités'],
|
|
20
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getCardBasicProbasQuestion, nb),
|
|
21
|
+
qcmTimer: 60,
|
|
22
|
+
freeTimer: 60,
|
|
23
|
+
};
|
|
24
|
+
function getCardBasicProbasQuestion() {
|
|
25
|
+
//carte précise (as de coeur)
|
|
26
|
+
//carte valeur (as)
|
|
27
|
+
//car couleur (pique)
|
|
28
|
+
//
|
|
29
|
+
const questionType = (0, probaLawFlip_1.probaLawFlip)([
|
|
30
|
+
['oneCard', 0.33],
|
|
31
|
+
['valueCard', 0.33],
|
|
32
|
+
['colorCard', 0.33],
|
|
33
|
+
]);
|
|
34
|
+
let answer = '';
|
|
35
|
+
let target = '';
|
|
36
|
+
let value;
|
|
37
|
+
let color;
|
|
38
|
+
switch (questionType) {
|
|
39
|
+
case 'oneCard':
|
|
40
|
+
value = (0, randomEnumValue_1.randomEnumValue)(cardsData_1.CardsValues);
|
|
41
|
+
color = (0, randomEnumValue_1.randomEnumValue)(cardsData_1.CardsColor);
|
|
42
|
+
target = `${value === cardsData_1.CardsValues.dame ? 'une' : 'un'} ${value} de ${color}`;
|
|
43
|
+
answer = `\\frac{1}{52}`;
|
|
44
|
+
break;
|
|
45
|
+
case 'valueCard':
|
|
46
|
+
value = (0, randomEnumValue_1.randomEnumValue)(cardsData_1.CardsValues);
|
|
47
|
+
target = `${value === cardsData_1.CardsValues.dame ? 'une' : 'un'} ${value}`;
|
|
48
|
+
answer = '\\frac{1}{13}';
|
|
49
|
+
break;
|
|
50
|
+
case 'colorCard':
|
|
51
|
+
color = (0, randomEnumValue_1.randomEnumValue)(cardsData_1.CardsColor);
|
|
52
|
+
target = `un ${color}`;
|
|
53
|
+
answer = `\\frac{1}{4}`;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
const getPropositions = (n) => {
|
|
57
|
+
const res = [];
|
|
58
|
+
res.push({
|
|
59
|
+
id: (0, uuid_1.v4)(),
|
|
60
|
+
statement: answer,
|
|
61
|
+
isRightAnswer: true,
|
|
62
|
+
format: 'tex',
|
|
63
|
+
});
|
|
64
|
+
switch (questionType) {
|
|
65
|
+
case 'colorCard':
|
|
66
|
+
(0, exercise_1.tryToAddWrongProp)(res, '13');
|
|
67
|
+
break;
|
|
68
|
+
case 'oneCard':
|
|
69
|
+
(0, exercise_1.tryToAddWrongProp)(res, '1');
|
|
70
|
+
break;
|
|
71
|
+
case 'valueCard':
|
|
72
|
+
(0, exercise_1.tryToAddWrongProp)(res, '4');
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
const missing = n - res.length;
|
|
76
|
+
for (let i = 0; i < missing; i++) {
|
|
77
|
+
let isDuplicate;
|
|
78
|
+
let proposition;
|
|
79
|
+
do {
|
|
80
|
+
const wrongAnswer = new rational_1.Rational((0, randint_1.randint)(1, 52), 52).simplify().tex;
|
|
81
|
+
proposition = {
|
|
82
|
+
id: (0, uuid_1.v4)() + ``,
|
|
83
|
+
statement: wrongAnswer,
|
|
84
|
+
isRightAnswer: false,
|
|
85
|
+
format: 'tex',
|
|
86
|
+
};
|
|
87
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
88
|
+
} while (isDuplicate);
|
|
89
|
+
res.push(proposition);
|
|
90
|
+
}
|
|
91
|
+
return (0, exercise_1.shuffleProps)(res, n);
|
|
92
|
+
};
|
|
93
|
+
const question = {
|
|
94
|
+
answer,
|
|
95
|
+
instruction: `On tire une carte dans un jeu de 52 cartes. Quelle est la probabilité d'obtenir ${target} ?`,
|
|
96
|
+
keys: [],
|
|
97
|
+
getPropositions,
|
|
98
|
+
answerFormat: 'tex',
|
|
99
|
+
};
|
|
100
|
+
return question;
|
|
101
|
+
}
|
|
102
|
+
exports.getCardBasicProbasQuestion = getCardBasicProbasQuestion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diceBasicProbas.d.ts","sourceRoot":"","sources":["../../../src/exercises/probaStat/diceBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAQhH,eAAO,MAAM,eAAe,EAAE,YAW7B,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CA6DrD"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDiceBasicProbasQuestion = exports.diceBasicProbas = void 0;
|
|
4
|
+
const exercise_1 = require("../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const rational_1 = require("../../math/numbers/rationals/rational");
|
|
7
|
+
const randint_1 = require("../../math/utils/random/randint");
|
|
8
|
+
const coinFlip_1 = require("../../utils/coinFlip");
|
|
9
|
+
const probaFlip_1 = require("../../utils/probaFlip");
|
|
10
|
+
const uuid_1 = require("uuid");
|
|
11
|
+
exports.diceBasicProbas = {
|
|
12
|
+
id: 'diceBasicProbas',
|
|
13
|
+
connector: '=',
|
|
14
|
+
instruction: '',
|
|
15
|
+
label: 'Calcul de probabilité simple avec un dé',
|
|
16
|
+
levels: ['5ème', '4ème', '3ème', '2ndPro', '2nde', 'CAP'],
|
|
17
|
+
isSingleStep: true,
|
|
18
|
+
sections: ['Probabilités'],
|
|
19
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getDiceBasicProbasQuestion, nb),
|
|
20
|
+
qcmTimer: 60,
|
|
21
|
+
freeTimer: 60,
|
|
22
|
+
};
|
|
23
|
+
function getDiceBasicProbasQuestion() {
|
|
24
|
+
const nbFaces = (0, randint_1.randint)(4, 10);
|
|
25
|
+
const isParityQuestion = (0, probaFlip_1.probaFlip)(0.3);
|
|
26
|
+
const isEvenQuestion = (0, coinFlip_1.coinFlip)();
|
|
27
|
+
const faceAsked = (0, randint_1.randint)(1, nbFaces + 1);
|
|
28
|
+
const target = isParityQuestion ? `un nombre ${isEvenQuestion ? 'pair' : 'impair'}` : `la face ${faceAsked}`;
|
|
29
|
+
const answer = isParityQuestion
|
|
30
|
+
? isEvenQuestion
|
|
31
|
+
? `\\frac{1}{2}`
|
|
32
|
+
: new rational_1.Rational((nbFaces + 1) / 2, nbFaces).simplify().tex
|
|
33
|
+
: `\\frac{1}{${nbFaces}}`;
|
|
34
|
+
const getPropositions = (n) => {
|
|
35
|
+
const res = [];
|
|
36
|
+
res.push({
|
|
37
|
+
id: (0, uuid_1.v4)(),
|
|
38
|
+
statement: answer,
|
|
39
|
+
isRightAnswer: true,
|
|
40
|
+
format: 'tex',
|
|
41
|
+
});
|
|
42
|
+
if (isParityQuestion) {
|
|
43
|
+
(0, exercise_1.tryToAddWrongProp)(res, '\\frac{1}{2}');
|
|
44
|
+
(0, exercise_1.tryToAddWrongProp)(res, Math.ceil(nbFaces / 2) + '');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
(0, exercise_1.tryToAddWrongProp)(res, '1');
|
|
48
|
+
(0, exercise_1.tryToAddWrongProp)(res, '\\frac{1}{6}');
|
|
49
|
+
}
|
|
50
|
+
const missing = n - res.length;
|
|
51
|
+
for (let i = 0; i < missing; i++) {
|
|
52
|
+
let isDuplicate;
|
|
53
|
+
let proposition;
|
|
54
|
+
do {
|
|
55
|
+
const wrongAnswer = new rational_1.Rational((0, randint_1.randint)(1, nbFaces + 1), nbFaces).simplify().tex;
|
|
56
|
+
proposition = {
|
|
57
|
+
id: (0, uuid_1.v4)() + ``,
|
|
58
|
+
statement: wrongAnswer,
|
|
59
|
+
isRightAnswer: false,
|
|
60
|
+
format: 'tex',
|
|
61
|
+
};
|
|
62
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
63
|
+
} while (isDuplicate);
|
|
64
|
+
res.push(proposition);
|
|
65
|
+
}
|
|
66
|
+
return (0, exercise_1.shuffleProps)(res, n);
|
|
67
|
+
};
|
|
68
|
+
const question = {
|
|
69
|
+
answer,
|
|
70
|
+
instruction: `On lance un dé à ${nbFaces} faces. Quelle est la probabilité d'obtenir ${target} ?`,
|
|
71
|
+
keys: [],
|
|
72
|
+
getPropositions,
|
|
73
|
+
answerFormat: 'tex',
|
|
74
|
+
};
|
|
75
|
+
return question;
|
|
76
|
+
}
|
|
77
|
+
exports.getDiceBasicProbasQuestion = getDiceBasicProbasQuestion;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum CardsColor {
|
|
2
|
+
'pique' = 0,
|
|
3
|
+
'trèfle' = 1,
|
|
4
|
+
'carreau' = 2,
|
|
5
|
+
'coeur' = 3
|
|
6
|
+
}
|
|
7
|
+
export declare enum CardsValues {
|
|
8
|
+
'as' = 0,
|
|
9
|
+
'deux' = 1,
|
|
10
|
+
'trois' = 2,
|
|
11
|
+
'quatre' = 3,
|
|
12
|
+
'cinq' = 4,
|
|
13
|
+
'six' = 5,
|
|
14
|
+
'sept' = 6,
|
|
15
|
+
'huit' = 7,
|
|
16
|
+
'neuf' = 8,
|
|
17
|
+
'dix' = 9,
|
|
18
|
+
'valet' = 10,
|
|
19
|
+
'dame' = 11,
|
|
20
|
+
'roi' = 12
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=cardsData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cardsData.d.ts","sourceRoot":"","sources":["../../../src/exercises/utils/cardsData.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,SAAS,IAAA;IACT,OAAO,IAAA;CACR;AACD,oBAAY,WAAW;IACrB,IAAI,IAAA;IACJ,MAAM,IAAA;IACN,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,MAAM,IAAA;IACN,KAAK,IAAA;IACL,MAAM,IAAA;IACN,MAAM,IAAA;IACN,MAAM,IAAA;IACN,KAAK,IAAA;IACL,OAAO,KAAA;IACP,MAAM,KAAA;IACN,KAAK,KAAA;CACN"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CardsValues = exports.CardsColor = void 0;
|
|
4
|
+
var CardsColor;
|
|
5
|
+
(function (CardsColor) {
|
|
6
|
+
CardsColor[CardsColor["pique"] = 0] = "pique";
|
|
7
|
+
CardsColor[CardsColor["tr\u00E8fle"] = 1] = "tr\u00E8fle";
|
|
8
|
+
CardsColor[CardsColor["carreau"] = 2] = "carreau";
|
|
9
|
+
CardsColor[CardsColor["coeur"] = 3] = "coeur";
|
|
10
|
+
})(CardsColor = exports.CardsColor || (exports.CardsColor = {}));
|
|
11
|
+
var CardsValues;
|
|
12
|
+
(function (CardsValues) {
|
|
13
|
+
CardsValues[CardsValues["as"] = 0] = "as";
|
|
14
|
+
CardsValues[CardsValues["deux"] = 1] = "deux";
|
|
15
|
+
CardsValues[CardsValues["trois"] = 2] = "trois";
|
|
16
|
+
CardsValues[CardsValues["quatre"] = 3] = "quatre";
|
|
17
|
+
CardsValues[CardsValues["cinq"] = 4] = "cinq";
|
|
18
|
+
CardsValues[CardsValues["six"] = 5] = "six";
|
|
19
|
+
CardsValues[CardsValues["sept"] = 6] = "sept";
|
|
20
|
+
CardsValues[CardsValues["huit"] = 7] = "huit";
|
|
21
|
+
CardsValues[CardsValues["neuf"] = 8] = "neuf";
|
|
22
|
+
CardsValues[CardsValues["dix"] = 9] = "dix";
|
|
23
|
+
CardsValues[CardsValues["valet"] = 10] = "valet";
|
|
24
|
+
CardsValues[CardsValues["dame"] = 11] = "dame";
|
|
25
|
+
CardsValues[CardsValues["roi"] = 12] = "roi";
|
|
26
|
+
})(CardsValues = exports.CardsValues || (exports.CardsValues = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumToArray.d.ts","sourceRoot":"","sources":["../../src/utils/enumToArray.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,WAAW,MAAO,GAAG,WAKjC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enumToArray = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param e
|
|
7
|
+
* @returns
|
|
8
|
+
* ! probably doesn't work if enum contains numbers
|
|
9
|
+
*/
|
|
10
|
+
const enumToArray = (e) => {
|
|
11
|
+
const colors = Object.keys(e).filter((item) => {
|
|
12
|
+
return isNaN(Number(item));
|
|
13
|
+
});
|
|
14
|
+
return colors.join('\n');
|
|
15
|
+
};
|
|
16
|
+
exports.enumToArray = enumToArray;
|
package/lib/utils/probaFlip.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaFlip.d.ts","sourceRoot":"","sources":["../../src/utils/probaFlip.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,MAAO,MAAM,YAElC,CAAC"}
|
|
1
|
+
{"version":3,"file":"probaFlip.d.ts","sourceRoot":"","sources":["../../src/utils/probaFlip.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,SAAS,MAAO,MAAM,YAElC,CAAC"}
|
package/lib/utils/probaFlip.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"probaLawFlip.d.ts","sourceRoot":"","sources":["../../src/utils/probaLawFlip.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,8BAYxB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.probaLawFlip = void 0;
|
|
4
|
+
const probaLawFlip = (arr) => {
|
|
5
|
+
if (Math.abs(arr.reduce((acc, curr) => (acc += curr[1]), 0) - 1) > 0.1)
|
|
6
|
+
throw Error('proba law does not add up t 1');
|
|
7
|
+
const rand = Math.random();
|
|
8
|
+
const sorted = [...arr].sort((a, b) => b[1] - a[1]);
|
|
9
|
+
let probaAcc = 0;
|
|
10
|
+
let i = 0;
|
|
11
|
+
while (i < arr.length - 1) {
|
|
12
|
+
probaAcc += sorted[i][1];
|
|
13
|
+
if (rand < arr[i][1])
|
|
14
|
+
return arr[i][0];
|
|
15
|
+
i++;
|
|
16
|
+
}
|
|
17
|
+
return arr[arr.length - 1][0];
|
|
18
|
+
};
|
|
19
|
+
exports.probaLawFlip = probaLawFlip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomEnumValue.d.ts","sourceRoot":"","sources":["../../src/utils/randomEnumValue.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,MAAO,GAAG,QAGrC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.randomEnumValue = void 0;
|
|
4
|
+
const randint_1 = require("../math/utils/random/randint");
|
|
5
|
+
const randomEnumValue = (e) => {
|
|
6
|
+
const randIndex = (0, randint_1.randint)(0, Object.keys(e).length / 2);
|
|
7
|
+
return e[randIndex];
|
|
8
|
+
};
|
|
9
|
+
exports.randomEnumValue = randomEnumValue;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evaluateExpression.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/evaluateExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ3E,eAAO,MAAM,kBAAkB,EAAE,QAUhC,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAiDhD"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getEvaluateExpression = exports.evaluateExpression = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
|
-
const polynomial_1 = require("../../../math/polynomials/polynomial");
|
|
6
|
-
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
|
-
const coinFlip_1 = require("../../../utils/coinFlip");
|
|
8
|
-
const shuffle_1 = require("../../../utils/shuffle");
|
|
9
|
-
const uuid_1 = require("uuid");
|
|
10
|
-
exports.evaluateExpression = {
|
|
11
|
-
id: 'evaluateExpression',
|
|
12
|
-
connector: '=',
|
|
13
|
-
instruction: '',
|
|
14
|
-
label: 'Evaluer une expression',
|
|
15
|
-
levels: ['4', '3', '2'],
|
|
16
|
-
section: 'Équations',
|
|
17
|
-
isSingleStep: true,
|
|
18
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getEvaluateExpression, nb),
|
|
19
|
-
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
20
|
-
};
|
|
21
|
-
function getEvaluateExpression() {
|
|
22
|
-
const rand = (0, coinFlip_1.coinFlip)();
|
|
23
|
-
const polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-5, 6, [0])]);
|
|
24
|
-
const polynome2 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-4, 5, [0])]);
|
|
25
|
-
const xValue = (0, randint_1.randint)(-9, 10);
|
|
26
|
-
const statement = rand
|
|
27
|
-
? `Calculer $${polynome1.toTree().toTex()}$ pour x = $${xValue}$`
|
|
28
|
-
: `Calculer $${polynome2.toTree().toTex()}$ pour x = $${xValue}$`;
|
|
29
|
-
const answer = rand ? polynome1.calculate(xValue) : polynome2.calculate(xValue);
|
|
30
|
-
const getPropositions = (n) => {
|
|
31
|
-
const res = [];
|
|
32
|
-
res.push({
|
|
33
|
-
id: (0, uuid_1.v4)() + '',
|
|
34
|
-
statement: answer + '',
|
|
35
|
-
isRightAnswer: true,
|
|
36
|
-
});
|
|
37
|
-
for (let i = 0; i < n - 1; i++) {
|
|
38
|
-
let isDuplicate;
|
|
39
|
-
let proposition;
|
|
40
|
-
do {
|
|
41
|
-
const wrongAnswer = answer + (0, randint_1.randint)(-10, 11, [0]);
|
|
42
|
-
proposition = {
|
|
43
|
-
id: (0, uuid_1.v4)() + '',
|
|
44
|
-
statement: wrongAnswer + '',
|
|
45
|
-
isRightAnswer: false,
|
|
46
|
-
};
|
|
47
|
-
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
48
|
-
} while (isDuplicate);
|
|
49
|
-
res.push(proposition);
|
|
50
|
-
}
|
|
51
|
-
return (0, shuffle_1.shuffle)(res);
|
|
52
|
-
};
|
|
53
|
-
const question = {
|
|
54
|
-
instruction: statement,
|
|
55
|
-
answer: answer + '',
|
|
56
|
-
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
57
|
-
getPropositions,
|
|
58
|
-
};
|
|
59
|
-
return question;
|
|
60
|
-
}
|
|
61
|
-
exports.getEvaluateExpression = getEvaluateExpression;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"firstDegreeGeneralEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/firstDegreeGeneralEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,eAAO,MAAM,0BAA0B,EAAE,QAUxC,CAAC;AAEF,wBAAgB,6BAA6B,IAAI,QAAQ,CAaxD"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFirstDegreeGeneralEquation = exports.firstDegreeGeneralEquation = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
|
-
const polynomial_1 = require("../../../math/polynomials/polynomial");
|
|
6
|
-
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
|
-
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
8
|
-
const simplify_1 = require("../../../tree/parsers/simplify");
|
|
9
|
-
exports.firstDegreeGeneralEquation = {
|
|
10
|
-
id: 'firstDegreeGeneralEquation',
|
|
11
|
-
connector: '=',
|
|
12
|
-
instruction: '',
|
|
13
|
-
label: 'Résoudre une équation du premier degré du type ax + b = cx',
|
|
14
|
-
levels: ['4ème', '3ème', '2nde'],
|
|
15
|
-
sections: ['Équations'],
|
|
16
|
-
isSingleStep: false,
|
|
17
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFirstDegreeGeneralEquation, nb),
|
|
18
|
-
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
19
|
-
};
|
|
20
|
-
function getFirstDegreeGeneralEquation() {
|
|
21
|
-
let a = (0, randint_1.randint)(-9, 10, [0]);
|
|
22
|
-
const b = (0, randint_1.randint)(-9, 10);
|
|
23
|
-
const c = (0, randint_1.randint)(-9, 10, [a, 0]);
|
|
24
|
-
const question = {
|
|
25
|
-
instruction: `Résoudre l'équation suivante $${new polynomial_1.Polynomial([b, a])} = ${new polynomial_1.Polynomial([0, c])}$`,
|
|
26
|
-
startStatement: `x`,
|
|
27
|
-
answer: (0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / (a - c))).toTex(),
|
|
28
|
-
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
29
|
-
};
|
|
30
|
-
return question;
|
|
31
|
-
}
|
|
32
|
-
exports.getFirstDegreeGeneralEquation = getFirstDegreeGeneralEquation;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/affines/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK3E,eAAO,MAAM,GAAG,EAAE,QASjB,CAAC;AAEF,wBAAgB,cAAc,IAAI,QAAQ,CAyCzC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExoQuestion = exports.exo = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
|
-
const shuffle_1 = require("../../../utils/shuffle");
|
|
6
|
-
const uuid_1 = require("uuid");
|
|
7
|
-
exports.exo = {
|
|
8
|
-
id: 'name',
|
|
9
|
-
connector: '',
|
|
10
|
-
instruction: '',
|
|
11
|
-
label: '',
|
|
12
|
-
levels: [],
|
|
13
|
-
isSingleStep: true,
|
|
14
|
-
sections: [],
|
|
15
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getExoQuestion, nb),
|
|
16
|
-
};
|
|
17
|
-
function getExoQuestion() {
|
|
18
|
-
const getPropositions = (n) => {
|
|
19
|
-
const res = [];
|
|
20
|
-
res.push({
|
|
21
|
-
id: (0, uuid_1.v4)() + '',
|
|
22
|
-
statement: '',
|
|
23
|
-
isRightAnswer: true,
|
|
24
|
-
format: 'tex',
|
|
25
|
-
});
|
|
26
|
-
for (let i = 0; i < n - 1; i++) {
|
|
27
|
-
let isDuplicate;
|
|
28
|
-
let proposition;
|
|
29
|
-
do {
|
|
30
|
-
const wrongAnswer = '';
|
|
31
|
-
proposition = {
|
|
32
|
-
id: (0, uuid_1.v4)() + '',
|
|
33
|
-
statement: wrongAnswer,
|
|
34
|
-
isRightAnswer: false,
|
|
35
|
-
format: 'tex',
|
|
36
|
-
};
|
|
37
|
-
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
38
|
-
} while (isDuplicate);
|
|
39
|
-
res.push(proposition);
|
|
40
|
-
}
|
|
41
|
-
return (0, shuffle_1.shuffle)(res);
|
|
42
|
-
};
|
|
43
|
-
const question = {
|
|
44
|
-
answer: '',
|
|
45
|
-
keys: [],
|
|
46
|
-
getPropositions,
|
|
47
|
-
answerFormat: 'tex',
|
|
48
|
-
};
|
|
49
|
-
return question;
|
|
50
|
-
}
|
|
51
|
-
exports.getExoQuestion = getExoQuestion;
|