# Variable initialisation file.
# This file is read by wims for new sessions (cmd=new or cmd=renew)

!default range=15
!default objects=3
!default weights=1

xs=!shuffle $range
ys=!shuffle $range
xc=0
yc=0
xmin=$range
ymin=$range
xmax=0
ymax=0
ww=0
!for i=1 to $objects
 x$i=!item $i of $xs
 y$i=!item $i of $ys
 w$i=!randint 1,$weights
 xc=!eval $xc+$(x$i)*$(w$i)
 yc=!eval $yc+$(y$i)*$(w$i)
 ww=!eval $ww+$(w$i)
 !if $xmin>$(x$i)
  xmin=$(x$i)
 !endif
 !if $xmax<$(x$i)
  xmax=$(x$i)
 !endif
 !if $ymin>$(y$i)
  ymin=$(y$i)
 !endif
 !if $ymax<$(y$i)
  ymax=$(y$i)
 !endif
!next i
xc=!eval $xc/$ww
yc=!eval $yc/$ww

!distribute item wait,, into status,click_x,click_y

!if $type=2
 xmin=1
 ymin=1
 xmax=$range
 ymax=$range
!endif

