Skip to content

Instantly share code, notes, and snippets.

@BillFoster
Created January 19, 2012 10:10
Show Gist options
  • Save BillFoster/1639215 to your computer and use it in GitHub Desktop.
Save BillFoster/1639215 to your computer and use it in GitHub Desktop.
string restrictions and pattern matching
Here is a question gapfill part on prime factorisation, pi primes, ei their exponents.
Awful business trapping student input.
So much better if there were restrictions that said that the primes (without 0 exponent) had to be present in the answer.
gaps: [
{type: jme
answer: "{p1}^{e1}*{p2}^{e2}*{p3}^{e3}*{p5}^{e5}"
answersimplification:"unitPower,zeroPower,unitFactor"
musthave:{
strings:[*,^]
message:"split into factors, each factor a power of a prime number and include the multiplication sign * between the factors "
}
notallowed:{
strings:["1^","1*",*1",/,"-","^0"]
message: "split into factors, each factor a power of a prime number and include the multiplication sign * between the factors"
}
minlength:{length:11}
marks:1
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment