Shows the use of the randomNamesPronouns.pl macro
Download file: RandomPerson.pg
DOCUMENT(); loadMacros('PGstandard.pl', 'PGML.pl', 'randomPerson.pl', 'PGcourse.pl');
Preamble
We need to load randomPerson.pl
macro
($p1, $p2, $p3) = randomPerson(n => 3); $n = random(20, 30, 2); $c = random(4, 8, 2);
Setup
The macro randomPerson.pl
provides functionality to
The randomPerson(n => 3)
subroutine selects 3 unique random persons.
See the randomNamesPronouns.pl
POD for more information and example.
BEGIN_PGML [$p1] has a ribbon of length [$n] cm. [$p1->Subject] [$p1->verb('cut')] [$c] cm off the ribbon and [$p1->verb('give')] the piece to [$p1->possessive] friend [$p2]. [$p1] then [$p1->verb('divide')] the rest in half and [$p1->verb('give')] half to [$p1->possessive] friend [$p3]. How much ribbon [$p1->do] [$p1] have left? [___]{Real(($n-$c)/2)} END_PGML
Statement
The objects $p1, $p2
and $p3
are Person
objects and we can call the methods for name, and the pronouns subject, possessive, possession
and object
as well as the capitalized versions of each of these. In addition, there is a verb
method to conjugate most verbs as well as some irregular ones, like do
which returns the correct conjugation of “to do”.
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT();
Solution
A solution should be provided here.