math-exercises 3.0.132 → 3.0.133
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/mentalCaluls/mentalProgramSolve.d.ts +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +5 -5
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.js +12 -7
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +8 -6
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +8 -9
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +4 -4
- package/lib/exercises/math/conversion/prefixToNumber.d.ts +0 -2
- package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -1
- package/lib/exercises/math/conversion/prefixToNumber.js +27 -22
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +1 -2
- package/lib/exercises/math/geometry/cartesian/index.d.ts +1 -0
- package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/index.js +1 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +6 -9
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +60 -137
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts +16 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +213 -0
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +2 -2
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +6 -6
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +0 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +52 -59
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +70 -23
- package/lib/exercises/pc/index.d.ts +0 -1
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +0 -1
- package/lib/exercises/pc/motion/averageSpeed.d.ts +0 -2
- package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
- package/lib/exercises/pc/motion/averageSpeed.js +28 -36
- package/lib/exercises/pc/weight/calculateWeight.d.ts +0 -1
- package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
- package/lib/exercises/pc/weight/calculateWeight.js +26 -19
- package/lib/index.d.ts +9 -38
- package/lib/index.d.ts.map +1 -1
- package/lib/playgroundUtils.d.ts +3 -0
- package/lib/playgroundUtils.d.ts.map +1 -0
- package/lib/playgroundUtils.js +13 -0
- package/lib/server.js +121 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -159,7 +159,7 @@ declare const mathExercises: (Exercise<{
|
|
|
159
159
|
nodeIdsStartingNumber: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
160
160
|
progCalcIds: import("./math/progCalc/progCalc.js").ProgCalcIdentifiers;
|
|
161
161
|
}, {
|
|
162
|
-
numberType: "
|
|
162
|
+
numberType: "Entier" | "D\u00E9cimal";
|
|
163
163
|
nbSteps: string;
|
|
164
164
|
nbDigits: string;
|
|
165
165
|
}> | Exercise<{
|
|
@@ -740,8 +740,6 @@ declare const mathExercises: (Exercise<{
|
|
|
740
740
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
741
741
|
prefixIndexesPool: number[];
|
|
742
742
|
prefixIndex: number;
|
|
743
|
-
isToPow10: boolean;
|
|
744
|
-
isFromSymbol: boolean;
|
|
745
743
|
}, {
|
|
746
744
|
prefixPool: string[];
|
|
747
745
|
isToPow10: boolean;
|
|
@@ -1554,6 +1552,13 @@ declare const mathExercises: (Exercise<{
|
|
|
1554
1552
|
absciss: number;
|
|
1555
1553
|
abscissTex: string;
|
|
1556
1554
|
coeff: number;
|
|
1555
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1556
|
+
abscissType: import("./math/numbers/nombre.js").NumberType;
|
|
1557
|
+
axisUnit: number;
|
|
1558
|
+
oneUnitTex: string;
|
|
1559
|
+
absciss: number;
|
|
1560
|
+
abscissTex: string;
|
|
1561
|
+
coeff: number;
|
|
1557
1562
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1558
1563
|
abscissType: import("./math/numbers/nombre.js").NumberType;
|
|
1559
1564
|
axisUnit: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
@@ -2476,7 +2481,6 @@ declare const mathExercises: (Exercise<{
|
|
|
2476
2481
|
}, {
|
|
2477
2482
|
nbElem: string[];
|
|
2478
2483
|
unionLength: string[];
|
|
2479
|
-
isProbasAreNumbers: boolean;
|
|
2480
2484
|
}> | Exercise<{
|
|
2481
2485
|
situationIndex: number;
|
|
2482
2486
|
dictShuffle: Record<string, string>;
|
|
@@ -3248,12 +3252,7 @@ declare const mathExercises: (Exercise<{
|
|
|
3248
3252
|
value: number;
|
|
3249
3253
|
unitIndex: number;
|
|
3250
3254
|
};
|
|
3251
|
-
opts: {
|
|
3252
|
-
acceptedInputType: string;
|
|
3253
|
-
unitTex: string;
|
|
3254
|
-
};
|
|
3255
3255
|
}, {
|
|
3256
|
-
acceptedInputType: string;
|
|
3257
3256
|
unitTex: string;
|
|
3258
3257
|
}> | Exercise<{
|
|
3259
3258
|
speed: number;
|
|
@@ -3309,10 +3308,6 @@ declare const mathExercises: (Exercise<{
|
|
|
3309
3308
|
T: number;
|
|
3310
3309
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3311
3310
|
mass: number;
|
|
3312
|
-
optsIdent: {
|
|
3313
|
-
inputType: "decimal" | "sci";
|
|
3314
|
-
nbDigits: string;
|
|
3315
|
-
};
|
|
3316
3311
|
}, {
|
|
3317
3312
|
inputType: "decimal" | "sci";
|
|
3318
3313
|
nbDigits: string;
|
|
@@ -3722,12 +3717,7 @@ declare const pcExercises: (Exercise<{
|
|
|
3722
3717
|
value: number;
|
|
3723
3718
|
unitIndex: number;
|
|
3724
3719
|
};
|
|
3725
|
-
opts: {
|
|
3726
|
-
acceptedInputType: string;
|
|
3727
|
-
unitTex: string;
|
|
3728
|
-
};
|
|
3729
3720
|
}, {
|
|
3730
|
-
acceptedInputType: string;
|
|
3731
3721
|
unitTex: string;
|
|
3732
3722
|
}> | Exercise<{
|
|
3733
3723
|
speed: number;
|
|
@@ -3783,10 +3773,6 @@ declare const pcExercises: (Exercise<{
|
|
|
3783
3773
|
T: number;
|
|
3784
3774
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3785
3775
|
mass: number;
|
|
3786
|
-
optsIdent: {
|
|
3787
|
-
inputType: "decimal" | "sci";
|
|
3788
|
-
nbDigits: string;
|
|
3789
|
-
};
|
|
3790
3776
|
}, {
|
|
3791
3777
|
inputType: "decimal" | "sci";
|
|
3792
3778
|
nbDigits: string;
|
|
@@ -3803,21 +3789,6 @@ declare const pcExercises: (Exercise<{
|
|
|
3803
3789
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3804
3790
|
E: number[];
|
|
3805
3791
|
S: number[];
|
|
3806
|
-
}, Record<string, string | boolean | string[]>>
|
|
3807
|
-
OFPrime: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3808
|
-
OA: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3809
|
-
OAPrime: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3810
|
-
opts: {
|
|
3811
|
-
typeDistance: "distance focale" | "distance image" | "distance objet";
|
|
3812
|
-
typeImage: "réelle finie" | "réelle infinie" | "imaginaire finie" | "imaginaire infinie";
|
|
3813
|
-
unit: "cm" | "m";
|
|
3814
|
-
roundTo: string;
|
|
3815
|
-
};
|
|
3816
|
-
}, {
|
|
3817
|
-
typeDistance: "distance focale" | "distance image" | "distance objet";
|
|
3818
|
-
typeImage: "réelle finie" | "réelle infinie" | "imaginaire finie" | "imaginaire infinie";
|
|
3819
|
-
unit: "cm" | "m";
|
|
3820
|
-
roundTo: string;
|
|
3821
|
-
}>)[];
|
|
3792
|
+
}, Record<string, string | boolean | string[]>>)[];
|
|
3822
3793
|
export { mathExercises, pcExercises, Exercise, Question, parseAlgebraic };
|
|
3823
3794
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAA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OAAO,MAAM,EACb,aAAa,MAAM,EACnB,UAAU,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,WAKtD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const viewerUrlExample = () => {
|
|
2
|
+
const exoId = "primeNumbers";
|
|
3
|
+
const identifiers = {
|
|
4
|
+
nb: 20,
|
|
5
|
+
};
|
|
6
|
+
const options = {};
|
|
7
|
+
return getViewerURLForGetQuestionFromIdentifiers(exoId, identifiers, options);
|
|
8
|
+
};
|
|
9
|
+
export const getViewerURLForGetQuestionFromIdentifiers = (exoId, identifiers, options) => {
|
|
10
|
+
const exoIdentifiers = JSON.stringify(identifiers);
|
|
11
|
+
const exoOptions = JSON.stringify(options);
|
|
12
|
+
return `http://localhost:5173/exo?exoId=${exoId}&identifiers=${exoIdentifiers}&options=${exoOptions}`;
|
|
13
|
+
};
|
package/lib/server.js
CHANGED
|
@@ -41,6 +41,127 @@ const runServer = () => {
|
|
|
41
41
|
app.get("/xplive", (_req, res) => {
|
|
42
42
|
res.json(pcExercises);
|
|
43
43
|
});
|
|
44
|
+
app.get("/generator", (req, res) => {
|
|
45
|
+
const n = Number(req.query.n);
|
|
46
|
+
const exoId = req.query.exoId;
|
|
47
|
+
const options = req.query.options
|
|
48
|
+
? JSON.parse(req.query.options)
|
|
49
|
+
: undefined;
|
|
50
|
+
const exo = allExercises.find((exo) => exo.id == exoId);
|
|
51
|
+
if (!exo) {
|
|
52
|
+
res.send("Exo not found");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const questions = exo?.generator(n, options);
|
|
56
|
+
res.json(questions);
|
|
57
|
+
});
|
|
58
|
+
app.get("/getQuestionFromIdentifiers", (req, res) => {
|
|
59
|
+
const exoId = req.query.exoId;
|
|
60
|
+
const exo = allExercises.find((exo) => exo.id == exoId);
|
|
61
|
+
if (!exo) {
|
|
62
|
+
res.send("Exo not found");
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const identifiers = req.query.identifiers
|
|
66
|
+
? JSON.parse(req.query.identifiers)
|
|
67
|
+
: undefined;
|
|
68
|
+
const options = req.query.options
|
|
69
|
+
? JSON.parse(req.query.options)
|
|
70
|
+
: undefined;
|
|
71
|
+
const question = exo?.getQuestionFromIdentifiers(identifiers, options);
|
|
72
|
+
res.json({
|
|
73
|
+
exercise: exo,
|
|
74
|
+
question,
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
app.get("/getPropositions", (req, res) => {
|
|
78
|
+
const n = Number(req.query.n) || 4;
|
|
79
|
+
const exoId = req.query.exoId;
|
|
80
|
+
const options = req.query.options
|
|
81
|
+
? JSON.parse(req.query.options)
|
|
82
|
+
: undefined;
|
|
83
|
+
const identifiers = req.query.identifiers
|
|
84
|
+
? JSON.parse(req.query.identifiers)
|
|
85
|
+
: undefined;
|
|
86
|
+
const answer = req.query.answer;
|
|
87
|
+
const exo = allExercises.find((exo) => exo.id == exoId);
|
|
88
|
+
if (!exo) {
|
|
89
|
+
res.send("Exo not found");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (!exo?.getPropositions) {
|
|
93
|
+
res.send("no getPropositions");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const props = exo.getPropositions(n, { answer, ...identifiers }, options);
|
|
97
|
+
res.json(props);
|
|
98
|
+
});
|
|
99
|
+
app.get("/isAnswerTableValid", (req, res) => {
|
|
100
|
+
const exoId = req.query.exoId;
|
|
101
|
+
const options = req.query.options
|
|
102
|
+
? JSON.parse(req.query.options)
|
|
103
|
+
: undefined;
|
|
104
|
+
const identifiers = req.query.identifiers
|
|
105
|
+
? JSON.parse(req.query.identifiers)
|
|
106
|
+
: undefined;
|
|
107
|
+
const studentAnswer = JSON.parse(req.query.studentAnswer);
|
|
108
|
+
const answerTable = JSON.parse(req.query.answerTable);
|
|
109
|
+
const exo = allExercises.find((exo) => exo.id == exoId);
|
|
110
|
+
if (!exo) {
|
|
111
|
+
res.send("Exo not found");
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (!exo?.isAnswerTableValid) {
|
|
115
|
+
res.send("no isAnswerTableValid");
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const valid = exo.isAnswerTableValid(studentAnswer, { answerTable, ...identifiers }, options);
|
|
119
|
+
res.json(valid);
|
|
120
|
+
});
|
|
121
|
+
app.get("/isAnswerValid", (req, res) => {
|
|
122
|
+
const exoId = req.query.exoId;
|
|
123
|
+
const options = req.query.options
|
|
124
|
+
? JSON.parse(req.query.options)
|
|
125
|
+
: undefined;
|
|
126
|
+
const identifiers = req.query.identifiers
|
|
127
|
+
? JSON.parse(req.query.identifiers)
|
|
128
|
+
: undefined;
|
|
129
|
+
const studentAnswer = JSON.parse(req.query.studentAnswer);
|
|
130
|
+
const answer = JSON.parse(req.query.answer);
|
|
131
|
+
const exo = allExercises.find((exo) => exo.id == exoId);
|
|
132
|
+
if (!exo) {
|
|
133
|
+
res.send("Exo not found");
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (!exo?.isAnswerValid) {
|
|
137
|
+
res.send("no isAnswerValid");
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const valid = exo.isAnswerValid(studentAnswer, { answer, ...identifiers }, options);
|
|
141
|
+
res.json(valid);
|
|
142
|
+
});
|
|
143
|
+
app.get("/isGGBAnswerValid", (req, res) => {
|
|
144
|
+
const exoId = req.query.exoId;
|
|
145
|
+
const options = req.query.options
|
|
146
|
+
? JSON.parse(req.query.options)
|
|
147
|
+
: undefined;
|
|
148
|
+
const identifiers = req.query.identifiers
|
|
149
|
+
? JSON.parse(req.query.identifiers)
|
|
150
|
+
: undefined;
|
|
151
|
+
const studentAnswer = JSON.parse(req.query.studentAnswer);
|
|
152
|
+
const ggbAnswer = JSON.parse(req.query.ggbAnswer);
|
|
153
|
+
const exo = allExercises.find((exo) => exo.id == exoId);
|
|
154
|
+
if (!exo) {
|
|
155
|
+
res.send("Exo not found");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (!exo?.isGGBAnswerValid) {
|
|
159
|
+
res.send("no isGGBAnswerValid");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const valid = exo.isGGBAnswerValid(studentAnswer, { ggbAnswer, ...identifiers }, options);
|
|
163
|
+
res.json(valid);
|
|
164
|
+
});
|
|
44
165
|
app.get("/question", (req, res) => {
|
|
45
166
|
const exoId = req.query.exoId;
|
|
46
167
|
const options = req.query.options
|