Pierre BALLANDRAS 3 years ago
commit e6111f4d81

@ -65,13 +65,20 @@ function exec(code, id) {
const runner = new BrythonRunner({
stdout: {
write(content) {
retour.textContent = content;
},
if (id == "code"){
retourCode = content;
}
if (id == "solution"){
retourSolution = content;
}
},
flush() {}
},
stderr: {
write(content) {
retour.textContent = "ERROR";
if (id == "solution"){
retourSolution = "ERROR";
}
terminal.innerHTML += content;
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 check(){
const retourCode = document.getElementById("code").textContent;
const retourSolution = document.getElementById("solution").textContent;
console.log(retourSolution)
console.log(retourCode)
console.log(retourSolution == retourCode)
if (retourSolution == "ERROR") {
result.innerHTML = "Il semblerait qu'il y a une erreur dans ton code :/";
result.classList.remove('hidden');

@ -32,9 +32,6 @@
<textarea id='console' readonly></textarea>
</div>
<p id="code" class="hidden">code</p>
<p id="solution" class="hidden">solution</p>
<script src="https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="https://raw.githack.com/pythonpad/brython-runner/master/lib/brython-runner.bundle.js" type="text/javascript" charset="utf-8"></script>
<script src="../javascript/palindrome.js"></script>

Loading…
Cancel
Save