nivo_title=Wat geeft deze 24-uurs digitale klok straks aan?
bewerking=bewerking4.proc
!set n=$teller
#digitale klok
!if $HINT=1
    hint=zie de help
!endif
!if $graad=0
    R=$teller
!else
    R=$graad
!endif        
uren=!randint 0,23
minuten=!randint 0,60
seconden=!randint 0,60

!if $uren < 10
    uren=!nospace 0 $uren
!endif
!if $minuten < 10
    minuten=!nospace 0 $minuten
!endif
!if $seconden < 10
    seconden=!nospace 0 $seconden
!endif

width=45
height=45
punt=<img src='$gifdir/digits/punt.gif' border='noborder' width='$width' height='$height'>

test=!charcnt $uren
T=!char 1 of $uren
E=!char 2 of $uren
H=<img src='$gifdir/digits/$T.png' border='noborder' width='$width' height='$height'><img src='$gifdir/digits/$E.png' border='noborder' width='$width' height='$height'>

test=!charcnt $minuten
T=!char 1 of $minuten
E=!char 2 of $minuten
M=<img src='$gifdir/digits/$T.png' border='noborder' width='$width' height='$height'><img src='$gifdir/digits/$E.png' border='noborder' width='$width' height='$height'>

test=!charcnt $seconden
T=!char 1 of $seconden
E=!char 2 of $seconden
S=<img src='$gifdir/digits/$T.png' border='noborder'  width='$width' height='$height'><img src='$gifdir/digits/$E.png' border='noborder' width='$width' height='$height'>

klok$n=$H $punt $M $punt $S 

!if $R=1
    UUR=!randint 1,24
    tussen=!exec pari Mod($[$UUR+$uren],24)
    tussen=!replace internal Mod(  by $empty in $tussen
    tussen=!replace internal )  by $empty in $tussen
    UREN=!item 1 of $tussen
    GOED$n=$UREN,$minuten,$seconden
    somtekst$n=<p align="center">De onderstaande digitale klok geeft<br>de tijd weer in "24-uurs formaat".<br>\
    Wat geeft dit type klok over:<br><b> precies $UUR uur aan ?</b></p>
 !exit
!endif 

!if $R=2 
    UUR=!randint 1,24
    MIN=!randint 1,60
    extra1=0
    !if $[$MIN + $minuten] > 60
	extra1=1
    !endif    	
    tussen1=!exec pari Mod($UUR + $uren + $extra1,24)
    tussen1=!replace internal Mod(  by $empty in $tussen1
    tussen1=!replace internal )  by $empty in $tussen1
    UREN=!item 1 of $tussen1
    tussen2=!exec pari Mod($MIN + $minuten,60)
    tussen2=!replace internal Mod(  by $empty in $tussen2
    tussen2=!replace internal )  by $empty in $tussen2
    MINUTEN=!item 1 of $tussen2
    GOED$n=$UREN,$MINUTEN,$seconden
    somtekst$n=<p align="center">De onderstaande digitale klok geeft <br>de tijd weer in "24-uurs formaat".<br>\
    Wat geeft dit type klok over<br><b> $UUR uur en $MIN minuten aan ?</b></p>
 !exit
!endif

!if $R=3 
    UUR=!randint 1,24
    MIN=!randint 1,60
    SEC=!randint 1,60
    extra1=0
    extra2=0
    !if $[$SEC + $seconden] > 60
	extra1=1
    !endif
    !if $[$MIN + $minuten + $extra1] > 60
	extra2=1
    !endif	
    tussen3=!exec pari Mod($SEC + $seconden,60)
    tussen3=!replace internal Mod(  by $empty in $tussen3
    tussen3=!replace internal )  by $empty in $tussen3
    SECONDEN=!item 1 of $tussen3    
    tussen2=!exec pari Mod($MIN + $minuten + $extra1,60)
    tussen2=!replace internal Mod(  by $empty in $tussen2
    tussen2=!replace internal )  by $empty in $tussen2
    MINUTEN=!item 1 of $tussen2
    tussen1=!exec pari Mod($UUR + $uren + $extra2,24)
    tussen1=!replace internal Mod(  by $empty in $tussen1
    tussen1=!replace internal )  by $empty in $tussen1
    UREN=!item 1 of $tussen1    	

    GOED$n=$UREN,$MINUTEN,$SECONDEN
    somtekst$n=<p align="center">De onderstaande digitale klok geeft <br>de tijd weer in "24-uurs formaat".<br>\
    Wat geeft dit type klok over<br><b> $UUR uur en $MIN minuten en $SEC seconden aan ?</b></p>
 
 !exit
!endif

!if $R>3 
    UUR=!randint 24,120
    MIN=!randint 59,119
    SEC=!randint 59,119
    extra1=0
    extra2=0
    !if $[$SEC + $seconden] > 120 
	extra1=2
    !else
	!if $[$SEC + $seconden] > 60 
	    extra1=1
	!endif    
    !endif
    
    !if $[$MIN + $minuten + $extra1] > 120
	extra2=2
    !else
	!if  $[$MIN + $minuten + $extra1] > 60
	    extra2=1
	!endif	
    !endif
    	
    tussen3=!exec pari Mod($SEC + $seconden,60)
    tussen3=!replace internal Mod(  by $empty in $tussen3
    tussen3=!replace internal )  by $empty in $tussen3
    SECONDEN=!item 1 of $tussen3    
    tussen2=!exec pari Mod($MIN + $minuten + $extra1,60)
    tussen2=!replace internal Mod(  by $empty in $tussen2
    tussen2=!replace internal )  by $empty in $tussen2
    MINUTEN=!item 1 of $tussen2
    tussen1=!exec pari Mod($UUR + $uren + $extra2,24)
    tussen1=!replace internal Mod(  by $empty in $tussen1
    tussen1=!replace internal )  by $empty in $tussen1
    UREN=!item 1 of $tussen1    	

    GOED$n=$UREN,$MINUTEN,$SECONDEN
    somtekst$n=<p align="center">De onderstaande digitale klok geeft <br>de tijd weer in "24-uurs formaat".<br>\
    Wat geeft dit type klok over<br><b> $UUR uur en $MIN minuten en $SEC seconden aan ?</b></p>
 
 !exit
!endif


