!set title=3: Pirámide I
!if $wims_read_parm!=$empty
 !goto $wims_read_parm
!endif
oef2wims_version=3.22
language=es
author=XIAO, Gang
email=xiao@unice.fr
computeanswer=no
precision=10000

ansorder=r,r,r,r,r,r,r,r,r,r
varcnt=91
prevarcnt=85
postvarcnt=5
replycnt=10
choicecnt=0
conditioncnt=1
feedbackcnt=0
format=html

val1=$imagedir
val2=$confparm1
val3=$confparm2
val4=$confparm3
val5=$confparm4

!if $testcondition=yes
 !goto test
!endif
!if $status=waiting
 !exit
!endif

val6=1
val7=1
val8=$[rint($val7+1)]

!ifval $val2 issametext 
val2=$[rint(1)]
!endif

!ifval $val3 issametext 
val3=$[rint(0)]
!endif
tmp0=!shuffle a,b,c,d,r,s,t,x,y,z

val9=$(tmp0)
tmp0=!randitem 2,3,5

val10=sqrt($(tmp0))
tmp0=!record $val2 of src/data

val11=$(tmp0)
val12=$(val11[1;])
val13=$(val11[2;])
val14=$(val11[3;1])
val15=$(val11[3;2])
val16=$[rint(($val14+$val15)/2)]
val17=$(val13[1])
val18=$(val13[2])
val19=$(val13[3])

!ifval $val18 =
val18= 60
!endif

!ifval $val19=
val19= 35
!endif
val20=$val18 $val19
tmp=!translate internal $	$ to ; in $val11

tmp=!row 4 to -1 of $tmp
tmp0=!translate internal $\
$ to ; in $tmp
tmp1=!rows2lines $(tmp0)

val11=$(tmp1)
tmp0=!itemcnt $val11

val21=$[rint($(tmp0))]
!if $val21<=3 
val22=$(val11[1])
val23=$(val11[2])
val24=$(val11[3])
val25=computed
!if $val24<0 
tmp0=!values $val24*x,-($val24)*x for x=$val22 to $val23

val26=$(tmp0)
!else
tmp0=!values $val24*x for x=$val22 to $val23

val26=$(tmp0)
!endif
val11=$val26
!else
val25=listed
!endif
tmp0=!mathsubst f=$(val9[1]) in $val11

val11=$(tmp0)
tmp0=!mathsubst g=$(val9[2]) in $val11

val11=$(tmp0)
tmp0=!mathsubst rt=$val10 in $val11

val11=$(tmp0)
tmp0=!shuffle $val11

tmp1=!item 1 to $val8 of $(tmp0)

val27=$(tmp1)
val28=$[rint(($val6+1)*($val6+2)/2+($val7-$val6)*($val6+1))]
val29=
val30=
val31=black
val32=line 0,$val6,($val7-$val6),$val6,$val31
val33=$[rint(1)]
val34=
!for val35 =$val6..0 step -1 
val36=$[rint($val33)]
val33=$[rint($val33+$val7-$val35+1)]

!ifval $val35<$val6
val32=$val32	polygon $val31,0,$val35
!endif
!for val37 =0..$val7-$val35 

!ifval $val35>0
val34=$val34 $val36+$val37,$val33+$val37,$val33+$val37+1;
!endif

!ifval $val37>0 and $val35<$val6
val32=$val32,$val37-1,$val35+1,$val37,$val35
!endif
val29=$val29$val37,
val30=$val30$val35,
!next
val32=$val32	line 0,$val35,$val7-$val35,$val35
!next
tmp0=!values 0 for x=1 to $val28

val38=$(tmp0)
!for val39 =1..$val8 
tmp0=!replace item number $val28-$val39+1 by $(val27[$val39]) in $val38

val38=$(tmp0)
!next
tmp=!translate internal $	$ to ; in $val34

tmp0=!rowcnt $tmp
val40=$[rint($(tmp0))]
!for val24 =$val40 to 1 step -1 
!if $val25 issametext computed 
val41=$[($(val38[$(val34[$val24;2])]))+($(val38[$(val34[$val24;3])]))]
!else
t_=!replace internal \( by ( in expand(($(val38[$(val34[$val24;2])]))+($(val38[$(val34[$val24;3])])))
tmp0=!exec maxima $t_

val41=$(tmp0)
!endif
tmp0=!replace item number $(val34[$val24;1]) by $val41 in $val38

val38=$(tmp0)
!next
val42=
tmp0=!listcomplement $val38 in $val11

val43=$(tmp0)
tmp0=!itemcnt $val43

val44=$[rint(min($val3,$(tmp0)))]
!for val39 =1 to $val44 
tmp0=!item 1 to $val3 of $val43

val45=$(tmp0)

!ifval / isin $(val45[$val39])
tmp0=!replace / by /( in \($(val45[$val39])))

val46=$(tmp0)
!else
val46=\($(val45[$val39]))
!endif
val42=$val42,$val46
!next
val17=
!for val39 =1 to $val28 
!if / isin $(val38[$val39]) 
tmp0=!replace / by /( in \($(val38[$val39])))

val46=$(tmp0)
!else
val46=\($(val38[$val39]))
!endif
tmp0=!append item $val46 to $val17

val17=$(tmp0)
!next
val47=0.2
val48=$[rint(150)]
val49=$[rint(100)]
val50=$[rint(($val7+$val47*2)*$val48)]
val51=$[rint(($val6+$val47*2)*$val49)]
!readproc oef/draw.phtml $val50,$val51 \
 xrange -$val47,$val7+$val47	 yrange -$val47,$val6+$val47	 fill 0,0,white	 linewidth 3	 linear 1,0.5,0,1	 $val32	 
tmp0=$ins_url
val52=$(tmp0)
val53=
!for val39 =1..$val28 
tmp0=!append item $(val29[$val39])+$(val30[$val39])*0.5 to $val53

val53=$(tmp0)
!next
tmp0=!values (x+$val47)*$val48-$val18/2 for x in $val53

val29=$(tmp0)
tmp0=!values ($val47+$val6-y)*$val49-$val19/2 for y in $val30

val30=$(tmp0)
val54=
!for val55 =1 to $val28 
val54=$val54	r$val55,$(val29[$val55])x$(val30[$val55])
!next
tmp0=!item 1 to $val28 of r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15

val56=$(tmp0)
oefsteps=$val56 
nextstep=!nosubst $val56 
!readproc oef/steps.proc
replytype1=dragfill
replyname1=Caja 1
replygood1=?analyze 57;$(val17[1])$val42
replytype2=dragfill
replyname2=Caja 2
replygood2=?analyze 58;$(val17[2])
replytype3=dragfill
replyname3=Caja 3
replygood3=?analyze 59;$(val17[3])
replytype4=dragfill
replyname4=Caja 4
replygood4=?analyze 60;$(val17[4])
replytype5=dragfill
replyname5=Caja 5
replygood5=?analyze 61;$(val17[5])
replytype6=dragfill
replyname6=Caja 6
replygood6=?analyze 62;$(val17[6])
replytype7=dragfill
replyname7=Caja 7
replygood7=?analyze 63;$(val17[7])
replytype8=dragfill
replyname8=Caja 8
replygood8=?analyze 64;$(val17[8])
replytype9=dragfill
replyname9=Caja 9
replygood9=?analyze 65;$(val17[9])
replytype10=dragfill
replyname10=Caja 10
replygood10=?analyze 66;$(val17[10])
question=__EXECUTED_1692754_EXERCISE__

!goto stat

!exit

:question
$()Rellenar la imagen con los objetos dados,	de manera que cada caja de un nivel superior sea igual a la suma	de las dos cajas inmediatamente inferiores.	<p><center>	  
!read oef/special.phtml imagefill $val52,$val50 $val51,$val20	$val54	 
$()	</center>	
$()
!exit

:hint
$()
$()
!exit

:help
$()
$()
!exit

:solution
$()
$()
!exit

:postdef
tmp0=!item 1 to $val28 of $val57,$val58,$val59,$val60,$val61,$val62,$val63,$val64,$val65,$val66,\r11,\r12,\r13,\r14,\r15

val67=$(tmp0)
tmp0=!replace internal \ by in $val67

val68=$(tmp0)
tmp=!translate ";': to $     $ in ($(val68[$(val34[1;1])]))-($(val68[$(val34[1;2])]))-($(val68[$(val34[1;3])]))

tmp=!lower $tmp
tmp0=!exec maxima fullratsimp($tmp);
val69=$(tmp0)
val70=$(val67[$(val34[1;3])])

!ifval - isin $val70
val70=($val70)
!endif

!exit

:feedback

!exit

:test

!ifval $val69 notsametext and $val69=0
 condtest1=1
!else
 condtest1=0
!endif
condname1=$(val67[$(val34[1;1])]) = $(val67[$(val34[1;2])]) + $val70

!exit

:stat
vsavelist=20,28,34,50,51,52,54,57,58,59,60,61,62,63,64,65,66
embedcnt=1
