Compare commits

..

2 Commits

Author SHA1 Message Date
Noé GARNIER 35e2258830 Mise à jour de 'View/src/pages/Multijoueur/Partie.php'
continuous-integration/drone/push Build encountered an error Details
2 years ago
Noé GARNIER eadf6e51f1 Changement dédié au servuer de test
continuous-integration/drone/push Build encountered an error Details
2 years ago

@ -1,6 +1,6 @@
// const url = "http://localhost/Scripted/index.php"; // const url = "http://localhost/Scripted/index.php";
// const url = "http://82.165.180.114/Scripted/index.php"; const url = "http://82.165.180.114/Scripted/index.php";
const url = "http://sancy.iut.uca.fr/~lafourcade/Scripted/index.php"; // const url = "http://sancy.iut.uca.fr/~lafourcade/Scripted/index.php";
function run() { function run() {
const terminal = document.getElementById("console"); const terminal = document.getElementById("console");

@ -1,6 +1,6 @@
// const url = "http://localhost/Scripted/index.php"; // const url = "http://localhost/Scripted/index.php";
// const url = "http://82.165.180.114/Scripted/index.php"; const url = "http://82.165.180.114/Scripted/index.php";
const url = "http://sancy.iut.uca.fr/~lafourcade/Scripted/index.php"; // const url = "http://sancy.iut.uca.fr/~lafourcade/Scripted/index.php";
function run() { function run() {
const terminal = document.getElementById("console"); const terminal = document.getElementById("console");

@ -175,17 +175,17 @@
<!-- Multijoueur --> <!-- Multijoueur -->
<div class="row m-0 pt-4 pb-5 d-flex justify-content-center text-center"> <div class="row m-0 pt-4 pb-5 d-flex justify-content-center text-center">
<!-- <a class="cssbuttons-io" <a class="cssbuttons-io"
<?php <?php
// if (isset($_SESSION['role']) && $_SESSION['role'] == 'user' || isset($_SESSION['role']) && $_SESSION['role'] == 'admin'){ if (isset($_SESSION['role']) && $_SESSION['role'] == 'user' || isset($_SESSION['role']) && $_SESSION['role'] == 'admin'){
// echo 'href="index.php?action=goToLobby"'; echo 'href="index.php?action=goToLobby"';
// } }
// else{ else{
// echo 'href="index.php?action=goToLogin"'; echo 'href="index.php?action=goToLogin"';
// } }
?> ?>
id="btn-2"> --> id="btn-2">
<!-- <span> <span>
<svg fill="currentColor" height="200px" width="200px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 468.493 468.493" xml:space="preserve"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_iconCarrier"> <g> <svg fill="currentColor" height="200px" width="200px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 468.493 468.493" xml:space="preserve"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_iconCarrier"> <g>
<path d="M138.321,161.831h-17.437v-17.437c0-3.615-2.287-6.835-5.701-8.026c-5.319-1.855-10.904-2.796-16.6-2.796 c-5.696,0-11.281,0.941-16.6,2.796c-3.414,1.191-5.701,4.411-5.701,8.026v17.437H58.847c-3.615,0-6.834,2.287-8.025,5.7 c-1.856,5.318-2.797,10.904-2.797,16.601s0.941,11.283,2.797,16.601c1.191,3.413,4.411,5.699,8.025,5.699h17.437v17.437 c0,3.615,2.287,6.834,5.7,8.025c5.318,1.856,10.904,2.797,16.601,2.797c5.697,0,11.283-0.941,16.601-2.797 c3.413-1.191,5.7-4.41,5.7-8.025v-17.437h17.437c3.615,0,6.835-2.287,8.026-5.7c1.855-5.318,2.796-10.903,2.796-16.6 c0-5.696-0.941-11.281-2.796-16.6C145.156,164.118,141.937,161.831,138.321,161.831z M131.729,189.432h-19.344 c-4.694,0-8.5,3.806-8.5,8.5v19.344c-3.481,0.553-7.12,0.552-10.601,0v-19.344c0-4.694-3.806-8.5-8.5-8.5H65.44 c-0.276-1.741-0.415-3.511-0.415-5.3s0.139-3.56,0.415-5.301h19.344c4.694,0,8.5-3.806,8.5-8.5v-19.343 c3.482-0.553,7.12-0.553,10.601,0v19.343c0,4.694,3.806,8.5,8.5,8.5h19.343c0.276,1.741,0.415,3.511,0.415,5.301 C132.143,185.921,132.004,187.692,131.729,189.432z"></path> <path d="M138.321,161.831h-17.437v-17.437c0-3.615-2.287-6.835-5.701-8.026c-5.319-1.855-10.904-2.796-16.6-2.796 c-5.696,0-11.281,0.941-16.6,2.796c-3.414,1.191-5.701,4.411-5.701,8.026v17.437H58.847c-3.615,0-6.834,2.287-8.025,5.7 c-1.856,5.318-2.797,10.904-2.797,16.601s0.941,11.283,2.797,16.601c1.191,3.413,4.411,5.699,8.025,5.699h17.437v17.437 c0,3.615,2.287,6.834,5.7,8.025c5.318,1.856,10.904,2.797,16.601,2.797c5.697,0,11.283-0.941,16.601-2.797 c3.413-1.191,5.7-4.41,5.7-8.025v-17.437h17.437c3.615,0,6.835-2.287,8.026-5.7c1.855-5.318,2.796-10.903,2.796-16.6 c0-5.696-0.941-11.281-2.796-16.6C145.156,164.118,141.937,161.831,138.321,161.831z M131.729,189.432h-19.344 c-4.694,0-8.5,3.806-8.5,8.5v19.344c-3.481,0.553-7.12,0.552-10.601,0v-19.344c0-4.694-3.806-8.5-8.5-8.5H65.44 c-0.276-1.741-0.415-3.511-0.415-5.3s0.139-3.56,0.415-5.301h19.344c4.694,0,8.5-3.806,8.5-8.5v-19.343 c3.482-0.553,7.12-0.553,10.601,0v19.343c0,4.694,3.806,8.5,8.5,8.5h19.343c0.276,1.741,0.415,3.511,0.415,5.301 C132.143,185.921,132.004,187.692,131.729,189.432z"></path>
<path d="M254.329,166.478c0.009,0,0.019,0,0.028,0c7.996-0.009,14.459-6.501,14.44-14.497c-0.02-7.987-6.501-14.449-14.497-14.439 c-7.987,0.019-14.459,6.511-14.439,14.497C239.879,160.025,246.351,166.478,254.329,166.478z"></path> <path d="M254.329,166.478c0.009,0,0.019,0,0.028,0c7.996-0.009,14.459-6.501,14.44-14.497c-0.02-7.987-6.501-14.449-14.497-14.439 c-7.987,0.019-14.459,6.511-14.439,14.497C239.879,160.025,246.351,166.478,254.329,166.478z"></path>
@ -196,7 +196,7 @@
<path d="M379.786,265.546c0.009,0,0.02,0,0.029,0c7.996-0.019,14.459-6.51,14.439-14.497c-0.019-7.996-6.511-14.459-14.497-14.439 c-7.995,0.019-14.458,6.511-14.439,14.497C365.327,259.084,371.81,265.546,379.786,265.546z"></path> </g> </g> <path d="M379.786,265.546c0.009,0,0.02,0,0.029,0c7.996-0.019,14.459-6.51,14.439-14.497c-0.019-7.996-6.511-14.459-14.497-14.439 c-7.995,0.019-14.458,6.511-14.439,14.497C365.327,259.084,371.81,265.546,379.786,265.546z"></path> </g> </g>
</svg> </svg>
ScriptRush ScriptRush
</span> --> </span>
</a> </a>
</div> </div>
</div> </div>

@ -172,9 +172,9 @@
<script src="View/src/JS/baseMulti.js"> <script src="View/src/JS/baseMulti.js">
</script> </script>
<script> <script>
// const URL = "http://localhost/Scripted/index.php"; // const url = "http://localhost/Scripted/index.php";
// const URL = "http://82.165.180.114/Scripted/index.php"; const url = "http://82.165.180.114/Scripted/index.php";
const URL = "http://sancy.iut.uca.fr/~lafourcade/Scripted/index.php"; // const url = "http://sancy.iut.uca.fr/~lafourcade/Scripted/index.php";
function saveCode(index, enigmeId) { function saveCode(index, enigmeId) {
console.log("saveCode"); console.log("saveCode");
var index = '<?php echo $index; ?>'; var index = '<?php echo $index; ?>';

@ -26,7 +26,7 @@ rappel varchar(250),
exemple varchar(250), exemple varchar(250),
solution varchar(250) NOT NULL, solution varchar(250) NOT NULL,
test varchar(250) NOT NULL, test varchar(250) NOT NULL,
ordre integer CHECK (ordre >=0), ordre integer UNIQUE CHECK (ordre >=-1),
tempsDeResolution numeric CHECK (tempsDeResolution >=0), tempsDeResolution numeric CHECK (tempsDeResolution >=0),
points numeric CHECK (points >=0), points numeric CHECK (points >=0),
prompt varchar(250) prompt varchar(250)

@ -16,4 +16,5 @@ INSERT INTO Enigme VALUES(12,'ChuckNorris','Coder un fonction <b style="color: v
INSERT INTO Enigme VALUES(13,'Hanoi',' Écrire une fonction <b style="color: violet;">hanoi</b> permettant de résoudre le problème des <b>tours dhanoi </b> peu importe le nombre d''entrées dans la fonction. <br />Cette fonction devra prend en paramètre le <b style="color: #44fff6;">nombre de disques</b>, le <b style="color: #44fff6;">nom</b> de la tour de départ, le <b style="color: #44fff6;">nom</b> la tour d''arrivée et le <b style="color: #44fff6;">nom</b> la tour intermédiaire. <br /> Elle devra retoure une <b style="color: yellow;">liste</b> contenant les déplacements à effectuer (cf exemple ci-dessous).','Pense à utiliser une fonction récursive pour résoudre ce problème. Pour rappel une fonction récursive est une fonction qui s''appelle elle même. ','Le problème des tours de <b>hanoi</b> est le suivant, on souhaite déplacer un certain nombre de disque de taille différente et ils sont et doivent restés empilés de telle sorte quaucun disque dune certaine taille n soit placé en dessous dun disque de taille plus grande en sachant quil ny a que 3 piles.','<b>Entrée</b> :3,"A","B","C"<br><b>Sortie</b> : [[''A'',''C''],[''A'',''B''],[''C'',''B''],[''A'',''C''],[''B'',''A''],[''B'',''C''],[''A'',''C'']]',replace(replace('def hanoi_rec(l,nb_disks, start, middle, end):\r\n if(nb_disks == 1):\r\n return l.append([start,end])\r\n else:\r\n hanoi_rec(l,nb_disks - 1, start, end, middle)\r\n l.append([start,end])\r\n hanoi_rec(l,nb_disks - 1, middle, start, end)\r\n\r\ndef hanoiVerif(nb_disks,start, middle, end):\r\n l=[]\r\n hanoi_rec(l,nb_disks,start, middle, end)\r\n return l','\r',char(13)),'\n',char(10)),replace(replace('import random as r\r\ndef testhanoi(x):\r\n hanoi(1,"A","B","C")\r\n if(hanoi(3,"A","B","C")!=[[''A'',''C''],[''A'',''B''],[''C'',''B''],[''A'',''C''],[''B'',''A''],[''B'',''C''],[''A'',''C'']]):\r\n return False\r\n for i in range(x):\r\n j=r.randint(1,4)\r\n if(hanoi(j,"Z","E","R")!=hanoiVerif(j,"Z","E","R")):\r\n return False\r\n return True\r\n\r\nprint(testhanoi(5))','\r',char(13)),'\n',char(10)),7,0,0,'def hanoi(nb_disks,start, middle, end):'); INSERT INTO Enigme VALUES(13,'Hanoi',' Écrire une fonction <b style="color: violet;">hanoi</b> permettant de résoudre le problème des <b>tours dhanoi </b> peu importe le nombre d''entrées dans la fonction. <br />Cette fonction devra prend en paramètre le <b style="color: #44fff6;">nombre de disques</b>, le <b style="color: #44fff6;">nom</b> de la tour de départ, le <b style="color: #44fff6;">nom</b> la tour d''arrivée et le <b style="color: #44fff6;">nom</b> la tour intermédiaire. <br /> Elle devra retoure une <b style="color: yellow;">liste</b> contenant les déplacements à effectuer (cf exemple ci-dessous).','Pense à utiliser une fonction récursive pour résoudre ce problème. Pour rappel une fonction récursive est une fonction qui s''appelle elle même. ','Le problème des tours de <b>hanoi</b> est le suivant, on souhaite déplacer un certain nombre de disque de taille différente et ils sont et doivent restés empilés de telle sorte quaucun disque dune certaine taille n soit placé en dessous dun disque de taille plus grande en sachant quil ny a que 3 piles.','<b>Entrée</b> :3,"A","B","C"<br><b>Sortie</b> : [[''A'',''C''],[''A'',''B''],[''C'',''B''],[''A'',''C''],[''B'',''A''],[''B'',''C''],[''A'',''C'']]',replace(replace('def hanoi_rec(l,nb_disks, start, middle, end):\r\n if(nb_disks == 1):\r\n return l.append([start,end])\r\n else:\r\n hanoi_rec(l,nb_disks - 1, start, end, middle)\r\n l.append([start,end])\r\n hanoi_rec(l,nb_disks - 1, middle, start, end)\r\n\r\ndef hanoiVerif(nb_disks,start, middle, end):\r\n l=[]\r\n hanoi_rec(l,nb_disks,start, middle, end)\r\n return l','\r',char(13)),'\n',char(10)),replace(replace('import random as r\r\ndef testhanoi(x):\r\n hanoi(1,"A","B","C")\r\n if(hanoi(3,"A","B","C")!=[[''A'',''C''],[''A'',''B''],[''C'',''B''],[''A'',''C''],[''B'',''A''],[''B'',''C''],[''A'',''C'']]):\r\n return False\r\n for i in range(x):\r\n j=r.randint(1,4)\r\n if(hanoi(j,"Z","E","R")!=hanoiVerif(j,"Z","E","R")):\r\n return False\r\n return True\r\n\r\nprint(testhanoi(5))','\r',char(13)),'\n',char(10)),7,0,0,'def hanoi(nb_disks,start, middle, end):');
INSERT INTO Enigme VALUES(14,'TrianglePascal','Écrire une fonction <b style="color: violet;">triangle_pascal</b> permettant dafficher le <b>triangle de Pascal</b> jusqu''à un certain nombre <b style="color:#44fff6">n</b> de lignes. Bien sùr <b style="color:#44fff6">n</b> sera passé en argument à la fonction. La fonction devra renvoyer une <b style="color: yellow;">liste</b> contenant les lignes du triangle de Pascal. (cf l''exemple pour plus de détails).','Il n''y a pas d''aide pour cette énigme','Le triangle arithmétique de Pascal est le triangle dont la ligne d''indice n (n = 0, 1, 2...) donne les coefficients binomiaux (n) pour p = 0, 1, 2..., n.<br/> La construction de ce triangle de Pascal est simple, on part de 1 à la première ligne, par convention c''est la ligne zéro (n = 0) Pour avoir un terme de la ligne suivante, on prend le terme juste au-dessus, et on lui additionne celui qui est juste avant, (0 si il n''y a rien). Mathématiquement, on applique la formule :<br/> (n+1) = (n) + ( n )','<b>Entrée</b> : 4<br><b>Sortie</b> : [[1],[1,1],[1,2,1],[1,3,3,1]]',replace(replace('def estTriangleDePascal(n):\r\n if(n==0):\r\n return []\r\n if(n==1):\r\n return [[1]]\r\n triangle=[[1],[1, 1]]\r\n columns=n\r\n for line in range(2,n):\r\n triangle.append([1])\r\n for column in range(1, line):\r\n triangle[line].append(triangle[line - 1][column - 1] + triangle[line - 1][column])\r\n triangle[line].append(1)\r\n return triangle','\r',char(13)),'\n',char(10)),replace(replace('import random as r\r\ndef testTriangleDePascal(n):\r\n triangle_pascal(0)\r\n listTest=[0,1]\r\n for i in range(0,n):\r\n listTest.append(r.randint(5,140))\r\n for i in listTest:\r\n if(triangle_pascal(i)!=estTriangleDePascal(i)):\r\n return False\r\n return True\r\n \r\nprint(testTriangleDePascal(5))','\r',char(13)),'\n',char(10)),8,0,0,'def triangle_pascal(n):'); INSERT INTO Enigme VALUES(14,'TrianglePascal','Écrire une fonction <b style="color: violet;">triangle_pascal</b> permettant dafficher le <b>triangle de Pascal</b> jusqu''à un certain nombre <b style="color:#44fff6">n</b> de lignes. Bien sùr <b style="color:#44fff6">n</b> sera passé en argument à la fonction. La fonction devra renvoyer une <b style="color: yellow;">liste</b> contenant les lignes du triangle de Pascal. (cf l''exemple pour plus de détails).','Il n''y a pas d''aide pour cette énigme','Le triangle arithmétique de Pascal est le triangle dont la ligne d''indice n (n = 0, 1, 2...) donne les coefficients binomiaux (n) pour p = 0, 1, 2..., n.<br/> La construction de ce triangle de Pascal est simple, on part de 1 à la première ligne, par convention c''est la ligne zéro (n = 0) Pour avoir un terme de la ligne suivante, on prend le terme juste au-dessus, et on lui additionne celui qui est juste avant, (0 si il n''y a rien). Mathématiquement, on applique la formule :<br/> (n+1) = (n) + ( n )','<b>Entrée</b> : 4<br><b>Sortie</b> : [[1],[1,1],[1,2,1],[1,3,3,1]]',replace(replace('def estTriangleDePascal(n):\r\n if(n==0):\r\n return []\r\n if(n==1):\r\n return [[1]]\r\n triangle=[[1],[1, 1]]\r\n columns=n\r\n for line in range(2,n):\r\n triangle.append([1])\r\n for column in range(1, line):\r\n triangle[line].append(triangle[line - 1][column - 1] + triangle[line - 1][column])\r\n triangle[line].append(1)\r\n return triangle','\r',char(13)),'\n',char(10)),replace(replace('import random as r\r\ndef testTriangleDePascal(n):\r\n triangle_pascal(0)\r\n listTest=[0,1]\r\n for i in range(0,n):\r\n listTest.append(r.randint(5,140))\r\n for i in listTest:\r\n if(triangle_pascal(i)!=estTriangleDePascal(i)):\r\n return False\r\n return True\r\n \r\nprint(testTriangleDePascal(5))','\r',char(13)),'\n',char(10)),8,0,0,'def triangle_pascal(n):');
INSERT INTO Enigme VALUES(19,'Palindrome','Écrire une fonction <b style="color: violet;">estPalindrome(var)</b> qui prend en argument un <b style="color:#44fff6">entier</b> et qui renvoie <b style="color: green;">True</b> si cest un palindrome et <b style="color: red;">False</b> sinon.','En python linstruction [::-1] permet dinverse une chaine de caractère. <br /><br />print("ae"[::-1]) -> ea.','Il n''y a pas de rappel pour cette enigme.','<b style="color: violet;">estPalindrome(12321)</b> renvoie <b style="color: green;"></bstyle>True</b>',replace('def estPalindromeVerif(var):\n if(var == var[::-1]):\n return True\n else:\n return False','\n',char(10)),replace('import random as r\ndef testPalindrome(x):\n l=[1,2,3,2,1]\n if(estPalindrome(l)==False):\n return False\n l=[9,5,7,7,9]\n if(estPalindrome(l)==True):\n return False\n l=[]\n for i in range(x):\n for j in range(r.randint(1,10)):\n l.append(r.randint(0,9))\n if(estPalindromeVerif(l)!=estPalindrome(l)):\n return False\n l=[]\n return True\n\nprint(testPalindrome(5))','\n',char(10)),0,600,100,'def estPalindrome(var):'); INSERT INTO Enigme VALUES(19,'Palindrome','Écrire une fonction <b style="color: violet;">estPalindrome(var)</b> qui prend en argument un <b style="color:#44fff6">entier</b> et qui renvoie <b style="color: green;">True</b> si cest un palindrome et <b style="color: red;">False</b> sinon.','En python linstruction [::-1] permet dinverse une chaine de caractère. <br /><br />print("ae"[::-1]) -> ea.','Il n''y a pas de rappel pour cette enigme.','<b style="color: violet;">estPalindrome(12321)</b> renvoie <b style="color: green;"></bstyle>True</b>',replace('def estPalindromeVerif(var):\n if(var == var[::-1]):\n return True\n else:\n return False','\n',char(10)),replace('import random as r\ndef testPalindrome(x):\n l=[1,2,3,2,1]\n if(estPalindrome(l)==False):\n return False\n l=[9,5,7,7,9]\n if(estPalindrome(l)==True):\n return False\n l=[]\n for i in range(x):\n for j in range(r.randint(1,10)):\n l.append(r.randint(0,9))\n if(estPalindromeVerif(l)!=estPalindrome(l)):\n return False\n l=[]\n return True\n\nprint(testPalindrome(5))','\n',char(10)),0,600,100,'def estPalindrome(var):');
INSERT INTO Enigme VALUES(20,'CesarDecrypt','Écrire une fonction <b style="color : violet">Decrypt</b> qui prend en argument un <b style="color: #44fff6;">message</b> et une <b style="color: #44fff6;">clé</b> et qui retourne le message décrypté avec le code <b>César</b>.(les espace ne seront pas encodé.)','La fonction ord(char) de python permet de retourner l''Unicode (standard dencodage de caractères) d''un caractère.<br/> Par exemple, ord(''a'') retourne ''97'' et ord(''b'')) retourne ''98''.','Le code <b>César</b> (ou chiffre de César ) est un chiffrement par substitution, <br>où chaque lettre est remplacée par une autre lettre se situant un peu plus loin dans l''alphabet .<br>Par exemple A avec une clé 2 devient C.','<b>Entrée</b> :&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<b>Sortie</b> : <br>''fbehu'',3&emsp;&emsp;&emsp;&emsp;&emsp;&nbsp;cyber',replace('def DecryptVerif(text, key):\n result = ""\n for i in range(len(text)):\n char = text[i]\n if(char==" "):\n result+=" "\n elif (char.isupper()):\n result += chr((ord(char) - key-65) % 26 + 65)\n else:\n result += chr((ord(char) - key - 97) % 26 + 97)\n return result','\n',char(10)),replace('import random as r\ndef testDecrypte(x):\n Decrypt("",1)\n if(Decrypt("Jgnnq yqtnf",2)!="Hello world"):\n return False\n if(Decrypt("Blarycnm",9)!="Scripted"):\n return False\n for i in range(x):\n l=""\n cle=r.randint(1,26)\n for i in range(r.randint(1,10)):\n l+=chr(r.randint(97,122))\n if(Decrypt(l,cle)!=DecryptVerif(l,cle)):\n return False\n return True\n \nprint(testDecrypte(5))','\n',char(10)),0,600,100,'def Decrypt(text, key):'); -- INSERT INTO Enigme VALUES(20,'CesarDecrypt','Écrire une fonction <b style="color : violet">Decrypt</b> qui prend en argument un <b style="color: #44fff6;">message</b> et une <b style="color: #44fff6;">clé</b> et qui retourne le message décrypté avec le code <b>César</b>.(les espace ne seront pas encodé.)','La fonction ord(char) de python permet de retourner l''Unicode (standard dencodage de caractères) d''un caractère.<br/> Par exemple, ord(''a'') retourne ''97'' et ord(''b'')) retourne ''98''.','Le code <b>César</b> (ou chiffre de César ) est un chiffrement par substitution, <br>où chaque lettre est remplacée par une autre lettre se situant un peu plus loin dans l''alphabet .<br>Par exemple A avec une clé 2 devient C.','<b>Entrée</b> :&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<b>Sortie</b> : <br>''fbehu'',3&emsp;&emsp;&emsp;&emsp;&emsp;&nbsp;cyber',replace('def DecryptVerif(text, key):\n result = ""\n for i in range(len(text)):\n char = text[i]\n if(char==" "):\n result+=" "\n elif (char.isupper()):\n result += chr((ord(char) - key-65) % 26 + 65)\n else:\n result += chr((ord(char) - key - 97) % 26 + 97)\n return result','\n',char(10)),replace('import random as r\ndef testDecrypte(x):\n Decrypt("",1)\n if(Decrypt("Jgnnq yqtnf",2)!="Hello world"):\n return False\n if(Decrypt("Blarycnm",9)!="Scripted"):\n return False\n for i in range(x):\n l=""\n cle=r.randint(1,26)\n for i in range(r.randint(1,10)):\n l+=chr(r.randint(97,122))\n if(Decrypt(l,cle)!=DecryptVerif(l,cle)):\n return False\n return True\n \nprint(testDecrypte(5))','\n',char(10)),0,600,100,'def Decrypt(text, key):');
-- INSERT INTO Enigme VALUES(27,'Alternance','Coder la fonction <b style="color: violet;">tri</b>. Cette fonction prend en paramètre deux <b style="color: yellow;">chaine de caractère</b>, prend tour à tour les caractères des deux chaines et retourne la <b style="color: yellow;">chaine de caractère</b> trié. (cf l''exemple)','Il n''y a pas d''aide pour cette énigme','Il n''y a pas de rappel pour cette énigme','<b>Entrée</b> : "Hlowrd", "el ol" <br><b>Sortie</b> : "Hello world" ',replace(replace('def triVerif(a,b):\r\n s = ""\r\n i = 0\r\n while len(s)<len(a+b):\r\n if(len(a)>i):\r\n s += a[i]\r\n if(len(b)>i):\r\n s += b[i]\r\n i += 1\r\n return s','\r',char(13)),'\n',char(10)),replace(replace('import random as r\r\ndef triTest(x):\r\n a = "Hlowrd"\r\n b = "el ol"\r\n if(triVerif(a,b)!=tri(a,b)):\r\n return False\r\n return True\r\n\r\nprint(triTest(5)) ','\r',char(13)),'\n',char(10)),5,0,0,'def trie(a,b):');
Loading…
Cancel
Save