!set title=Tres enteros I

!goto $wims_read_parm

:present
 Sean a,b,c tres número enteros. El objetivo es calcular el valor de
 $goalname.
!exit

:form
 $goalname = <input size=3 name=ans1>
!exit

:ans
 La respuesta dada es que $goalname = $ans1.
 !ifval $ans1=$good1
  <font color=green>Correcto</font>.
 !else
  <font color=red>Respuesta errónea</font>: $goalname = $good1.
 !endif
!exit

:init
storename=a,b,c,goalname,range,e1,e2,e3,e4,e5,e6
objname=los números
hint=Un método excelente en este caso es el de reducción

range=100
a=!randint -$range,$range
b=!randint -$range,$range
c=!randint -$range,$range
goalname=!randitem a,b,c
good1=$($goalname)

parm1=a+b\
 a+b = \
 a+b = ??
val1=$[$a+($b)]
weight1=1
parm2=b+c\
 b+c = \
 b+c = ??
val2=$[$b+($c)]
weight2=1
parm3=c+a\
 c+a = \
 c+a = ??
val3=$[$c+($a)]
weight3=1
parm4=a-b\
 a-b = \
 a-b = ??
val4=$[$a-($b)]
weight4=1
parm5=b-c\
 b-c = \
 b-c = ??
val5=$[$b-($c)]
weight5=1
parm6=c-a\
 c-a = \
 c-a = ??
val6=$[$c-($a)]
weight6=1

parmcnt=6
anscnt=1
minask=2

!distribute lines 1,1,0\
0,1,1\
1,0,1\
1,-1,0\
0,1,-1\
-1,0,1 into e1,e2,e3,e4,e5,e6

!exit

:info
!exit

:final
 gotcnt=!itemcnt $gotlist
 !if $gotcnt<$minask
  !exit
 !endif
 !bound ans1 between integer -1000,1000 default ??
 !for i in $gotlist
  pmat=!append line $(e$i) to $pmat
 !next i
 pmat=!translate $\
$ to ; in $pmat
 s=!positionof item $goalname in a,b,c
 diff=!exec pari A=[$pmat]; B=vecextract(A,7-2^($s-1)); print(matrank(A)-matrank(B))
 !if $diff<1
  speculate=yes
  !exit
 !endif
 !ifval $ans1=$good1
  thisscore=1
 !endif
!exit

