In PGML, I like the way it looks when you do something like this:
BEGIN_PGML
[________]*{Matrix([[1],[1],[1]])}
END_PGML
I would like to do exactly this but with a custom answer checker. My goal is to have the input interface look the way it does with the line above, but I want to check the student inputs $s1, $s2, $s3 and see if they satisfy an equation like x + 2y + z = 3. I included a minimal version of my attempt below. The problem is that when I try to use a custom answer checker, I only get one box instead of three boxes nicely stacked between brackets.
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGcourse.pl",
"contextFraction.pl",
"PGML.pl",
"MathObjects.pl",
"parserPopUp.pl",
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
Context("Matrix");
$a = random(-9, 9);
$b = random(-9, 9);
$c = random(-9, 9);
$cmp2 = Matrix([[1],[1],[1]])->cmp(
showCoordinateHints => 0,
checker => sub {
my ($correct,$student,$ansHash) = @_;
my @s = @{$student};
my $s0 = Matrix($s[0]);
return ($s0[0][1] + $a*$s0[1][0] + $b*$s0[2][0] == $c ? 1 : 0);
}
);
# Below, I want the line [________]*{$cmp2} to display like the line after it does.
BEGIN_PGML
[________]*{$cmp2}
[________]*{Matrix([[1],[1],[1]])}
END_PGML
ENDDOCUMENT();