n=$teller
bewerking=bewerking1.proc
!if $graad=0
    R=$teller
!else
    R=$graad
!endif  
antwoord=$empty
#LETTERLIJK CHECK VERVALT DOOR CHECK OP HAAKJES
letterlijk=1
letter1=!randitem s,k,q,u,x
letter2=!randitem m,r,v,y,p,t

!if $R=1
    wims_rawmath_variables=$letter1
    varcnt=1
    getallen=2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
    getallen=!shuffle $getallen    
    !for p=1 to $aantal_vragen
        keuze=!randitem 1,2,3
        getal1=!item $p of $getallen
        getal2=!item $[$p + 1] of $getallen
        getal3=!item $[$p + 2] of $getallen
        pm=!randitem +,-
        !if $keuze=1
	    vraag=$letter1*($letter1 $pm $getal2)
        !endif
	!if $keuze=2
	    vraag=$letter1*($getal1*$letter1 $pm $getal2)
	!endif
	!if $keuze=3
	    getal3=!randitem 2,3,4,5
	    vraag=$getal3*$letter1*($getal2 $pm $getal1*$letter1)
        !endif
	controle=!append item $vraag to $controle
        som$p=!htmlmath $vraag
        GOED=!exec pari $vraag
        GOED$n=!append item $GOED to $(GOED$n)
	htmlgoed=!htmlmath $GOED
	antwoord=!append line <li>$(som$p) <font size="+1">=</font> $htmlgoed</li> to $antwoord
    !next p
!endif

!if $R=2
    wims_rawmath_variables=$letter1
    varcnt=1
    getallen=2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
    getallen=!shuffle $getallen
    
    !for p=1 to $aantal_vragen
	keuze=!randitem 1,2,3
        getal1=!item $p of $getallen
        getal2=!item $[$p + 1] of $getallen
        mp=!randitem +,-
        pm=!randitem +,-
	!if $keuze=1
	    vraag=($letter1 $pm $getal1)*($letter1 $mp $getal2)
	!endif
	!if $keuze=2
	    vraag=($letter1 $pm $getal1)*($getal2 $mp $letter1)
	!endif
	!if $keuze=3
	    getal3=!randitem 2,3,4
	    getal4=!randitem 2,3,4
	    vraag=($getal3*$letter1 $pm $getal1)*($getal2 $mp $letter1)
	!endif
	controle=!append item $vraag to $controle
	som$p=!htmlmath $vraag
	GOED=!exec pari $vraag
	GOED$n=!append item $GOED to $(GOED$n)
	htmlgoed=!htmlmath $GOED
	antwoord=!append line <li>$(som$p) <font size="+1">=</font> $htmlgoed</li> to $antwoord
    !next p
!endif

!if $R=3
    getal=!randitem -2,-3,2,3
    getallen=2,3,4,5,6,7,8,9,10,11,12,13
    getallen=!shuffle $getallen
    keuze=!randitem 1,2
    !for p=1 to $aantal_vragen
	pm=!randitem +,-
	mp=!randitem +,-
	getal1=!item $p of $getallen
	getal2=!item $[$p + 1] of $getallen
	wims_rawmath_variables=$letter1
	varcnt=1
	!if $keuze=1
	    vraag=$letter1*($letter1 $pm $getal1)*($letter1 $mp $getal2)
	!else
	    vraag=$getal*$letter1*($getal1 $pm $letter1)*($getal2 $mp $letter1)
	!endif
	controle=!append item $vraag to $controle
    	som$p=!htmlmath $vraag
    	GOED=!exec pari $vraag
	GOED$n=!append item $GOED to $(GOED$n)
	htmlgoed=!htmlmath  $GOED
	antwoord=!append line  <li>$(som$p) <font size="+1">=</font> $htmlgoed</li> to $antwoord
    !next
!endif

!if $R>3
#bolleboosjes
    getallen=2,3,4,5,6,7,8,9,10,11,12,13
    getallen=!shuffle $getallen
    keuze=!randitem 1,2,3
    !for p=1 to $aantal_vragen
	pm=!randitem +,-
	mp=!randitem +,-
	getal1=!item $p of $getallen
	getal2=!item $[$p + 1] of $getallen
	getal3=!item $[$p + 1] of $getallen
	wims_rawmath_variables=$letter1,$letter2
	varcnt=2
	!if $keuze=1
	    vraag=$letter1*($getal1*$letter1^$getal3 $pm $getal2*$letter2)
	!endif
	!if $keuze=2
	    vraag=$letter1^$getal1*($letter2^$getal2 $pm $letter1^$getal3)
	!endif
	!if $keuze=3
	    vraag=$letter1*($letter2 $pm $getal1)*($getal2 $mp $letter1)
	!endif
	controle=!append item $vraag to $controle
    	som$p=!htmlmath $vraag
    	GOED=!exec pari $vraag
	GOED$n=!append item $GOED to $(GOED$n)
	htmlgoed=!htmlmath  $GOED
	antwoord=!append line  <li>$(som$p) <font size="+1">=</font> $htmlgoed</li> to $antwoord
    !next p
!endif

PLAATJE=0
!if $taal=nl
    nivo_title=Schrijf zo eenvoudig mogelijk zonder Haken:<br> werk de haakjes weg.	
    somtekst$n=Vul in en schrijf zonder Haakjes.
    antwoord$n=<table width="100%"><td><p align="left"><ol>$antwoord</ol></p></td></table>
    hint=Geen hints bij deze som<br>Zie voor syntax de help-pagina
!else
    nivo_title=Simplify and write without brackets..	
    somtekst$n=Fill in and  write without brackets.
    antwoord$n=<table width="100%"><td><p align="left"><ol>$antwoord</ol></p></td></table>
    hint=No hints : look into the help-pages.
!endif    