
!if $cmd!=help
 tit=!word 2 to -1 of $title
 module_title=$module_title: $tit
!endif

!if $cmd=reply and $status!=waiting
 error=double_reply
 !exit
!endif

!if $cmd=reply and $status=waiting
 !if $job=abandon
  error=abandon
  status=done
  wims_module_log=abandon
  module_score=0
  !exit
 !endif
 P=!trim $P
 !if $P=$empty
  error=empty_data
  !exit
 !endif
 P=!lower $P
 P=!rawmath $P
 list=!varlist $P
 !if $list!=$empty and $list!=x
  error=not_poly
  !advance replycnt
  !goto testcnt
 !endif
 P=!translate , to . in $P
 !if . isin $P
  error=real_coefficient
  !exit
 !endif
 test=!evalsubst x=($t0) in $P
 !if NaN isin $test or Inf isin $test
  error=bad_poly
  !exit
 !endif
 pariout=!exec pari P=$P; print(poldegree(P,x))\
 	good=subst($(poly$sol),x,x-($t0));if(P==good,print("yes"),print("no"))
 !distribute line $pariout into deg,test
 
 !if $deg>$order
  error=bad_degree
  !advance replycnt
 !else
  !if yes notin $test
   error=wrong
   !advance replycnt
  !endif
 !endif
 
 :testcnt
 !if $error!=$empty and $replycnt<3
  !exit
 !endif

 status=done
 !if $error=$empty
  module_score=$[rint(100/2^$replycnt)/10]
 !else
  module_score=0
 !endif
 wims_module_log=score $module_score
!endif

