A Partial success with a working model.
By comparing strings passed from an embedded GeoGebra applet to WeBWorK we were able to use a customized answer checker to solve our problem. To review: An embedded GeoGebra applet prompts students to click and drag 13 coordinate points for vertical placement for a connected line plot that approximates the sketch of the derivative overlaid a graph of the parent function. The string that is passed from GeoGebra is an accuracy score with an affixed percentage (for example 73%). The passed string has its percentage stripped within the custom answer checker which permits the remaining integer to be evaluated within a series of intervals that return comments and appropriate scores to the student.
We recognize that there is probably a more elegant way to create such a problem. But we could not get numeric values to pass from GeoGebra with any success and have settled on this stripped string custom answer checker.
Our Questions:
1.) Is there a way to pass numeric values from GeoGebra and assign them to a WeBWorK variable? We have not found any way to manage this.
2.) We would like to have greater control of the resulting score passed from GeoGebra to WeBWorK such that a score of 78% achieved in the applet is awarded 78% of the possible points in WeBWorK. Currently that 78% is rounded up to next multiple of 5 at 80% with our custom answer checker. Short of writing 100 individual answer checkers, is there a way to accomplish this?
3.) Sadly we could not work our way around the overlapping text issue that resulted from the latest version of GeoGebra. We try to use Mike Gage’s hot fix #354 but were not successful. How are the corrective lines below to be used? Is it not in the problem itself?
We are ww subscribers if this matters.
hot fix #354:
<div class = “enclose_geogebra_object”>
<div class = “geogebra_object”>
<script language=”javascript”>
…
</div>
</div>
Any feedback is most appreciated!
Tim
## This Homework problem uses an embedded GeoGebra applet
## that prompts the student to manipulate the vertical placement
## of 13 coordinate points in order to approximate the sketch of the
## derivative for a given graph of a function.
## The GeoGebra applet "scores" the student's attempt and this score
## must be passed back as a score to the WEBWorK answer checker.
## The GeoGebra applet was written by Professor Marc Renault and used here
## with permission. Check out his website for this and other GeoGebra applets
## related to first year Calculus courses:
## http://webspace.ship.edu/msrenault/GeoGebraCalculus/derivative_try_to_graph.html
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGinfo.pl",
"unionTables.pl",
"AppletObjects.pl",
"contextArbitraryString.pl",
"answerHints.pl",
"PGcourse.pl",
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
Context("Numeric");
#################################
# Only a "correct" answer variable is declared as a string
# for comparison for the upper threshold of
# " > 95%" for a variable declaration
#################################
Context("ArbitraryString");
$cor ="> 95%"; # Accuracy above 95% is awarded 100%
Context("Numeric");
######################################
# Create link to applet:
###################################
# You can name your applet (anything reasonable :-) )
# Adjust the height and width as desired
# Paste the geogebra parameters in at the bottom of the page just above the
# command end command
# so that they don't get in the way
###################################
$appletName = "numberTest";
$applet = GeogebraWebApplet(
code => "geogebra.GeoGebraApplet",
archive => "geogebra.jar",
codebase => findAppletCodebase("geogebra.jar"),
appletName => $appletName,
appletId => $appletName,
submitActionAlias => 'getAppletValues', # default actionAlias
initializeActionAlias => '', # default actionAlias
setStateAlias => 'setXML',
getStateAlias => 'getXML',
setConfigAlias => '',
getConfigAlias => '',
returnFieldName => '',
width => 700, # may want to modify width
height => 300, # may want to modify height
# mayscript => "true",
debugMode => 0, # set debugMode to 0 for no debug
# to 1 to make xml representation visible
# to 2 to add alerts detailing progression
# through the applet
onInit => 'ggbOnInit',
type => 'geogebraweb',
# "submitActionScript" takes the student submission in a geogebra applet
# and passes it to webwork: getQE() is a webwork call for geogebra submission?
# A general case of retrieving all values() vs the specific cases "a" and "b"
# is shown below. The specific cases are commented out.
submitActionScript => qq{ getQE('answerBox').value = getAppletValues() },
#submitActionScript => qq{ getQE('answerBox').value = applet.getValue("a") },
#submitActionScript => qq{ getQE('answerBox').value = applet.getValue("b") },
selfLoading => 1,
params => GEOGEBRA_PARAMS(), # paste parameters in
);
#######################################################
# For setting initial values in GeoGebra from WeBWorK
# Uses JavaScript interface to GeoGebra.
# hotfix #354 via Mike Gage addressing the overlapping text
# with WeBWorK submission buttons was attempted and disgarded below.
# Affixed protective <div>s to prevent overlapping text, could not be fixed
#############################################################
TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function setAppletCoefficients() {
var applet=getApplet("$appletName"); // alert("Updating coefficients");
if (typeof(applet)!="undefined") {
if (typeof(applet.setValue)!="undefined") {
////////////////////////////////////////////////////////////////
/* List the values of the parameters to be set in the applet here:
One could assign the commented values of "a" and "b" in GeoGebra
to the WeBWorK variables $a & $b here. But this problem passes nothing
from ww to ggb as it relies upon the student's manipulation of the applet
and the resulting score to be passed back to WeBWorK. The commented examples
below are just kept as a reference for future problems...
*/
// applet.setValue("a", $a);
// applet.setValue("b", $b);
// applet.setCoords("C", $a, $b);
} else {
setTimeout("setAppletCoefficients()", 1000);
}
} else {
setTimeout("setAppletCoefficients()",1000);
}
}
ww_applet_list["$appletName"].setConfig = function() {setAppletCoefficients()};
</script>
END_SCRIPT
##################################
# Setup GeogebraWebApplet --
###################################
HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function ggbOnInit(param) {
var applet = document.$appletName;
if (param == "$appletName") {
applet_loaded(param,1); // report that applet is ready.
ww_applet_list[param].safe_applet_initialize(2);
ww_applet_list[param].object = param;
console.log("ggbOnInit: ww_applet_list["+param+"].object = ", ww_applet_list[param].object );
}
}
</script>
END_SCRIPT
HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function setConfig() {
var appletState = getQE('${appletName}_state').value;
if (ww_applet_list['$appletName'].object == undefined ) {
setTimeout("setConfig()", 5000);
console.log("waiting");
} else {
var applet=$appletName;
}
}
</script>
END_SCRIPT
HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );
<script language="javascript">
function getAppletValues() {
console.log("getAppletValues() entered");
// get a handle for the applet object
var applet = $appletName;
var D = applet.getValueString("text1"); // from ggb, accuracy to ww
/* The getQE ("Get Question Element") places the GeoGebra value in a
ww answer box as long as the supporting code is there to support the
box entry. But here we want the box to be invisible and for ggb to pass
the accuracy score to ww for comparison.
*/
// getQE('D').value = applet.getValueString("text1"); //Send value to ww
return(D); // Needed for ww to receive value D from ggb
}
</script>
END_SCRIPT
###################################
#insert applet into body -- this does not need to be changed
# except to adjust the insertion of the reinitialize_button or
# a hidden AnswerBox
###################################
TEXT($PAR, MODES(TeX=>'geogebraweb code',
HTML=>$applet->insertAll(
debug =>0,
reinitialize_button => 1,
includeAnswerBox=>1,
)));
#######################################
# TEXT
#######################################
#$ans7 =~ s/%/ppp/;
#$dum =~ s/ %//;
#$dum =~ s/> //;
#$ans6=~'answerBox';
Context()->texStrings;
BEGIN_TEXT
$BR
$BR
$BR
$BR
$BR
$BR Click and drag each purple coordinate point to make a sketch of the
$BR derivative based upon the slope of the parent function in black.
$BR Use the slider to determine the slope of the tangent line
$BR as an aid to approximate the sketch of the derivative.
$BR
END_TEXT
#########################################
# ANSWER section
## This answer checker takes ggb string 'D' as $s, "student input"
## and compares it to a ww string ($cor) after a strip ( a search and replace)
## of the non-numeric symbols of "%", ">", and " ". The stripped ww string "$cor"
## is assigned to "$c" for "correct", from ww.
## The PostFilter answer hint permits the stripped strings
## to be evaluated as Numeric intervals for Student feedback and scoring...
###############################################################
Context("ArbitraryString");
NAMED_ANS( 'answerBox' => String($cor)->cmp->withPostFilter(AnswerHints(
sub {
my( $c, $s, $self) =@_;
$c =~ s/> //; ## Stripping "> " of "> 95%", leaving "95%"
$c =~ s/%//; ## Stripping "%" of "95%", leaving "95"
$s =~ s/%//; ## Stripping "%" of the student accuracy, leaving an integer
return (($s >= 0) && ($s <= 50)); } => ["Oh no! You must score more than 50%, for any credit. Try again.", score => 0],
sub {
my( $c, $s, $self) =@_;
$c =~ s/> //;
$c =~ s/%//;
$s =~ s/%//;
return (($s > 50) && ($s <= 60)); } => ["You could do better with another attempt, yes?", score => 0.60],
sub {
my( $c, $s, $self) =@_;
$c =~ s/> //;
$c =~ s/%//;
$s =~ s/%//;
return (($s > 60) && ($s <= 70)); } => ["Try again. You can manage better than this.", score => 0.70],
sub {
my( $c, $s, $self) =@_;
$c =~ s/> //;
$c =~ s/%//;
$s =~ s/%//;
return (($s > 70) && ($s <= 75)); } => ["This is okay, But you could do better, yes?", score => 0.75],
sub {
my( $c, $s, $self) =@_;
$c =~ s/> //;
$c =~ s/%//;
$s =~ s/%//;
return (($s > 75) && ($s <= 80)); } => ["You are getting better, Try another?", score => 0.80],
sub {
my( $c, $s, $self) =@_;
$c =~ s/> //;
$c =~ s/%//;
$s =~ s/%//;
return (($s > 80) && ($s <= 85)); } => ["Nice Work!", score => 0.85],
sub {
my( $c, $s, $self) =@_;
$c =~ s/> //;
$c =~ s/%//;
$s =~ s/%//;
return (($s > 85) && ($s <= 90)); } => ["Very Good!", score => 0.90],
sub {
my( $c, $s, $self) =@_;
$c =~ s/> //;
$c =~ s/%//;
$s =~ s/%//;
return (($s > 90) && ($s <= 95)); } => ["Excellent!", score => 0.95],
sub {
my( $c, $s, $self) =@_;
$c =~ s/> //;
$c =~ s/%//;
$s =~ s/%//;
return $s > $c; } => ["Perfect!", score => 1],
)));
#######################################
sub GEOGEBRA_PARAMS {
my $result = {
showResetIcon=>"false" ,
enableRightClick=>"false" ,
enableLabelDrags=>"false",
showMenuBar=>"false" ,
showToolBar=>"false",
showAlgebraInput=>"false",
useBrowserForJS=>"true",
ggbbase64=>"UEsDBBQACAgIALs+3EwAAAAAAAAAAAAAAAAWAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc0srzUsuyczPU0hPT/LP88zLLNHQVKiu5QIAUEsHCEXM3l0aAAAAGAAAAFBLAwQUAAgICAC7PtxMAAAAAAAAAAAAAAAAFwAAAGdlb2dlYnJhX2RlZmF1bHRzMmQueG1s7VrfU9s4EH6+/hUaP909kNiOnQSG0KGdubnOUHpzMJ17VeyNo0ORfJJMHP76yvLPkJgGB0qg5QFrFWklfftpvVr59H26oOgWhCScTSynZ1sIWMBDwqKJlajZ0dh6f/buNAIewVRgNONigdXE8rOWVT8t9byRl9XhOJ5YAcVSksBCMcUq6zKxQguhVJITxi/xAmSMA7gK5rDAFzzAymiZKxWf9PvL5bJXjtfjIupHkeqlUivQc2VyYhWFE61urdNyYJq7tu30//18kas/IkwqzAKwkF5HCDOcUCV1ESgsgCmkVjFMrJjTVcSZhSieAp1Yf5dy0W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NBt2Q9/rFYaMvkv30t/BkGb0ZdXvFcxp+mRZZljXMpWLreRCFF/GfFaGELvTmCaD+PNvkzD+azoUdKjP5fNivR781af6b904ZVWtcr1r3XPQmthglmioiFHsjGP1kCZK3vFklBNhYAwoCS5/7m0mn65mwjQptYllEbhSelJ08RTUncRxwfjo05qNv58x5ywf7j/u7yM3Vo8iy63/palY6lI02QX+h4PBoKt//0Jf+OdI/h7FceE3Lr7+mlQrf3AoAjm/z2iVPx90m7xEkP0SUfpWevoWvDNSs4mq/YsLI1kBdxj6rlPAe16T8q433nd9ffxxPf6Wgl/Uw58sZ9MfFipN2lUojmW2zA1bT41JSY2Lyqv1OdXg/2igwiu3sC+osPVqGlzvHqmHirUfZK5p6VgJojvtjd1DX+WvssROMJBQRHImRQ5w+lOC1BpAsQZOx+uZusVAMaKAMipA7Rd/sUaep7/T+vP/A1BLBwiL9GTUQRAAAHN2AABQSwECFAAUAAgICAC7PtxMRczeXRoAAAAYAAAAFgAAAAAAAAAAAAAAAAAAAAAAZ2VvZ2VicmFfamF2YXNjcmlwdC5qc1BLAQIUABQACAgIALs+3EwNUm+18wQAAH4mAAAXAAAAAAAAAAAAAAAAAF4AAABnZW9nZWJyYV9kZWZhdWx0czJkLnhtbFBLAQIUABQACAgIALs+3ExtBS/Q3gIAAAgNAAAXAAAAAAAAAAAAAAAAAJYFAABnZW9nZWJyYV9kZWZhdWx0czNkLnhtbFBLAQIUABQACAgIALs+3EyL9GTUQRAAAHN2AAAMAAAAAAAAAAAAAAAAALkIAABnZW9nZWJyYS54bWxQSwUGAAAAAAQABAAIAQAANBkAAAAA"
};
$result;
}
ENDDOCUMENT();
Re: Passing GeoGebra values to WeBWorK as "correct" answers?
by Michael Gage -D = D.match(/\d+/);
return(D);
NAMED_ANS( 'answerBox' => String($cor)->cmp( checker=>sub {
my( $c, $s, $self) =@_;
$c =~ s/> //; ## Stripping "> " of "> 95%", leaving "95%"
$c =~ s/%//; ## Stripping "%" of "95%", leaving "95"
#$s =~ s/%//; ## Stripping "%" of the student accuracy, leaving an integer
$s1 = Real("$s");
return $s1 > $c; # returns 1 or 0
})); I'm not sure whether the Real() operator is needed there. You can also add messages as you did in an earlier example.
Re: Passing GeoGebra values to WeBWorK as "correct" answers?
by tim Payer -Re: Passing GeoGebra values to WeBWorK as "correct" answers?
by Andrew Parker -TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );<script language="javascript">function setAppletCoefficients() {var applet=getApplet("$appletName"); // alert("Updating coefficients");if (typeof(applet)!="undefined") {if (typeof(applet.setValue)!="undefined") {////////////////////////////////////////////////////////////////// List the values of the parameters to be set in the applet here// Replace the randomization on-load of the appletapplet.evalCommand("R = (-12, $y[0])");applet.evalCommand("S = (-9, $y[1])");applet.evalCommand("T = (-6, $y[2])");applet.evalCommand("U = (-3, $y[3])");applet.evalCommand("V = (0, $y[4])");applet.evalCommand("W = (3, $y[5])");applet.evalCommand("X = (6, $y[6])");applet.evalCommand("Y = (9, $y[7])");applet.evalCommand("Z = (12, $y[8])");applet.evalCommand('SetVisibleInView[gRes,1,False]');applet.evalCommand('SetVisibleInView[btnReveal,1,True]');} else {setTimeout("setAppletCoefficients()", 1000);}} else {setTimeout("setAppletCoefficients()",1000);}}ww_applet_list["$appletName"].setConfig = function() {setAppletCoefficients()};</script>END_SCRIPT
foreach my $i (0..8) {$y[$i] = random(-2,3,1);}
HEADER_TEXT( MODES(TeX=>'', HTML=><<END_SCRIPT ) );<script language="javascript">function getAppletValues() {console.log("getAppletValues() entered");// get a handle for the applet objectvar applet = $appletName;var accuracy = applet.getValue("accuracy");var isVisible = applet.getVisible("btnReveal",1);return( accuracy + "," + isVisible );}</script>END_SCRIPT
$custom = sub {my ($correct, $student, $self) = @_;my ($acc,$eligible) = split(/,/,$student,2);return ( $eligible eq 'true' && $acc > 95);};
$answer = List(Real(100),String('true'));NAMED_ANS( 'answerBox'=>$answer->cmp(checkTypes=>0, checker=>$custom) );
Context("Numeric");Context()->strings->add('true'=>{}, 'false'=>{});