!!! fichier de traitement des donnes de l'exo de type 1 !!!

## l'tape 4
!if $navig!=$etape
  etape=$navig
  !exit
!endif

!if $enonceR=$empty
  exalert=$(alerts[1;])
  !exit
!endif

enonceR=!trim $enonceR
  
  !!!!---- on verifie la validite de la reponse ----!!!!
  repsnb=3
  reps1=$fixchnb
  reps2=$borng
  reps3=$bornd
  NonValide=alert5
  !read comsDir/repclean
  
  !if $alertreps1!=$empty or $alertreps2!=$empty or $alertreps3!=$empty
    exalert=$(alerts[5;])
    fixchnb=$reps1
    borng=$reps2
    bornd=$reps3
    !exit
  !endif
  !!!!---- fin de vrification de validit ----!!!!
  
!if $ckchnb=0
  chnb=$propsnb
  fixchnb=
  borng=
  bornd=
!endif
  
!if $ckchnb=1 
  !if $fixchnb=$empty
    exalert=$(alerts[1;])
    borng=
    bornd=
    !exit
  !endif
  fixchnbtest=!exec maxima integerp($fixchnb);
  !if $fixchnbtest!=true
    exalert=$(alerts[1;])
    borng=
    bornd=
    !exit
  !endif
  !if $fixchnb<2 or $fixchnb>$propsnb
    exalert=$(alerts[5;])
    borng=
    bornd=
    !exit
  !endif
  chnb=$fixchnb
  borng=
  bornd=
!endif
  
!if $ckchnb=2
  chnb=random(2..$propsnb)
  fixchnb=
  borng=
  bornd=
!endif
  
!if $ckchnb=3 
  !if $borng=$empty or $bornd=$empty
    exalert=$(alerts[1;])
    !exit
    fixchnb=
  !endif
    
  borngtest=!exec maxima integerp($borng);
  borndtest=!exec maxima integerp($bornd);
  !if $borngtest!=true or $borndtest!=true or $borng>$propsnb or $bornd>$propsnb
    exalert=$(alerts[5;])
    fixchnb=
    !exit
  !endif
  
  !if $borng<2 or $bornd<2 
    exalert=$(alerts[2;])
    fixchnb=
    !exit
  !endif
    
  chnb=random($[min($borng,$bornd)]..$[max($borng,$bornd)])
  fixchnb=
!endif
  
etape=$[$etape+1]
!exit
