math-exercises 3.0.185 → 3.0.187

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.
Files changed (73) hide show
  1. package/lib/exercises/exercise.d.ts +1 -0
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/derivation/derivative/exp/index.d.ts +2 -0
  4. package/lib/exercises/math/derivation/derivative/exp/index.d.ts.map +1 -1
  5. package/lib/exercises/math/derivation/derivative/exp/index.js +2 -0
  6. package/lib/exercises/math/derivation/derivative/index.d.ts +3 -0
  7. package/lib/exercises/math/derivation/derivative/index.d.ts.map +1 -1
  8. package/lib/exercises/math/derivation/derivative/index.js +3 -0
  9. package/lib/exercises/math/derivation/derivativeNumber/index.d.ts +2 -0
  10. package/lib/exercises/math/derivation/derivativeNumber/index.d.ts.map +1 -1
  11. package/lib/exercises/math/derivation/derivativeNumber/index.js +2 -0
  12. package/lib/exercises/math/derivation/index.d.ts +1 -0
  13. package/lib/exercises/math/derivation/index.d.ts.map +1 -1
  14. package/lib/exercises/math/derivation/index.js +1 -0
  15. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.d.ts.map +1 -1
  16. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.js +0 -4
  17. package/lib/exercises/math/derivation/tangent/index.d.ts +9 -0
  18. package/lib/exercises/math/derivation/tangent/index.d.ts.map +1 -1
  19. package/lib/exercises/math/derivation/tangent/index.js +9 -0
  20. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
  21. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +3 -22
  22. package/lib/exercises/math/derivation/variations/index.d.ts +8 -0
  23. package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -1
  24. package/lib/exercises/math/derivation/variations/index.js +8 -0
  25. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.d.ts +10 -0
  26. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.d.ts.map +1 -1
  27. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.js +235 -231
  28. package/lib/exercises/math/functions/basics/inverseImageFunction.js +1 -1
  29. package/lib/exercises/math/functions/sign/affineSignTable.d.ts.map +1 -1
  30. package/lib/exercises/math/functions/sign/affineSignTable.js +1 -1
  31. package/lib/exercises/math/python/index.d.ts +1 -0
  32. package/lib/exercises/math/python/index.d.ts.map +1 -1
  33. package/lib/exercises/math/python/index.js +1 -0
  34. package/lib/exercises/math/python/list/index.d.ts +11 -0
  35. package/lib/exercises/math/python/list/index.d.ts.map +1 -0
  36. package/lib/exercises/math/python/list/index.js +10 -0
  37. package/lib/exercises/math/python/list/pyListAppend.d.ts +29 -0
  38. package/lib/exercises/math/python/list/pyListAppend.d.ts.map +1 -0
  39. package/lib/exercises/math/python/list/pyListAppend.js +280 -0
  40. package/lib/exercises/math/python/list/pyListCreateListByComprehension.d.ts +11 -0
  41. package/lib/exercises/math/python/list/pyListCreateListByComprehension.d.ts.map +1 -0
  42. package/lib/exercises/math/python/list/pyListCreateListByComprehension.js +231 -0
  43. package/lib/exercises/math/python/list/pyListCreateListInstructionCompletion.d.ts +9 -0
  44. package/lib/exercises/math/python/list/pyListCreateListInstructionCompletion.d.ts.map +1 -0
  45. package/lib/exercises/math/python/list/pyListCreateListInstructionCompletion.js +232 -0
  46. package/lib/exercises/math/python/list/pyListElemAtIndex.d.ts +9 -0
  47. package/lib/exercises/math/python/list/pyListElemAtIndex.d.ts.map +1 -0
  48. package/lib/exercises/math/python/list/pyListElemAtIndex.js +292 -0
  49. package/lib/exercises/math/python/list/pyListMutationMix.d.ts +29 -0
  50. package/lib/exercises/math/python/list/pyListMutationMix.d.ts.map +1 -0
  51. package/lib/exercises/math/python/list/pyListMutationMix.js +455 -0
  52. package/lib/exercises/math/python/list/pyListRemove.d.ts +29 -0
  53. package/lib/exercises/math/python/list/pyListRemove.d.ts.map +1 -0
  54. package/lib/exercises/math/python/list/pyListRemove.js +375 -0
  55. package/lib/exercises/math/python/list/pyListSetElemAtIndex.d.ts +29 -0
  56. package/lib/exercises/math/python/list/pyListSetElemAtIndex.d.ts.map +1 -0
  57. package/lib/exercises/math/python/list/pyListSetElemAtIndex.js +331 -0
  58. package/lib/exercises/math/python/list/pyListSetElemAtIndexInstructionCompletion.d.ts +9 -0
  59. package/lib/exercises/math/python/list/pyListSetElemAtIndexInstructionCompletion.d.ts.map +1 -0
  60. package/lib/exercises/math/python/list/pyListSetElemAtIndexInstructionCompletion.js +346 -0
  61. package/lib/exercises/math/python/list/pyListSetElemAtIndexWaterfall.d.ts +29 -0
  62. package/lib/exercises/math/python/list/pyListSetElemAtIndexWaterfall.d.ts.map +1 -0
  63. package/lib/exercises/math/python/list/pyListSetElemAtIndexWaterfall.js +394 -0
  64. package/lib/geogebra/geogebraConstructor.d.ts +1 -0
  65. package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
  66. package/lib/geogebra/geogebraConstructor.js +3 -0
  67. package/lib/index.d.ts +280 -0
  68. package/lib/index.d.ts.map +1 -1
  69. package/lib/math/geometry/line.js +1 -1
  70. package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -1
  71. package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
  72. package/lib/tree/nodes/functions/sqrtNode.js +5 -3
  73. package/package.json +1 -1
@@ -0,0 +1,29 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Append<T> = {
3
+ nameList: string;
4
+ value: T;
5
+ };
6
+ type Remove<T> = {
7
+ nameList: string;
8
+ value: T;
9
+ };
10
+ type Inject<T> = {
11
+ nameList: string;
12
+ index: number;
13
+ value: T;
14
+ };
15
+ type Instruction<T> = ({
16
+ type: "append";
17
+ } & Append<T>) | ({
18
+ type: "remove";
19
+ } & Remove<T>) | ({
20
+ type: "inject";
21
+ } & Inject<T>);
22
+ type Identifiers = {
23
+ nameList: string;
24
+ listInitial: unknown[];
25
+ arrInstruction: Instruction<unknown>[];
26
+ };
27
+ export declare const pyListSetElemAtIndexWaterfall: Exercise<Identifiers>;
28
+ export {};
29
+ //# sourceMappingURL=pyListSetElemAtIndexWaterfall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pyListSetElemAtIndexWaterfall.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/python/list/pyListSetElemAtIndexWaterfall.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAyIrC,KAAK,MAAM,CAAC,CAAC,IAAI;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,KAAK,MAAM,CAAC,CAAC,IAAI;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,KAAK,MAAM,CAAC,CAAC,IAAI;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,KAAK,WAAW,CAAC,CAAC,IACd,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAChC,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAChC,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAErC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,EAAE,CAAC;IACvB,cAAc,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;CACxC,CAAC;AA+WF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAiB/D,CAAC"}
@@ -0,0 +1,394 @@
1
+ import { addValidProp, propWhile, 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 { probaLawFlip } from "../../../../utils/alea/probaLawFlip.js";
5
+ import { random, randomMany } from "../../../../utils/alea/random.js";
6
+ import { zip } from "../../../../utils/arrays/arrayZip.js";
7
+ import { mdTable } from "../../../../utils/markdown/mdTable.js";
8
+ const getStrPythonInstruction = (instruction) => {
9
+ const { nameList, value } = instruction;
10
+ switch (instruction.type) {
11
+ case "append":
12
+ return `${nameList}.append(${strPythonForListElem(value)})`;
13
+ case "remove":
14
+ return `${nameList}.remove(${strPythonForListElem(value)})`;
15
+ case "inject": {
16
+ const { index } = instruction;
17
+ return `${nameList}[${index}] = ${strPythonForListElem(value)}`;
18
+ }
19
+ }
20
+ };
21
+ const codify = (strPython) => {
22
+ return `\`\`\`python
23
+ ${strPython}
24
+ \`\`\``;
25
+ };
26
+ const codifyChunk = (strPython) => {
27
+ return `\`${strPython}\``;
28
+ };
29
+ const strPythonForList = (list) => {
30
+ return `[${list.map((elem) => strPythonForListElem(elem)).join(", ")}]`;
31
+ };
32
+ const strPythonForListElem = (elem) => {
33
+ if (typeof elem === "string") {
34
+ if (elem === "None") {
35
+ return `${elem}`;
36
+ }
37
+ else {
38
+ return `'${elem}'`;
39
+ }
40
+ }
41
+ else {
42
+ return `${elem}`;
43
+ }
44
+ };
45
+ const getStrPythonProgram = (identifiers) => {
46
+ const { nameList, listInitial, arrInstruction } = identifiers;
47
+ return `${nameList} = ${strPythonForList(listInitial)}
48
+ ${arrInstruction.map(getStrPythonInstruction).join(`
49
+ `)}
50
+ print(${nameList})
51
+ `;
52
+ };
53
+ const getFunctionPythonInstruction = (instruction) => {
54
+ return (l) => {
55
+ const { nameList, value } = instruction;
56
+ switch (instruction.type) {
57
+ case "append":
58
+ {
59
+ const lWork = [...l];
60
+ lWork.push(value);
61
+ return lWork;
62
+ }
63
+ break;
64
+ case "remove":
65
+ {
66
+ const lWork = [...l];
67
+ const indexFound = lWork.findIndex((v) => v === value);
68
+ if (indexFound === -1) {
69
+ throw new Error(`ValueError: ${nameList}.remove(x): x not in list`);
70
+ }
71
+ lWork.splice(indexFound, 1);
72
+ return lWork;
73
+ }
74
+ break;
75
+ case "inject":
76
+ {
77
+ const { index } = instruction;
78
+ if (index < -l.length || l.length <= index) {
79
+ throw new Error(`IndexError: list assignment index out of range`);
80
+ }
81
+ else {
82
+ const lWork = [...l];
83
+ const indexPositive = index >= 0 ? index : l.length + index;
84
+ lWork[indexPositive] = value;
85
+ return lWork;
86
+ }
87
+ }
88
+ break;
89
+ }
90
+ };
91
+ };
92
+ const getFunctionForPythonProgram = (identifiers) => {
93
+ const { nameList, listInitial, arrInstruction } = identifiers;
94
+ return (..._otherArgs) => {
95
+ const outDict = {};
96
+ //init
97
+ let list = listInitial;
98
+ outDict[0] = {
99
+ [nameList]: list,
100
+ };
101
+ //main
102
+ {
103
+ arrInstruction.forEach((instruction, i) => {
104
+ let err;
105
+ try {
106
+ list = getFunctionPythonInstruction(instruction)(list);
107
+ }
108
+ catch (e) {
109
+ err = e;
110
+ }
111
+ outDict[i + 1] = {
112
+ [nameList]: list,
113
+ err,
114
+ };
115
+ });
116
+ }
117
+ //convenience: store last step in -1
118
+ outDict[-1] = outDict[Math.max(...Object.keys(outDict).map((k) => +k))];
119
+ return outDict;
120
+ };
121
+ };
122
+ const getInstruction = (identifiers) => {
123
+ return `Qu'affichera le script en Python suivant ?
124
+
125
+ ${codify(getStrPythonProgram(identifiers))}
126
+
127
+ `;
128
+ };
129
+ const getAnswer = (identifiers) => {
130
+ const { nameList } = identifiers;
131
+ const stepDictEnd = getFunctionForPythonProgram(identifiers)()[-1];
132
+ if (stepDictEnd.err) {
133
+ return `${stepDictEnd.err.message}`;
134
+ }
135
+ else {
136
+ return strPythonForList(stepDictEnd[nameList]);
137
+ }
138
+ };
139
+ const getHint = () => {
140
+ return `Pour affecter la valeur $\\text{'toto'}$ à la variable $nom$, on écrit ${codifyChunk("nom = 'toto'")}.
141
+
142
+ Pour affecter la valeur $\\text{'toto'}$ à la variable $maListe[6]$, c'est le même principe.
143
+
144
+ Attention ! Il faut tout de même s'assurer que cet emplacement mémoire existe.`;
145
+ };
146
+ const getCorrection = (identifiers) => {
147
+ const { nameList, arrInstruction } = identifiers;
148
+ const dictSteps = getFunctionForPythonProgram(identifiers)();
149
+ const maxLength = Math.max(...Object.entries(dictSteps).map(([_, { [nameList]: l }]) => l.length));
150
+ const err = dictSteps[-1].err;
151
+ let indexStepWithErr;
152
+ if (err) {
153
+ indexStepWithErr = Number(Object.entries(dictSteps).find(([_, stepDict]) => stepDict.err)[0]);
154
+ }
155
+ return `Voici l'évolution de la liste $${nameList}$ au fil des instructions.
156
+
157
+ ${mdTable([
158
+ (() => {
159
+ const l = dictSteps[0][nameList];
160
+ return [
161
+ "\\text{Initialement}",
162
+ ...[...Array(maxLength).keys()].map((i) => l.length > i ? `\\text{${l[i]}}` : "\\text{}"),
163
+ ];
164
+ })(),
165
+ ...arrInstruction.map((instruction, i) => {
166
+ const l = dictSteps[i + 1][nameList];
167
+ if (indexStepWithErr) {
168
+ const indexInstructionWithErr = indexStepWithErr - 1;
169
+ if (i < indexInstructionWithErr) {
170
+ return [
171
+ `\\text{Après ${getStrPythonInstruction(instruction)}}`,
172
+ ...[...Array(maxLength).keys()].map((i) => {
173
+ return l.length > i ? `\\text{${l[i]}}` : "\\text{}";
174
+ }),
175
+ ];
176
+ }
177
+ else if (i === indexInstructionWithErr) {
178
+ return [
179
+ `\\text{Après ${getStrPythonInstruction(instruction)}}`,
180
+ ...[...Array(maxLength).keys()].map(() => {
181
+ return "\\text{}";
182
+ }),
183
+ ];
184
+ }
185
+ else {
186
+ return [
187
+ `\\text{}`,
188
+ ...[...Array(maxLength).keys()].map(() => {
189
+ return "\\text{}";
190
+ }),
191
+ ];
192
+ }
193
+ }
194
+ else {
195
+ return [
196
+ `\\text{Après ${getStrPythonInstruction(instruction)}}`,
197
+ ...[...Array(maxLength).keys()].map((i) => {
198
+ return l.length > i ? `\\text{${l[i]}}` : "\\text{}";
199
+ }),
200
+ ];
201
+ }
202
+ }),
203
+ ], true)}
204
+
205
+ ${(() => {
206
+ if (err) {
207
+ const indexInstructionWithErr = indexStepWithErr - 1;
208
+ const instructionWithErr = arrInstruction[indexInstructionWithErr];
209
+ switch (instructionWithErr.type) {
210
+ case "inject": {
211
+ const instructionInject = instructionWithErr;
212
+ const index = instructionInject.index;
213
+ return `Quand l'instruction ${codifyChunk(getStrPythonInstruction(instructionInject))} va être exécutée,
214
+
215
+ étant donné qu'aucun élément de $${nameList}$ n'existe à l'indice $${index}$
216
+ , l'exécution ne va pas pouvoir s'effectuer correctement.
217
+
218
+ Un message d'erreur va donc s'afficher.`;
219
+ }
220
+ case "remove": {
221
+ const instructionRemove = instructionWithErr;
222
+ const valueRemoved = instructionRemove.value;
223
+ return `Quand l'instruction ${codifyChunk(getStrPythonInstruction(instructionRemove))} va être exécutée,
224
+
225
+ étant donné qu'il n'y a aucun élément de $${nameList}$ qui a la valeur ${codifyChunk(strPythonForListElem(valueRemoved))}, l'exécution ne va pas pouvoir s'effectuer correctement.
226
+
227
+ Un message d'erreur va donc s'afficher.`;
228
+ }
229
+ default:
230
+ throw new Error("Unsupported instructionWithErr.type: " + instructionWithErr.type);
231
+ }
232
+ }
233
+ else {
234
+ return "";
235
+ }
236
+ })()}
237
+
238
+ Le programme affichera donc :
239
+
240
+ ${codify(getAnswer(identifiers))}
241
+
242
+ `;
243
+ };
244
+ const getPropositions = (n, { answer, ...identifiers }) => {
245
+ const propositions = [];
246
+ addValidProp(propositions, codifyChunk(answer), "raw");
247
+ const { arrInstruction } = identifiers;
248
+ const [instructionInject] = arrInstruction;
249
+ const { index, value } = instructionInject;
250
+ function createAnswerWrong(funcIndexWrong, funcValueWrong = (v) => v) {
251
+ const identifiersWrong = {
252
+ ...identifiers,
253
+ arrInstruction: arrInstruction.map((instruction) => {
254
+ if (instruction.type === "inject") {
255
+ return {
256
+ ...instruction,
257
+ index: funcIndexWrong(instruction.index),
258
+ value: funcValueWrong(instruction.value),
259
+ };
260
+ }
261
+ else {
262
+ return instruction;
263
+ }
264
+ }),
265
+ };
266
+ return getAnswer(identifiersWrong);
267
+ }
268
+ //indexAsked-1
269
+ {
270
+ tryToAddWrongProp(propositions, codifyChunk(createAnswerWrong((index) => index - 1)), "raw");
271
+ }
272
+ //indexAsked+1
273
+ {
274
+ tryToAddWrongProp(propositions, codifyChunk(createAnswerWrong((index) => index + 1)), "raw");
275
+ }
276
+ //student: lst[index]=value -> lst[value]=index
277
+ if (typeof value === "number") {
278
+ tryToAddWrongProp(propositions, codifyChunk(createAnswerWrong(() => value, () => index)), "raw");
279
+ }
280
+ //-indexAsked
281
+ {
282
+ tryToAddWrongProp(propositions, codifyChunk(createAnswerWrong((index) => -index)), "raw");
283
+ }
284
+ //error
285
+ {
286
+ const identifiersWrong = Object.assign({}, identifiers, {
287
+ indexAsked: 404,
288
+ });
289
+ tryToAddWrongProp(propositions, codifyChunk(getAnswer(identifiersWrong)), "raw");
290
+ }
291
+ //append
292
+ {
293
+ const identifiersWrong = {
294
+ ...identifiers,
295
+ arrInstruction: arrInstruction.map((instruction) => {
296
+ return { ...instruction, type: "append" };
297
+ }),
298
+ };
299
+ tryToAddWrongProp(propositions, codifyChunk(getAnswer(identifiersWrong)), "raw");
300
+ }
301
+ //filler
302
+ {
303
+ propWhile(propositions, n, () => {
304
+ const identifiersWrong = createRandomIdentifiers();
305
+ tryToAddWrongProp(propositions, codifyChunk(getAnswer(identifiersWrong)), "raw");
306
+ });
307
+ }
308
+ return shuffleProps(propositions, n);
309
+ };
310
+ const createRandomIdentifiers = () => {
311
+ const poolNameList = ["l", "lst", "liste"];
312
+ const nameList = random(poolNameList);
313
+ const rand = randint(0, 4);
314
+ function createRandomListInitial(minLength, maxLength) {
315
+ const length = randint(minLength, maxLength + 1);
316
+ const poolNumber = [...Array(61).keys()].map((i) => i - 30);
317
+ const subPoolNumber = randomMany(poolNumber, Math.max(Math.floor(length * 1.5), length + 2));
318
+ const listNumber = [...Array(length).keys()].map(() => random(subPoolNumber));
319
+ const poolLetter = "abcdefghijklmnopqrstuvwxyz".split("");
320
+ const subPoolLetters = randomMany(poolLetter, Math.max(Math.floor(length * 1.5), length + 2));
321
+ const listLetters = [...Array(length).keys()].map(() => random(subPoolLetters));
322
+ switch (rand) {
323
+ case 0:
324
+ return listNumber;
325
+ case 1:
326
+ return listLetters;
327
+ case 2: {
328
+ return [...Array(length).keys()].map(() => {
329
+ const word = [...Array(randint(1, 4)).keys()]
330
+ .map(() => random(poolLetter))
331
+ .join("");
332
+ return word;
333
+ });
334
+ }
335
+ case 3:
336
+ return zip(listNumber, listLetters).map(([n, letter]) => random([n, letter]));
337
+ default:
338
+ throw new Error("Unsupported rand: " + rand);
339
+ }
340
+ }
341
+ const listInitial = createRandomListInitial(2, 6);
342
+ function createRandomInstructionInject() {
343
+ const index = probaLawFlip([
344
+ [randint(-(listInitial.length * 2), -listInitial.length), 0.05],
345
+ [randint(-listInitial.length, 0), 0.25],
346
+ [randint(0, listInitial.length), 0.65],
347
+ [randint(listInitial.length, listInitial.length * 2), 0.05],
348
+ ]);
349
+ const [value] = createRandomListInitial(1, 1);
350
+ const instruction = {
351
+ type: "inject",
352
+ nameList,
353
+ value,
354
+ index,
355
+ };
356
+ return instruction;
357
+ }
358
+ const nbInstructions = randint(2, 4);
359
+ const arrInstruction = [
360
+ ...Array(nbInstructions).keys(),
361
+ ].map(createRandomInstructionInject);
362
+ const identifiers = { nameList, listInitial, arrInstruction };
363
+ return identifiers;
364
+ };
365
+ const getPyListSetElemAtIndexWaterfallQuestion = () => {
366
+ const identifiers = createRandomIdentifiers();
367
+ return getQuestionFromIdentifiers(identifiers);
368
+ };
369
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
370
+ const question = {
371
+ answer: getAnswer(identifiers, opts),
372
+ instruction: getInstruction(identifiers, opts),
373
+ keys: [],
374
+ answerFormat: "tex",
375
+ identifiers,
376
+ hint: getHint(identifiers, opts),
377
+ correction: getCorrection(identifiers, opts),
378
+ options: opts,
379
+ };
380
+ return question;
381
+ };
382
+ export const pyListSetElemAtIndexWaterfall = {
383
+ id: "pyListSetElemAtIndexWaterfall",
384
+ label: "Affecter une valeur à un élément dans une liste en Python (enchaînement d'instructions)",
385
+ isSingleStep: true,
386
+ generator: (nb, opts) => getDistinctQuestions(() => getPyListSetElemAtIndexWaterfallQuestion(opts), nb),
387
+ qcmTimer: 60,
388
+ freeTimer: 60,
389
+ getPropositions,
390
+ subject: "Mathématiques",
391
+ getQuestionFromIdentifiers,
392
+ hasHintAndCorrection: true,
393
+ answerType: "QCU",
394
+ };
@@ -35,6 +35,7 @@ export declare class GeogebraConstructor {
35
35
  maxHeight?: number;
36
36
  maxWidth?: number;
37
37
  hideFullScreenButton?: boolean;
38
+ interactiveObjects?: string[];
38
39
  constructor(options: Omit<GeogebraOptions, "coords">);
39
40
  getCoordsForPoints(points: Point[]): number[];
40
41
  getAdaptedCoords({ xMin, xMax, yMin, yMax, zMin, zMax, forceShowAxes, minCoords, ratio, }: GetAdaptedCoords): number[];
@@ -1 +1 @@
1
- {"version":3,"file":"geogebraConstructor.d.ts","sourceRoot":"","sources":["../../src/geogebra/geogebraConstructor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,eAAe,EAChB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAErD,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;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AAmB,CAAC;IAC5B,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;gBAClB,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC;IAuBpD,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE;IAOlC,gBAAgB,CAAC,EACf,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,SAAS,EACT,KAAK,GACN,EAAE,gBAAgB;IAsDnB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,eAAe,GAAG,eAAe;CA0BzD"}
@@ -20,6 +20,7 @@ export class GeogebraConstructor {
20
20
  maxHeight;
21
21
  maxWidth;
22
22
  hideFullScreenButton;
23
+ interactiveObjects;
23
24
  constructor(options) {
24
25
  this.customToolBar = options?.customToolBar ?? toolBarConstructor({});
25
26
  this.forbidShiftDragZoom = options?.forbidShiftDragZoom ?? false;
@@ -41,6 +42,7 @@ export class GeogebraConstructor {
41
42
  this.maxHeight = options?.maxHeight;
42
43
  this.hideFullScreenButton = options?.hideFullScreenButton;
43
44
  this.maxWidth = options?.maxWidth;
45
+ this.interactiveObjects = options?.interactiveObjects;
44
46
  }
45
47
  getCoordsForPoints(points) {
46
48
  const xMin = Math.min(...points.map((p) => p.x.evaluate()));
@@ -124,6 +126,7 @@ export class GeogebraConstructor {
124
126
  maxHeight: this.maxHeight,
125
127
  hideFullScreenButton: this.hideFullScreenButton,
126
128
  maxWidth: this.maxWidth,
129
+ interactiveObjects: this.interactiveObjects,
127
130
  };
128
131
  }
129
132
  }