dodona-edu / judge-turtle Goto Github PK
View Code? Open in Web Editor NEW๐ข Python Turtle judge for the Dodona learning environment
License: GNU Affero General Public License v3.0
๐ข Python Turtle judge for the Dodona learning environment
License: GNU Affero General Public License v3.0
# import package
import turtle
turtle.shape("turtle")
print("hallo") # ignore this
# forward turtle by 50
turtle.forward(50)
# print the turtle shape
turtle.stamp()
turtle.speed(20)
# and then continue
# forward turtle by 50
turtle.forward(50)
turtle.bye()
Some ideas for visual feedback:
Docs:
# import package
import turtle
import time
turtle.shape("turtle")
# forward turtle by 50
turtle.forward(50)
# print the turtle shape
turtle.stamp()
time.sleep(20) # ignore this
# and then continue
# forward turtle by 50
turtle.forward(50)
turtle.stamp()
Python script for teacher which converts turtle solution to image.
Teachers need a png image for the exercise description. This script could be in their GitHub repository with Dodona exercises in a preparation
folder. Running the script locally would generate the image in the media
folder based on the solution.py
.
Similar to donkirkby/svg-turtle#4 and based on https://github.ugent.be/brewille/oef_turtle/blob/master/centered_rectangle/preparation/conv2png.py
Show error instead.
This feature request tries to make the feedback more meaningful. 2209/2500 pixels correct
doesn't say that much, but 88% is already better.
Background pixels are correct by default, so count them separately (see below). E.g. square with a black border and transparant inside. A blank canvas is already 90%+ correct. If the number of black pixels is counted, this results in 0% correct.
950/1000 (95%) pixels correct
(current situation, but add percentage)900/1000 (90%) foreground pixels correct
config.json
(default if not mentioned is transparant). e.g. "background-color": "white"
Docs:
Use https://pypi.org/project/colour/ or the color map in svg_turtle to convert between colour formats.
Edit: This is what I meant. The score isn't 90%+, but a more realistic score, 20% similarity.
The default size is ok, if it's not mentioned in config.json
.
Edit: This is apparently because of the custom turtle object. How difficult is this to support? If it isn't worth the hassle we can close it.
import turtle
center = (0, 0)
side = 50
turtle.fillcolor("blue")
x_pt, y_pt = center
x_pt -= side / 2
y_pt += side / 2
turtle.up()
turtle.goto(x_pt, y_pt)
turtle.down()
turtle.begin_fill()
for _ in range(4):
turtle.forward(side)
turtle.right(90)
turtle.end_fill()
turtle.home()
turtle.dot(5)
turtle.done()
Standard Error:
Traceback (most recent call last):
File "/mnt/_n9h4GBuCwjJb87ulQw3cg/judge/turtle_judge.py", line 74, in <module>
correct_pixels, total_pixels = diff_images(png_submission, png_solution)
File "/mnt/_n9h4GBuCwjJb87ulQw3cg/judge/judge/runtime.py", line 61, in diff_images
diff = ImageChops.difference(image1, image2)
File "/usr/local/lib/python3.10/site-packages/PIL/ImageChops.py", line 102, in difference
return image1._new(image1.im.chop_difference(image2.im))
ValueError: images do not match
Load custom backgrounds in turtle canvas with bgpic
.
Edit: This feature request is to make "connect-the-dots"-exercises possible. This would be ideal to learn about the coordinate system and get some visual help. E.g.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.