:start
rep_max=!item $maxmin of 1000, 0
rep_max_charges=
point_critique=
xs=!shuffle $[2*$range+1]
ys=!shuffle $[2*$range+1]

!for i=1 to $charges
a$(i)=!item $i of $xs
a$i=$[$(a$(i))-$range-1]
b$(i)=!item $i of $ys
b$i=$[$(b$(i))-$range-1]
d=!randint 1,8
c$i=!randitem -1,1
q$(i)=$[($d)*($(c$i))]
!if $maxmin=2
!if $rep_max < $d
rep_max_charges=$i
rep_max = $d
!endif
!else
!if $rep_max > $d
rep_max_charges=$i
rep_max = $d
!endif
!endif
!if $rep_max = $d
rep_max_charges=!append item $i to $rep_max_charges
!endif
xyq=!append line $(a$(i)),$(b$(i)),$(q$(i))  to $xyq
point_critique=!append line $(a$(i)),$(b$(i))  to $point_critique
!next i

rep_max_charges=!listuniq $rep_max_charges
rep_max_charges=!item $rep_max_charges of A,B,C,D,E,F,G,H

f=0
!for i=1 to $charges
R$(i)=(x-($(a$(i))))^2+(y-($(b$(i))))^2
f=$f- ($(q$(i)))/($(R$(i)))^(1/2)
!next i
