-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5d59eb7
Showing
8 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
# A AMELIORER | ||
import os | ||
import subprocess | ||
import shlex | ||
from inginious import feedback | ||
from inginious import input | ||
|
||
|
||
if __name__ == "__main__": | ||
os.chdir("student") | ||
input.parse_template("student_code.py.tpl", "student_code.py") | ||
|
||
p = subprocess.Popen(shlex.split("python3 test.py"), stderr=subprocess.STDOUT, stdout=subprocess.PIPE) | ||
make_output = p.communicate()[0].decode('utf-8') | ||
|
||
if p.returncode: | ||
feedback.set_global_result("failed") | ||
feedback.set_global_feedback("La compilation de votre code a échoué. Voici l'erreur:" + make_output) | ||
exit(0) | ||
elif "True" in make_output: | ||
feedback.set_global_result("success") | ||
feedback.set_global_feedback("Vous avez résolu l'exercice.") | ||
feedback.set_problem_feedback("Bien","thecode") #attention! thecode est l'id de la sous-question | ||
else: | ||
feedback.set_global_result("failed") | ||
feedback.set_global_feedback("Vous n'avez pas résolu cette instance") | ||
feedback.set_problem_feedback(make_output,"thecode") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import math | ||
|
||
def arret(but): | ||
hb,lb,lg=0,0,0 | ||
output=[0,0,0] | ||
for h in range(len(but)): #until H | ||
for l in range(len(but[0])): #until L | ||
if but[h][l]=='B': | ||
hb,lb=h,l | ||
elif but[h][l]=='G': | ||
hg,lg=0,l | ||
# //Gestion de la direction | ||
if lb<lg: | ||
output[0]=-1.0 | ||
else: | ||
if (lg!=lb): | ||
output[0]=1.0 | ||
|
||
#Calcul de la distance | ||
output[2]=math.sqrt((hb**2)+(lg-lb)**2) | ||
|
||
#Calcul de l'angle | ||
|
||
if (lg==lb): | ||
output[1]=90 | ||
else: | ||
output[1]=math.degrees(math.atan(hb/(abs(lg-lb)))) | ||
return output | ||
|
||
H=10 | ||
L=20 | ||
BUT=[['X' for j in range(0,L)] for i in range(0,H)] | ||
BUT[6][5]='G' | ||
BUT[3][14]='B' | ||
res=arret(BUT) | ||
print("Je saute en direction {} avec un angle de {} sur une distance de {}".format(res[0],res[1],res[2])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import math | ||
|
||
def arret(but): | ||
@ @thecode@@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from student_code import arret | ||
import math | ||
|
||
def arret_good(but): | ||
hb,lb,lg=0,0,0 | ||
output=[0,0,0] | ||
for h in range(len(but)): #until H | ||
for l in range(len(but[0])): #until L | ||
if but[h][l]=='B': | ||
hb,lb=h,l | ||
elif but[h][l]=='G': | ||
hg,lg=0,l | ||
# //Gestion de la direction | ||
if lb<lg: | ||
output[0]=-1.0 | ||
else: | ||
if (lg!=lb): | ||
output[0]=1.0 | ||
|
||
#Calcul de la distance | ||
output[2]=math.sqrt((hb**2)+(lg-lb)**2) | ||
|
||
#Calcul de l'angle | ||
|
||
if (lg==lb): | ||
output[1]=90 | ||
else: | ||
output[1]=math.degrees(math.atan(hb/(abs(lg-lb)))) | ||
return output | ||
|
||
|
||
if __name__ == "__main__": | ||
H=10 | ||
L=20 | ||
BUT=[['X' for j in range(0,L)] for i in range(0,H)] | ||
BUT[6][5]='G' | ||
BUT[3][14]='B' | ||
res=arret(BUT) | ||
res_good = arret_good(BUT) | ||
if res == res_good: | ||
print("True") | ||
else: | ||
print("La bonne réponse B en [3][14] et G en [6][5] est la direction {} avec un angle de {} sur une distance de {}".format(res_good[0],res_good[1],res_good[2])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
accessible: true | ||
author: Bastien NOTHOMB | ||
context: |- | ||
Demo | ||
environment: default | ||
evaluate: best | ||
groups: false | ||
limits: | ||
time: '3' | ||
memory: '100' | ||
output: '2' | ||
name: 1. Getting started | ||
network_grading: false | ||
order: 0 | ||
problems: | ||
thecode: | ||
name: Hello World ! | ||
language: python | ||
type: code | ||
header: |- | ||
Here you are asked to provide a basic Python 3 program displaying ``Hello World!`` on standard output. | ||
*Hint :* to display something on standard output, use the built-in ``print`` method. | ||
stored_submissions: 0 | ||
submission_limit: | ||
amount: -1 | ||
period: -1 | ||
weight: 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
# A AMELIORER | ||
import os | ||
import subprocess | ||
import shlex | ||
from inginious import feedback | ||
from inginious import input | ||
|
||
|
||
if __name__ == "__main__": | ||
os.chdir("student") | ||
input.parse_template("student_code.tpl.py", "student_code.py") | ||
|
||
p = subprocess.Popen(shlex.split("python3 student_code.py"), stderr=subprocess.STDOUT, stdout=subprocess.PIPE) | ||
make_output = p.communicate()[0].decode('utf-8') | ||
|
||
if p.returncode: | ||
feedback.set_global_result("failed") | ||
feedback.set_global_feedback("La compilation de votre code a échoué. Voici l'erreur:" + make_output) | ||
exit(0) | ||
elif "True" in make_output: | ||
feedback.set_global_result("success") | ||
feedback.set_global_feedback("Vous avez résolu l'exercice.") | ||
feedback.set_problem_feedback("Bien","code") #attention! code est l'id de la sous-question | ||
else: | ||
feedback.set_global_result("failed") | ||
feedback.set_global_feedback("Vous n'avez pas résolu cette instance") | ||
feedback.set_problem_feedback(make_output,"code") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: '[OW2019] Tasks' | ||
admins: | ||
- superadmin | ||
|