madlabsinc / teachcode

A tool to develop and improve a student’s programming skills by introducing the earliest lessons of coding.
https://teachcode.surge.sh
GNU General Public License v3.0
387 stars 65 forks source link

[Feature Request]: A better approach in validating solutions #55

Open rishabhKalakoti opened 4 years ago

rishabhKalakoti commented 4 years ago

Problem If we give such a solution for task 4 of JS,

console.log('33\n14\nJS\n Hey, this is Task 4 of Python Path!\n Hey, this is Task 4 of Python Path! !\n Hey, this is Task 4 of Python Path! !');

the current program will consider it as the correct solution. But the user manually solved the problem and just printed the answer he got without using the language constructs.

Proposed solution The user can operate on a set of unknown test cases which will be taken as input or passed to a predefined function as arguments and the user needs to. Eg:

function task1(arg) {
    // user needs to do the task on the given argument (arg) and return the output
}

We can give multiple values of arg as testcases

Additional context The current program is correct as long as the user honestly does the tasks. And adding the test cases will also be an additional work added on top of editing the program. Also, the user will need to understand the basic I/O before attempting the tasks. So the priority of this issue might be kept low for these reasons.

Open to discussion.