Rev 8525 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6510 | bpr | 1 | \title{Le compte est bon} |
2 | \integer{n = 3} Nombre de chiffres choisis |
||
3 | \text{chiffres = wims(makelist x for x = 2 to 10)} |
||
4 | \text{list = slib(data/random \n,item,\chiffres)} |
||
5 | \text{op=+,*} |
||
8525 | bpr | 6 | \integer{c = randint(1..2)} |
6510 | bpr | 7 | \text{opc1 = wims(randitem \op)} |
8 | \text{nb = slib(data/random 3,item,\list)} |
||
9 | \if{\c = 1} |
||
10 | {\integer{val = \nb[1]\opc1\nb[2]}} |
||
11 | {\text{opc2 = wims(randitem \op)} |
||
12 | \integer{val = (\nb[1]\opc1\nb[2])\opc2\nb[3]} |
||
13 | } |
||
8525 | bpr | 14 | \if{\val isitemof \list}{ |
15 | \text{opc1=*} |
||
16 | \text{opc2=*} |
||
6510 | bpr | 17 | \integer{val = (\nb[1]\opc1\nb[2])\opc2\nb[3]} |
18 | } |
||
19 | |||
20 | \text{NETAPE = r1} |
||
21 | \nextstep{\NETAPE} |
||
22 | \text{COND = 1} |
||
23 | \conditions{\COND} |
||
24 | \statement{ |
||
25 | En additionnant ou en multipliant certains de ces chiffres |
||
8514 | bpr | 26 | <p class="wimscenter bold">\list</p> |
27 | vous devez obtenir <b>\val</b>. |
||
17280 | bpr | 28 | Chaque chiffre ne pourra être utilisé qu'une fois.<br> |
8514 | bpr | 29 | \if{\step = 1}{De combien d'opérations aurez-vous besoin ? \embed{r1,2}} |
6510 | bpr | 30 | {\if{\NETAPE!=} |
8514 | bpr | 31 | { Entrez votre formule : |
6510 | bpr | 32 | \if{\nop = 1}{ (\embed{r2,2} \embed{r3} \embed{r4,2}) } |
33 | { (\embed{r2,2} \embed{r3} \embed{r4,2}) \embed{r5}\embed{r6,2} } |
||
34 | } |
||
35 | } |
||
36 | } |
||
37 | \answer{}{\nop}{type=numeric} |
||
38 | \answer{}{\ch1}{type=numeric} |
||
39 | \answer{}{\oper1;\op}{type=menu} |
||
40 | \answer{}{\ch2}{type=numeric} |
||
41 | \answer{}{\oper2;\op}{type=menu} |
||
42 | \answer{}{\ch3}{type=numeric} |
||
43 | |||
44 | \condition{nb d'opérations}{\nop = 1 or \nop = 2}{option=hide} |
||
45 | |||
46 | \if{\step = 2} |
||
47 | {\if{\nop = 1}{\text{NETAPE = r2,r3,r4} |
||
48 | \text{COND = 2,3}} |
||
49 | {\if{\nop = 2}{\text{NETAPE = r2,r3,r4,r5,r6} |
||
50 | \text{COND = 2,3}} |
||
8514 | bpr | 51 | {\text{NETAPE = }} |
6510 | bpr | 52 | } |
53 | } |
||
8514 | bpr | 54 | {\text{NETAPE = }} |
6510 | bpr | 55 | \integer{res = \nop = 1 ?\ch1 \oper1 \ch2 : (\ch1 \oper1 \ch2)\oper2 \ch3} |
56 | \text{rep = \ch1,\ch2} |
||
57 | \text{rep = \nop = 2 ? \rep,\ch3} |
||
58 | \text{rep = wims(listuniq \rep)} |
||
59 | \text{repcomp = wims(listcomplement \list in \rep)} |
||
60 | \integer{uniq = items(\rep) - 1} |
||
61 | \condition{opération correcte ?}{\res = \val} |
||
62 | \condition{Vous avez respecté la consigne}{\uniq = \nop and \repcomp=}{weight=2} |
||
63 | |||
64 | \feedback{\nop > 2}{Vous n'avez pas à faire plus de deux opérations} |
||
8514 | bpr | 65 | \feedback{\step = 3 and \uniq!=\nop}{Vous n'avez pas respecté la consigne : |
6510 | bpr | 66 | vous avez utilisé plusieurs fois le même chiffre.} |
8514 | bpr | 67 | \feedback{\step = 3 and \repcomp!=}{Vous n'avez pas respecté la consigne : |
6510 | bpr | 68 | vous avez utilisé un chiffre qui n'était pas proposé} |
69 | \feedback{\step = 3 and \res!=\val}{Votre calcul donne \res et non \val} |