Adding javascriptresponse. This responsetype is a framework for problems that are entirely controlled by javascript and graded by Node.js on the server.
This commit is contained in:
21
common/lib/capa/capa/javascript_problem_grader.js
Normal file
21
common/lib/capa/capa/javascript_problem_grader.js
Normal file
@@ -0,0 +1,21 @@
|
||||
var importAll = function (modulePath) {
|
||||
module = require(modulePath);
|
||||
for(key in module){
|
||||
global[key] = module[key];
|
||||
}
|
||||
}
|
||||
|
||||
importAll("xproblem");
|
||||
importAll("minimax.js");
|
||||
|
||||
graderModulePath = process.argv[2];
|
||||
submission = JSON.parse(process.argv[3]);
|
||||
problemState = JSON.parse(process.argv[4]);
|
||||
params = JSON.parse(process.argv[5]);
|
||||
|
||||
graderModule = require(graderModulePath);
|
||||
graderClass = graderModule.graderClass;
|
||||
grader = new graderClass(submission, problemState, params);
|
||||
console.log(JSON.stringify(grader.grade()));
|
||||
console.log(JSON.stringify(grader.evaluation));
|
||||
console.log(JSON.stringify(grader.solution));
|
||||
Reference in New Issue
Block a user