Last active
July 17, 2018 20:31
-
-
Save acbart/d87ca5c2fd49bd4679df4daed51f84b6 to your computer and use it in GitHub Desktop.
Pedal BlockPy Example
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
# BlockPy Examples | |
################################################################################ | |
# Boiler plate code automatically prepended before execution | |
# Import get_output, set_success, gently, explain | |
from pedal.report import * | |
# In JS, patch `get_program`, and then imperative define the report's source | |
report.set_source(get_program()) | |
# Run the tifa analysis; stuff is automatically added to the report | |
from pedal.tifa import tifa_analysis() | |
_tifa = tifa_analysis() | |
# Set up CAIT to know about TIFA | |
import pedal.cait as cait | |
cait.configure(tifa=_tifa) | |
################################################################################ | |
# End of boiler plate | |
# Minor modifications to pathing for the instructor_* stuff | |
from pedal.mistakes import mistakes | |
mistakes.filter_group() | |
mistakes.append.append_group() | |
# But most code left unchanged | |
if 'text' in get_output(): | |
gently("Hey now...") | |
set_success() | |
################################################################################ | |
# Boilerplate begins again. | |
import pedal.feedback as feedback | |
# Runs the feedback dispatcher, figures out what the HTML string is | |
_RESULT = feedback.select() | |
_PARTIALS = feedback.sum_partials() | |
_COMPLIMENTS = feedback.get_compliments() | |
# Have to access the _RESULT from the JS side | |
# Call blockpy.set_feedback(_RESULT, _PARTIALS, COMPLIMENTS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment