|
|
@ -65,13 +65,20 @@ function exec(code, id) {
|
|
|
|
const runner = new BrythonRunner({
|
|
|
|
const runner = new BrythonRunner({
|
|
|
|
stdout: {
|
|
|
|
stdout: {
|
|
|
|
write(content) {
|
|
|
|
write(content) {
|
|
|
|
retour.textContent = content;
|
|
|
|
if (id == "code"){
|
|
|
|
|
|
|
|
retourCode = content;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (id == "solution"){
|
|
|
|
|
|
|
|
retourSolution = content;
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
flush() {}
|
|
|
|
flush() {}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
stderr: {
|
|
|
|
stderr: {
|
|
|
|
write(content) {
|
|
|
|
write(content) {
|
|
|
|
retour.textContent = "ERROR";
|
|
|
|
if (id == "solution"){
|
|
|
|
|
|
|
|
retourSolution = "ERROR";
|
|
|
|
|
|
|
|
}
|
|
|
|
terminal.innerHTML += content;
|
|
|
|
terminal.innerHTML += content;
|
|
|
|
terminal.scrollTop = terminal.scrollHeight;
|
|
|
|
terminal.scrollTop = terminal.scrollHeight;
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -93,8 +100,9 @@ function exec(code, id) {
|
|
|
|
//~ Function that check if the code in the editor as the same result as the solution.
|
|
|
|
//~ Function that check if the code in the editor as the same result as the solution.
|
|
|
|
|
|
|
|
|
|
|
|
function check(){
|
|
|
|
function check(){
|
|
|
|
const retourCode = document.getElementById("code").textContent;
|
|
|
|
console.log(retourSolution)
|
|
|
|
const retourSolution = document.getElementById("solution").textContent;
|
|
|
|
console.log(retourCode)
|
|
|
|
|
|
|
|
console.log(retourSolution == retourCode)
|
|
|
|
if (retourSolution == "ERROR") {
|
|
|
|
if (retourSolution == "ERROR") {
|
|
|
|
result.innerHTML = "Il semblerait qu'il y a une erreur dans ton code :/";
|
|
|
|
result.innerHTML = "Il semblerait qu'il y a une erreur dans ton code :/";
|
|
|
|
result.classList.remove('hidden');
|
|
|
|
result.classList.remove('hidden');
|
|
|
|