n=$teller
bewerking=bewerking2.proc
plaatsen=!record 67 of woorden.$taal
plaatsen=!shuffle $plaatsen
!if $graad=0
    R=$teller
!else
    R=$graad
!endif

!if $taal=nl        
    hint=Nee , geen hint bij deze som...
    !if $R=1
	aantal_dorpen =!randitem 2,4,6,8
	d1=20,63
        d2=60,63
        d3=20,60
	d4=60,60
	d5=20,57
	d6=60,57
	d7=20,54
	d8=60,54
	!for p=1 to $aantal_dorpen
	    plaats$p=!item $p of $plaatsen
	    afstand$p=!randint 2,335
	    TEXT=!append line text black,$(d$p),huge,$(plaats$p) $(afstand$p) km to $TEXT
	!next p

	!if $wims_user=supervisor and $printbaar=0
	    !for p=1 to $[$aantal_dorpen-1]
		afstand=$[$(afstand$p) + $(afstand$[$p+1])]	    
		GOED$n=!append item $afstand to $(GOED$n)
	    
		tabel=!append line <td><b>$(plaats$p)</b></td><td><b>$(plaats$[$p+1])</b></td><td>\
		<textarea cols=30  rows="1" name="ant$p" value="$(ant$p)"> $afstand </textarea></td><tr> to $tabel
	    
		antwoord=!append line <li>Van <b>$(plaats$p)</b> naar <b>$(plaats$[$p+1])</b> is $afstand kilometer\
		<br>dus $(afstand$p) km  van $(plaats$p) tot paaltje <b>plus</b> $(afstand$[$p+1]) km van paaltje tot $(plaats$[$p+1])</li> to $antwoord
	    !next p
	!else
	    !for p=1 to $[$aantal_dorpen-1]
		tabel=!append line <td><b>$(plaats$p)</b></td><td><b>$(plaats$[$p+1])</b></td><td>\
		<textarea cols=30  rows="1" name="ant$p" value="$(ant$p)"></textarea></td><tr> to $tabel    
		afstand=$[$(afstand$p) + $(afstand$[$p+1])]
		GOED$n=!append item $afstand to $(GOED$n)
	
		antwoord=!append line <li>Van <b>$(plaats$p)</b> naar <b>$(plaats$[$p+1])</b> is $afstand kilometer\
		<br>dus $(afstand$p) km  van $(plaats$p) tot paaltje <b>plus</b> $(afstand$[$p+1]) km van paaltje tot $(plaats$[$p+1])</li> to $antwoord
	    !next p    
	!endif
	opgave$n=Bereken de afstanden, en vul de tabel in:
	somtekst$n=<div align="center"><table border=1 width="75%"><th>Van</th><th>Naar</th><th>is hoeveel kilometer?</th><tr>$tabel</table>
	antwoord$n=Het goede antwoord is:<ul>$antwoord</ul>

        plaatje$n=600,600\
	transparent white\
	copy 0,0,-1,-1,-1,-1,gifs/verkeersbord.gif\
	xrange 0,100\
	yrange 0,100\
	$TEXT
	aantal_plaatsen=$[$aantal_dorpen-1]
    !endif
    !if $R=2 or $R=3
	aantal_dorpen =!randitem 4,6,8
        d1=20,63
        d2=60,63
        d3=20,60
        d4=60,60
        d5=20,57
        d6=60,57
        d7=20,54
        d8=60,54

	!for p=1 to $aantal_dorpen
	    plaats$p=!item $p of $plaatsen
	    afstand$p=!randint 5,335
	    TEXT=!append line text black,$(d$p),huge,$(plaats$p) $(afstand$p) km to $TEXT
	!next p    

	opgave$n=Veronderstel dat alle plaatsen en dorpen op 1 lange weg liggen.<br>\
	Hoe ver liggen dan de volgende plaatsen van elkaar?
	!if $wims_user=supervisor and $printbaar=0
	    !for p=1 to $[$aantal_dorpen-2]
		afstand=$[abs($(afstand$p) - $(afstand$[$p+2]))]    
		GOED$n=!append item $afstand to $(GOED$n)
	    
		tabel=!append line <td><b>$(plaats$p)</b></td><td><b>$(plaats$[$p+2])</b></td><td>\
		<textarea cols=30  rows="1" name="ant$p" value="$(ant$p)"> $afstand </textarea></td><tr> to $tabel
	    
		antwoord=!append line <li>Van <b>$(plaats$p)</b> naar <b>$(plaats$[$p+2])</b> is $afstand kilometer\
		<br>dus $(afstand$p) km  van $(plaats$p) tot paaltje <b>min</b> $(afstand$[$p+2]) km van paaltje tot $(plaats$[$p+2])</li> to $antwoord
	    !next p
	!else
	    !for p=1 to $[$aantal_dorpen-2]
		tabel=!append line <td><b>$(plaats$p)</b></td><td><b>$(plaats$[$p+2])</b></td><td>\
		<textarea cols=30  rows="1" name="ant$p" value="$(ant$p)"></textarea></td><tr> to $tabel
		afstand=$[abs($(afstand$p) - $(afstand$[$p+2]))]
	    
		GOED$n=!append item $afstand to $(GOED$n)
	
		antwoord=!append line <li>Van <b>$(plaats$p)</b> naar <b>$(plaats$[$p+2])</b> is $afstand kilometer\
		<br>dus $(afstand$p) km  van $(plaats$p) tot paaltje <b>min</b> $(afstand$[$p+2]) km van paaltje tot $(plaats$[$p+2])</li> to $antwoord
	    !next p
	!endif    	
	somtekst$n=<div align="center"><table border=1 width="75%"><th>Van</th><th>Naar</th><th>is hoeveel kilometer?</th><tr>$tabel</table>
	antwoord$n=Het goede antwoord is:<ul>$antwoord</ul>


	plaatje$n=600,600\
	transparent white\
	copy 0,0,-1,-1,-1,-1,gifs/verkeersbord.gif\
	xrange 0,100\
	yrange 0,100\
	$TEXT
    
	aantal_plaatsen=$[$aantal_dorpen-2]
    !endif
    
    !if $R>3
	tijd=1
        meisje=!record 43 of woorden.$taal
        meisje=!randitem $meisje
        snelheid=!randint 10,25
        aantal_dorpen = 2
        d1=20,63
        d2=60,63
        !for p=1 to 2	
	    plaats$p=!item $p of $plaatsen
	    afstand$p=!randint 2,335
	    TEXT=!append line text black,$(d$p),huge,$(plaats$p) $(afstand$p) km to $TEXT
	!next p
    
        GOED$n=$[($afstand1 + $afstand2)/$snelheid]
        opgave$n=<em>$meisje</em> wil met de fiets van $plaats1 naar $plaats2 <br>\
	Ze fiets gemiddeld zo'n $snelheid kilometer per uur<br>\
	Hoeveel uur fietst zij dan over dit traject<p align="left">\
	<small><em>\
	Geef je antwoord -het liefst- in de <b>decimale notatie</b> (dus 1.3 uur ofzo...)<br>\
	En je mag het antwoord op 2 decimalen nauwkeurig afronden<br>\
	dus noteer <b>1.33 uur</b> in plaats van <b>1.333333 uur</b><br>\
	Je <b>mag</b> in dit geval natuurlijk ook gewoon zeggen 1 uur 20 minuten </small></p>
    
	!if $wims_user=supervisor and $printbaar=0
	    somtekst$n=<div align="center"><table border=1 width="75%">\
	    <th>Van</th><th>Naar</th><th>hoeveel uur zou <em>$meisje</em> onderweg zijn?</th>\
	    <tr><td><b>$plaats1</b></td><td><b>$plaats2</b></td><td><textarea cols=30  rows="1" name="ant1" value="$ant1">$(GOED$n)</textarea></td></table>
	!else
	    somtekst$n=<div align="center"><table border=1 width="75%">\
	    <th>Van</th><th>Naar</th><th>hoeveel uur zou <em>$meisje</em> onderweg zijn?</th>\
	    <tr><td><b>$plaats1</b></td><td><b>$plaats2</b></td><td><textarea cols=30  rows="1" name="ant1" value="$ant1"></textarea></td></table>
	!endif
	antwoord$n=Het goede antwoord is:<br><ul><li>Van <b>$plaats1</b> naar <b>$plaats2</b> is $afstand1 km + $afstand2 km = $[$afstand1+$afstand2] kilometer\
	<br>de snelheid is $snelheid km/uur, dus fietst $meisje de afstand in\
	$[$afstand1 + $afstand2]/$snelheid=$(GOED$n) uur</li></ul>

	plaatje$n=600,600\
	transparent white\
	copy 0,0,-1,-1,-1,-1,gifs/verkeersbord.gif\
	xrange 0,100\
	yrange 0,100\
	$TEXT

	aantal_plaatsen=1
    !endif
    nivo_title= Bepaal de afstand tussen $plaats1 en $plaats2 <br>en nog wat meer...	
    !exit
!endif

!if $taal=en
    hint=No hints today...
    !if $R=1
	aantal_dorpen =!randitem 2,4,6,8
	d1=20,63
        d2=60,63
        d3=20,60
	d4=60,60
	d5=20,57
	d6=60,57
	d7=20,54
	d8=60,54
	!for p=1 to $aantal_dorpen
	    plaats$p=!item $p of $plaatsen
	    afstand$p=!randint 2,335
	    TEXT=!append line text black,$(d$p),huge,$(plaats$p) $(afstand$p) km to $TEXT
	!next p

	!if $wims_user=supervisor and $printbaar=0
	    !for p=1 to $[$aantal_dorpen-1]
		afstand=$[$(afstand$p) + $(afstand$[$p+1])]	    
		
		GOED$n=!append item $afstand to $(GOED$n)
		
		tabel=!append line <td><b>$(plaats$p)</b></td><td><b>$(plaats$[$p+1])</b></td><td>\
		<textarea cols=30  rows="1" name="ant$p" value="$(ant$p)"> $afstand </textarea></td><tr> to $tabel
		
		antwoord=!append line <li>From <b>$(plaats$p)</b> To <b>$(plaats$[$p+1])</b> is $afstand kilometre\
		<br>so $(afstand$p) km from $(plaats$p) To the signpost <b>plus</b> $(afstand$[$p+1]) km from signpost To $(plaats$[$p+1])</li> to $antwoord
	    !next p
	!else
	    !for p=1 to $[$aantal_dorpen-1]
		tabel=!append line <td><b>$(plaats$p)</b></td><td><b>$(plaats$[$p+1])</b></td><td>\
		<textarea cols=30  rows="1" name="ant$p" value="$(ant$p)"></textarea></td><tr> to $tabel    
		
		afstand=$[$(afstand$p) + $(afstand$[$p+1])]
		
		GOED$n=!append item $afstand to $(GOED$n)
		
		antwoord=!append line <li>From <b>$(plaats$p)</b> To <b>$(plaats$[$p+1])</b> is $afstand kilometre\
		<br>so $(afstand$p) km from $(plaats$p) To the signpost <b>plus</b> $(afstand$[$p+1]) km from signpost To $(plaats$[$p+1])</li> to $antwoord
	    !next p    
	!endif

	opgave$n=Calculate the distance, and fill in the blanks:
	somtekst$n=<div align="center"><table border=1 width="75%"><th>From</th><th>To</th><th>is howmany kilometre?</th><tr>$tabel</table>
	antwoord$n=The correct answer is:<ul>$antwoord</ul>

        plaatje$n=600,600\
	transparent white\
	copy 0,0,-1,-1,-1,-1,gifs/verkeersbord.gif\
	xrange 0,100\
	yrange 0,100\
	$TEXT
	aantal_plaatsen=$[$aantal_dorpen-1]
    !endif
    !if $R=2 or $R=3 
	aantal_dorpen =!randitem 4,6,8
        d1=20,63
        d2=60,63
        d3=20,60
        d4=60,60
        d5=20,57
        d6=60,57
        d7=20,54
        d8=60,54

	!for p=1 to $aantal_dorpen
	    plaats$p=!item $p of $plaatsen
	    afstand$p=!randint 5,335
	    TEXT=!append line text black,$(d$p),huge,$(plaats$p) $(afstand$p) km to $TEXT
	!next p    

	opgave$n=Suppose the villages and towns are all along one long road.<br>\
	What's the distance between the next towns?
	!if $wims_user=supervisor and $printbaar=0
	    !for p=1 to $[$aantal_dorpen-2]
		afstand=$[abs($(afstand$p) - $(afstand$[$p+2]))]    
		GOED$n=!append item $afstand to $(GOED$n)
	    
		tabel=!append line <td><b>$(plaats$p)</b></td><td><b>$(plaats$[$p+2])</b></td><td>\
		<textarea cols=30  rows="1" name="ant$p" value="$(ant$p)"> $afstand </textarea></td><tr> to $tabel
	    
		antwoord=!append line <li>From <b>$(plaats$p)</b> To <b>$(plaats$[$p+2])</b> is $afstand kilometre\
		<br>so $(afstand$p) km from $(plaats$p) To roadsign post <b>minus</b> $(afstand$[$p+2]) km from signpost to $(plaats$[$p+2])</li> to $antwoord
	    !next p
	!else
	    !for p=1 to $[$aantal_dorpen-2]
		tabel=!append line <td><b>$(plaats$p)</b></td><td><b>$(plaats$[$p+2])</b></td><td>\
		<textarea cols=30  rows="1" name="ant$p" value="$(ant$p)"></textarea></td><tr> to $tabel
		afstand=$[abs($(afstand$p) - $(afstand$[$p+2]))]
	    
		GOED$n=!append item $afstand to $(GOED$n)
	
		antwoord=!append line <li>From <b>$(plaats$p)</b> To <b>$(plaats$[$p+2])</b> is $afstand kilometre\
		<br>so $(afstand$p) km from $(plaats$p) To roadsign post <b>minus</b> $(afstand$[$p+2]) km from roadsign To $(plaats$[$p+2])</li> to $antwoord
	    !next p
	!endif    	
	somtekst$n=<div align="center"><table border=1 width="75%"><th>From</th><th>To</th><th>is howmany kilometre?</th><tr>$tabel</table>
	antwoord$n=the correct answer is:<ul>$antwoord</ul>


	plaatje$n=600,600\
	transparent white\
	copy 0,0,-1,-1,-1,-1,gifs/verkeersbord.gif\
	xrange 0,100\
	yrange 0,100\
	$TEXT
    
	aantal_plaatsen=$[$aantal_dorpen-2]
    !endif
    
    !if $R>3
	tijd=1
        meisje=!record 43 of woorden.$taal
        meisje=!randitem $meisje
        snelheid=!randint 10,25
        aantal_dorpen = 2
        d1=20,63
        d2=60,63
        !for p=1 to 2	
	    plaats$p=!item $p of $plaatsen
	    afstand$p=!randint 2,335
	    TEXT=!append line text black,$(d$p),huge,$(plaats$p) $(afstand$p) km to $TEXT
	!next p
    
        GOED$n=$[($afstand1 + $afstand2)/$snelheid]
        opgave$n=<em>$meisje</em> is bicycling from $plaats1 to $plaats2 <br>\
	Her average speed is  $snelheid <sup>kilometre</sup>/<sub>hour</sub><br>\
	How long will it take for $meisje to get from $plaats1 to $plaats2 ?<p align="left">\
	<small><em>\
	I prefer your aswer in the <b>decimale notation</b> (so 1.3 hour ...)<br>\
	You may roundoff at two decimals accurately<br>\
	so write <b>1.33 hour</b> instead of <b>1.333333 hour</b><br>\
	You <b>may</b> ofcourse write 1 hour 20 minutes </small></p>
    
	!if $wims_user=supervisor and $printbaar=0
	    somtekst$n=<div align="center"><table border=1 width="75%">\
	    <th>From</th><th>To</th><th>howmany hours would it take <em>$meisje</em> by bicycle?</th>\
	    <tr><td><b>$plaats1</b></td><td><b>$plaats2</b></td><td><textarea cols=30  rows="1" name="ant1" value="$ant1">$(GOED$n)</textarea></td></table>
	!else
	    somtekst$n=<div align="center"><table border=1 width="75%">\
	    <th>From</th><th>To</th><th>howmany hours would it take <em>$meisje</em> by bicycle?</th>\
	    <tr><td><b>$plaats1</b></td><td><b>$plaats2</b></td><td><textarea cols=30  rows="1" name="ant1" value="$ant1"></textarea></td></table>
	!endif
	antwoord$n=The correct answer is:<br><ul><li>From <b>$plaats1</b> to <b>$plaats2</b> is $afstand1 km + $afstand2 km = $[$afstand1+$afstand2] kilometre\
	<br>her average speed  is $snelheid km/hour, so $meisje bicycles this distance is\
	$[$afstand1 + $afstand2]/$snelheid=$(GOED$n) hour</li></ul>

	plaatje$n=600,600\
	transparent white\
	copy 0,0,-1,-1,-1,-1,gifs/verkeersbord.gif\
	xrange 0,100\
	yrange 0,100\
	$TEXT

	aantal_plaatsen=1
    !endif
    nivo_title= Determine the bicycle-time to get from $plaats1 to $plaats2 	
    !exit
!endif



