diff --git a/brythonRunner/javascript/palindrome.js b/brythonRunner/javascript/palindrome.js index 3751b973..ba76c856 100644 --- a/brythonRunner/javascript/palindrome.js +++ b/brythonRunner/javascript/palindrome.js @@ -1,3 +1,7 @@ +function Abort() +{ + throw new Error('This is not an error. This is just to abort javascript'); +} function run() { const console = document.getElementById("console"); @@ -34,13 +38,13 @@ function run_init() { if (document.getElementById("console") != '') { document.getElementById("console").innerHTML = ''; run(); - // setTimeout(() => {console.log("Resolve while pb")}, 1000); - // setTimeout(() => {location.reload();}, 1000); + //setTimeout(() => {console.log("Resolve while pb")}, 1000); + //setTimeout(() => {Abort()}, 5000); } else { run(); - // setTimeout(() => {console.log("Resolve while pb")}, 1000); - // setTimeout(() => {location.reload();}, 1000); + //setTimeout(() => {console.log("Resolve while pb")}, 1000); + //setTimeout(() => {Abort()}, 5000); } } @@ -100,9 +104,6 @@ function exec(code, id) { //~ Function that check if the code in the editor as the same result as the solution. function check(){ - 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'); @@ -130,12 +131,19 @@ def estPalindromeVerif(var): return False def testPalindrome(x): + l=[1,2,3,2,1] + if(estPalindrome(l)==False): + return False + l=[9,5,7,7,9] + if(estPalindrome(l)==True): + return False l=[] for i in range(x): - for j in range(r.randint(1,10)): - l.append(r.randint(0,9)) - if(estPalindrome(l)!=estPalindromeVerif(l)): - return False + for j in range(r.randint(1,10)): + l.append(r.randint(0,9)) + if(estPalindromeVerif(l)!=estPalindrome(l)): + return False + l=[] return True print(testPalindrome(5))