Skip to content

Commit

Permalink
Make primeFactorization also take a * (fix Khan#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiebits committed Jul 23, 2011
1 parent b07bfad commit 7f50763
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions utils/answer-types.js
Expand Up @@ -24,7 +24,7 @@ jQuery.extend( Khan.answerTypes, {
input.val() :
fallback ?
fallback + "" :
""
"";

ret.guess = val;

Expand Down Expand Up @@ -54,7 +54,7 @@ jQuery.extend( Khan.answerTypes, {
}
guess = jQuery.trim( guess.substring( 0, guess.length - 1) );
return Khan.answerTypes.decimalVerifier( correct, guess );
}
};

return Khan.answerTypes.text( solutionarea, solution, fallback, verifier );
},
Expand Down Expand Up @@ -335,9 +335,10 @@ jQuery.extend( Khan.answerTypes, {
primeFactorization: function( solutionarea, solution, fallback ) {
var verifier = function( correct, guess ) {
guess = guess.split(" ").join("").toLowerCase();
guess = KhanUtil.sortNumbers( guess.split( "x" ) ).join( "x" );
guess = KhanUtil.sortNumbers( guess.split( /x|\*/ ) ).join( "x" );
return guess === correct;
}
};

return Khan.answerTypes.text( solutionarea, solution, fallback, verifier );
}
} );

0 comments on commit 7f50763

Please sign in to comment.