This content has been marked as final. Show 4 replies
i possibly do not understand the issue, but it seems straight-forward. to simplify terminology i'm going to refer to the textfield in the ith row and jth column as tij (where you have 3 columns and 4 rows).
1. the number in t11 can be either of two smaller numbers. then the number in t12 must be the other smaller number and t13 must be the largest: 1 point.
2. the number in t21 must be the number in t12, t22 must be t11 and t23 must be the same as t13: 2 points unless they claim this is s stupid waste-of-time question because addition is a commutative property of real numbers, in which case they get 1 point plus 10 bonus points.
3. the number in t31 must be the largest and t32 can be either of the two smaller and t33 must be the other non-largest number: 1 pt.
4. t41 must be the same as t31, t42 must be t33 and t43 must be t32: 1 point but if they complain, at all, and even mention something about subtraction being a commutative property they lose 11 points and have to wash the teachers car once per week for 6 weeks.
now, as for that dotProduct. me being a smart(alec) kid (and assuming i know you're using something crazy like that dotProduct to score my answers), i'm going to enter 12, 12 ,12 for all 4 rows and get the highest score in the class: teacher must wash my car once per week for 6 weeks.
Thanks I think that helps me figure it out a different way to look at it. However I'm not just checking that they have done the math correctly but that they have done the math correctly for the three numbers I've given them. So that is still an awful lot of if/elses.
I'm still liking the dot product thing. Maybe I didn't explain what I'm doing with that.
I have the correct answer matrix/vector, I dot product their answer and the correct answer then normalize that by dividing by that part in the code shown there. In theory it should return 1 if they are the same and something else if they aren't. So far my testing shows it works. I was worried that it might not scale – say I typed in a vector that was a scalar of the other. But that wasn't 1 either so it seems to work.
So all the twelves wouldn't work, but any 1st grader who doesn't know how to add, but does know what a dot product is – well – they do get a lot of points. (I'm not sure they will have a car.)
Oh as for 2, that is part of the point. We are introducing the idea of the commutative property!
BTW, your answer is really quite funny.
if you're taking the dotproduct of the correct answer and their answer, the maximum ( = 1) will only occur if their answer is the same as the correct answer or is a multiple of the correct answer (and i assume a multiple would violate some other checking that you're doing).
so, you could check if one of their two answers has a dotproduct of 1 and you could check if the dotproduct of both their answers matches the dotproduct you would expect.
but that does seem a bit round-about and you still must be doing some other checking that they are using the right trio of numbers. so you may as well check their answers directly.