Merge branch 'master' of https://codefirst.iut.uca.fr/git/nathan.boileau/Scripted
commit
3a86731f06
Binary file not shown.
@ -1,12 +0,0 @@
|
|||||||
//~ Function that test the user code
|
|
||||||
|
|
||||||
async function submit(){
|
|
||||||
var test = editor.getValue();
|
|
||||||
exec("print('Hello World !')", "code");
|
|
||||||
exec(test, "solution");
|
|
||||||
result.innerHTML = "Test en cours...";
|
|
||||||
await new Promise(r => setTimeout(r, 1500));
|
|
||||||
check();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
//~ Function that test the user code
|
||||||
|
|
||||||
|
async function submit(){
|
||||||
|
var test = editor.getValue()+`\n
|
||||||
|
import random as r
|
||||||
|
|
||||||
|
def multiVerif(a,b):
|
||||||
|
return a*b
|
||||||
|
|
||||||
|
def multiTest(x):
|
||||||
|
multiplication(1,1)
|
||||||
|
for i in range(x):
|
||||||
|
a=r.randint(0,100)
|
||||||
|
b=r.randint(0,100)
|
||||||
|
if(multiplication(a,b) != multiVerif(a,b)):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
print(multiTest(5))
|
||||||
|
|
||||||
|
`;
|
||||||
|
exec("print('True')", "code");
|
||||||
|
exec(test, "solution");
|
||||||
|
result.innerHTML = "Test en cours...";
|
||||||
|
await new Promise(r => setTimeout(r, 1500));
|
||||||
|
check();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
|||||||
|
//~ Function that test the user code
|
||||||
|
|
||||||
|
async function submit(){
|
||||||
|
var test = editor.getValue()+`\n
|
||||||
|
import random as r
|
||||||
|
|
||||||
|
def triVerif(a,b):
|
||||||
|
s = ""
|
||||||
|
i = 0
|
||||||
|
while len(s)<len(a+b):
|
||||||
|
if(len(a)>i):
|
||||||
|
s += a[i]
|
||||||
|
if(len(b)>i):
|
||||||
|
s += b[i]
|
||||||
|
i += 1
|
||||||
|
return s
|
||||||
|
|
||||||
|
def triTest(x):
|
||||||
|
tri(a,b)
|
||||||
|
a = "Hlowrd"
|
||||||
|
b = "el ol"
|
||||||
|
if(triVerif(a,b)!=tri(a,b)):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
print(triTest(5))
|
||||||
|
`;
|
||||||
|
exec("print('True')", "code");
|
||||||
|
exec(test, "solution");
|
||||||
|
result.innerHTML = "Test en cours...";
|
||||||
|
await new Promise(r => setTimeout(r, 1500));
|
||||||
|
check();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
|||||||
async function submit(){
|
|
||||||
var test = editor.getValue();
|
|
||||||
exec("print([1,'Oui'])", "code");
|
|
||||||
exec(test, "solution");
|
|
||||||
result.innerHTML = "Test en cours...";
|
|
||||||
await new Promise(r => setTimeout(r, 1500));
|
|
||||||
check();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,149 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>First Test</title>
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
|
||||||
|
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
/>
|
||||||
|
<script
|
||||||
|
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
|
||||||
|
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
></script>
|
||||||
|
<script
|
||||||
|
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
|
||||||
|
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
></script>
|
||||||
|
<link rel="stylesheet" href="../../CSS/FirstTest.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark pb-5">
|
||||||
|
<div class="container-fluid mx-0">
|
||||||
|
<div class="nav-item nav-link">
|
||||||
|
<a class="navbar-brand" href="index.php?action=goToHome">Home</a>
|
||||||
|
</div>
|
||||||
|
<div class="mx-auto d-flex">
|
||||||
|
<h5
|
||||||
|
class="m-1 text-uppercase"
|
||||||
|
style="color: #fff; font-weight: bold; font-size: 22px"
|
||||||
|
>
|
||||||
|
Test de qualification
|
||||||
|
</h5>
|
||||||
|
<h5
|
||||||
|
class="m-1 text-uppercase"
|
||||||
|
style="color: #44fff6; font-weight: bold; font-size: 22px"
|
||||||
|
>
|
||||||
|
5/12
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
<div class="nav-link">
|
||||||
|
<a class="navbar-brand" href="index.php?action=goToEnigme">Next</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<!-- First Test -->
|
||||||
|
<div
|
||||||
|
class="row rounded p-3 m-3"
|
||||||
|
style="
|
||||||
|
background: #16222a; /* fallback for old browsers */
|
||||||
|
background: -webkit-linear-gradient(
|
||||||
|
to right,
|
||||||
|
#3a6073,
|
||||||
|
#16222a
|
||||||
|
); /* Chrome 10-25, Safari 5.1-6 */
|
||||||
|
background: linear-gradient(to right, #3a6073, #16222a);
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-10">
|
||||||
|
<section
|
||||||
|
style="background-color: #222831; min-height: 0"
|
||||||
|
class="p-3 rounded m-0">
|
||||||
|
<p>
|
||||||
|
Je vais désormais te présenter l'instruction <b style="color: violet;">return</b>.
|
||||||
|
Un return est une instruction qui permet de renvoyer une valeur.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Par exemple, la fonction suivante renvoie la somme de deux nombres :
|
||||||
|
</p>
|
||||||
|
<code style="font-size: 18px">
|
||||||
|
def addition(a, b):<br />
|
||||||
|
return a + b
|
||||||
|
</code>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="col-2 align-self-center">
|
||||||
|
<img
|
||||||
|
src="../../../assets/img/Foxy.png"
|
||||||
|
alt="Logo"
|
||||||
|
class="img-fluid rounded-circle"
|
||||||
|
style="
|
||||||
|
border: 2px solid #44fff6;
|
||||||
|
background-image: url('../../../assets/img/BackgroundMain.jpg');
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mt-5">
|
||||||
|
<!-- Editor -->
|
||||||
|
<div class="col-8">
|
||||||
|
<div class="ace rounded ace-1" id="editor" style="min-height: 40vh">def addition(a,b) :
|
||||||
|
return a+b
|
||||||
|
|
||||||
|
somme=addition(6,4)
|
||||||
|
print(somme)</div>
|
||||||
|
</div>
|
||||||
|
<!-- End Editor -->
|
||||||
|
|
||||||
|
<!-- Console -->
|
||||||
|
<div class="col-4" style="min-height: 40vh">
|
||||||
|
<textarea
|
||||||
|
id="console"
|
||||||
|
readonly
|
||||||
|
style="width: 100%; height: 60%"
|
||||||
|
class="p-3 rounded"
|
||||||
|
></textarea>
|
||||||
|
<!-- End Return Code -->
|
||||||
|
|
||||||
|
<!-- Buttons -->
|
||||||
|
<div
|
||||||
|
class="row pt-5 text-center"
|
||||||
|
style="cursor: pointer; height: 20%"
|
||||||
|
>
|
||||||
|
<div class="col">
|
||||||
|
<a onclick="run_init()" class="btn">
|
||||||
|
<span>Run</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End Buttons -->
|
||||||
|
</div>
|
||||||
|
<!-- End Console -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End First Test -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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="../../JS/base.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,197 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>First Test</title>
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
|
||||||
|
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
/>
|
||||||
|
<script
|
||||||
|
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
|
||||||
|
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
></script>
|
||||||
|
<script
|
||||||
|
src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js"
|
||||||
|
integrity="sha384-oesi62hOLfzrys4LxRF63OJCXdXDipiYWBnvTl9Y9/TRlw5xlKIEHpNyvvDShgf/"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
></script>
|
||||||
|
<link rel="stylesheet" href="../../CSS/FirstTest.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark pb-5">
|
||||||
|
<div class="container-fluid mx-0">
|
||||||
|
<div class="nav-item nav-link">
|
||||||
|
<a class="navbar-brand" href="index.php?action=goToHome">Home</a>
|
||||||
|
</div>
|
||||||
|
<div class="mx-auto d-flex">
|
||||||
|
<h5
|
||||||
|
class="m-1 text-uppercase"
|
||||||
|
style="color: #fff; font-weight: bold; font-size: 22px"
|
||||||
|
>
|
||||||
|
Test de qualification
|
||||||
|
</h5>
|
||||||
|
<h5
|
||||||
|
class="m-1 text-uppercase"
|
||||||
|
style="color: #44fff6; font-weight: bold; font-size: 22px"
|
||||||
|
>
|
||||||
|
6/12
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
<div class="nav-link">
|
||||||
|
<a class="navbar-brand" href="index.php?action=goToEnigme">Next</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<!-- First Test -->
|
||||||
|
<div
|
||||||
|
class="row rounded p-3 m-3"
|
||||||
|
style="
|
||||||
|
background: #16222a; /* fallback for old browsers */
|
||||||
|
background: -webkit-linear-gradient(
|
||||||
|
to right,
|
||||||
|
#3a6073,
|
||||||
|
#16222a
|
||||||
|
); /* Chrome 10-25, Safari 5.1-6 */
|
||||||
|
background: linear-gradient(to right, #3a6073, #16222a);
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-10">
|
||||||
|
<section
|
||||||
|
style="background-color: #222831; min-height: 0"
|
||||||
|
class="p-3 rounded m-0">
|
||||||
|
<p>
|
||||||
|
J'èspère que tu es prêt pour ton premier test !
|
||||||
|
Écrit une function <b style="color: violet;">multiplicaton</b>.
|
||||||
|
qui returne la multiplication de deux nombres.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Comme d'habitue, tu peux tester ton code en cliquant sur le bouton <b style="color: red;">Run</b>.
|
||||||
|
Si tu es sur que ton code est bon, clique sur le bouton <b style="color: green;">Submit</b>
|
||||||
|
pour valider ton test.
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="col-2 align-self-center">
|
||||||
|
<img
|
||||||
|
src="../../../assets/img/Foxy.png"
|
||||||
|
alt="Logo"
|
||||||
|
class="img-fluid rounded-circle"
|
||||||
|
style="
|
||||||
|
border: 2px solid #44fff6;
|
||||||
|
background-image: url('../../../assets/img/BackgroundMain.jpg');
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mt-5">
|
||||||
|
<!-- Editor -->
|
||||||
|
<div class="col-8">
|
||||||
|
<div class="ace rounded ace-1" id="editor" style="min-height: 40vh">def multiplication(a,b) :
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End Editor -->
|
||||||
|
|
||||||
|
<!-- Console -->
|
||||||
|
<div class="col-4" style="min-height: 40vh">
|
||||||
|
<textarea
|
||||||
|
id="console"
|
||||||
|
readonly
|
||||||
|
style="width: 100%; height: 60%"
|
||||||
|
class="p-3 rounded"
|
||||||
|
></textarea>
|
||||||
|
<!-- End Return Code -->
|
||||||
|
|
||||||
|
<!-- Buttons -->
|
||||||
|
<div
|
||||||
|
class="row pt-5 text-center"
|
||||||
|
style="cursor: pointer; height: 20%"
|
||||||
|
>
|
||||||
|
<div class="col-6">
|
||||||
|
<a onclick="run_init()" class="btn">
|
||||||
|
<span>Run</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<button
|
||||||
|
onclick="submit()"
|
||||||
|
class="btn"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-target="#modal"
|
||||||
|
>
|
||||||
|
<span>Submit</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End Buttons -->
|
||||||
|
</div>
|
||||||
|
<!-- End Console -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End First Test -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal -->
|
||||||
|
<div
|
||||||
|
class="modal fade"
|
||||||
|
id="modal"
|
||||||
|
tabindex="-1"
|
||||||
|
role="dialog"
|
||||||
|
aria-labelledby="exampleModalCenterTitle"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h2
|
||||||
|
class="modal-title"
|
||||||
|
id="exampleModalLongTitle"
|
||||||
|
style="color: black"
|
||||||
|
>
|
||||||
|
Results
|
||||||
|
</h2>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="close"
|
||||||
|
data-dismiss="modal"
|
||||||
|
aria-label="Close"
|
||||||
|
>
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<h5 id="result" style="color: black"></h5>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<a href="#" class="btn" style="display: none" id="next">
|
||||||
|
<span>NEXT</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- End Modal -->
|
||||||
|
|
||||||
|
<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="../../JS/base.js"></script>
|
||||||
|
<script src="../../JS/FirstFunction.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in new issue