!set n=$teller
bewerking=bewerking3.proc
!if $graad=0
    R=$teller
!else
    R=$graad
!endif        
woordmax=30
!if $HINT=1
    hint=<table bgcolor=white width="100%"><th><div align="left">\
    You don't need to look at the clock, and try to figure out the right time...just use some mathematics<br>\
    <ul>\
    <li>add all the hours (or subtract them)\
    <li>divide the outcome by 12\
    <li>the rest/remainder of this division is the righr answer\
    <li>im math this 'remainder of division' ius called "modulo"<br>\
    There may be a modulo (Mod-button) function on your calculaator<br>\
    <li>Lets take a small example:<br>\
    Presume it's 5 o'clock<br>\
    Suppose we want to know what time it is over 37 hours
    37 hours later it will be:<br>\
    5 + 37 = 42 hours... <br>how many times is there "12" in "42" ?<br>\
    <b>42 <font size="+1">&divide;</font> 12 = 3</b> (<b>3 &times 12 = 36</b> the remainder is <b>42 - 36 = 6</b>)<br>\
    so is't 6 o'clock\
    <li>Naturally you could count thing out;<br>\
    I'ts  5 o'clock<br>\
    12 hours later it's 5 o'clock again<br>\
    12 hours later it's 5 o'clock again (total elapsed 24 hours)<br>\
    12 hours later it's 5 o'clock again (total elapsed 36 hours)<br>\
    1 hour later is's 6 o'clock (total 12+12+12+1=37)</ul></th></table>
!endif

!if $R=1
    eerste=4
    laatste=!randint 8,16
!endif	
!if $R=2
    eerste=12
    laatste=!randint 20,36
!endif	
!if $R>2
    eerste=24
    laatste=!randint 36,72
!endif	


!if $R isin 1,2,3
    uren=!randint 1,12
    minuten=!randint 2,8
    seconden=!randint 1,60
    later=!randint $eerste,$laatste
    tijd=$[$uren+$later]
    GOED$n=!exec pari Mod($tijd,12)
    GOED$n=!replace internal Mod( by  in $(GOED$n)
    GOED$n=!replace internal ) by  in $(GOED$n)
    GOED$n=!item 1 of $(GOED$n)
    spreektijd=!item $uren of $telwoorden
    somtekst$n=According to this clock, it's just past $spreektijd o'clock<br>\
    calculate where the small pointer of this clock will be $later hours later?<br>\
    <small>so calculate to what <b>whole hour</b> the small pointer points</small>
    !if $tijd >= 12
	keer_12=!exec pari abs(floor($tijd/12))
	extratekst= In $tijd hours there are $keer_12 times 12 hours,\ 
	so the remainder is:<b> $tijd - $[$keer_12*12] = $[$tijd - $keer_12*12]</b><br>
    !else
	extratekst= 
    !endif
    antwoord$n=The time on the clock was $uren hours and $minuten minutes<br>\
    so the small pointer (the one pointing to the hours) will point<br>\
    (after $later hours) towards  $uren + $later = $tijd hours.<br>\
    $extratekst ...it will then be $(GOED$n) o'clock. 
!endif    

!if $R>3
    uren=!randint 1,12
    minuten=!randint 2,8
    seconden=!randint 1,60
    later=!randint $eerste,$laatste
    tijd=$[$uren-$later]
    GOED$n=!exec pari Mod($tijd,12)
    GOED$n=!replace internal Mod( by  in $(GOED$n)
    GOED$n=!replace internal ) by  in $(GOED$n)
    GOED$n=!item 1 of $(GOED$n)
    spreektijd=!item $uren of $telwoorden    
    somtekst$n=According to the clock, it has just been $spreektijd o'clock<br>\
    At what -whole- hour would the small pointer have been pointing $later hours ago?<br>\
    <small>so calculate to what <b>whole hour</b> the small pointer points</small>

    !if $tijd > -12
	antwoord$n=It was $uren o'clock, $later hours earlier is was $uren - $later = $tijd<br>\
	so the clock would then be at 12 +  $tijd  = $[12 + $tijd] hours
    !else
	keer_12=!exec pari abs(floor($later/12))
    	antwoord$n=The small pointer was at $uren o'clock,<br>\
	We were asked to calculate what time it was $later hours earlier<br>\
	How many times 12 is there in $later hours?<br>\
	$later &divide; 12 = $keer_12 , the remainder is <b>$later - 12 &times; $keer_12 = $[$later - 12*$keer_12]</b> <br>\
	The answer is:<b> $uren -  $[$later - 12*$keer_12] = $(GOED$n)</b>  o'clock	
    !endif
!endif 

!if $bijles=1
    goede_woorden=hrs,hours,hour,the,precise,is,exact,stands,pointer,points,small,big,o'clock,full,was,in,hr,h,it,at
!endif
wims_read_parm=$uren:$minuten:$seconden
# slib_time=$uren:$minuten:$seconden
!readproc slib/draw/clock $wims_read_parm
goedklok$n=$slib_out 

#slib_time=$(GOED$n):$minuten:$seconden
wims_read_parm=$(GOED$n):$minuten:$seconden
!readproc slib/draw/clock $wims_read_parm 
antwoordklok$n=$slib_out