Any Answer is Marked Correct

Shows how to implement any answer marked correct.

Complete Code

Download file: AnyAnswerMarkedCorrect.pg

PG problem file

Explanation

DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'PGcourse.pl');

Preamble

We need to include the macros file unionTables.pl

$a = Compute(random(2, 9, 1));

$ans = $a->cmp(checker => sub { return 1; });

Setup

We wrap the random command with a Compute to make $a a MathObject.

The checker then returns 1 which will make any answer correct.

BEGIN_PGML
Enter anything, e. g. [`[$a] `] and it will be marked correct: [__]{$ans}
END_PGML

Statement

This is the problem statement in PGML.
BEGIN_PGML_SOLUTION
Solution explanation goes here.
END_PGML_SOLUTION

ENDDOCUMENT();

Solution

A solution should be provided here.