Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generated Python syntax #1707

Open
3 tasks
evemartin opened this issue Aug 14, 2024 · 0 comments
Open
3 tasks

Fix generated Python syntax #1707

evemartin opened this issue Aug 14, 2024 · 0 comments
Labels
active cadets volunteers Tasks that can be picked up by anyone

Comments

@evemartin
Copy link
Contributor

evemartin commented Aug 14, 2024

Task Description and Acceptance Criteria

Some of the generated Python commands in the Python Den's Blockly with Python levels need to be changed to be more consistent. This task is to make the following changes:

  • instead of .is_road("FORWARD"), the generated Python should be .is_road_forward() - similarly for the other directions
  • instead of .is_traffic_light("RED"), the generated Python should be .is_red_traffic_light() - similarly for green
  • generated while loops should not put the condition in parentheses

Further details:

image

  • The Python output should be the following:

image

  • You can see the while loop's condition is enclosed in parentheses - no need for this. It should just say while count < 4:.
  • You can the if condition reads my_van.is_road('FORWARD') (same for the other conditions if you change the block). Instead it should be my_van.is_road_forward() to stay consistent with what the teaching materials and the commands popup use.

There are no Python Den levels that contain traffic lights but you could see the generated Python for the traffic lights block locally if you create a custom Blocky with Python level which has the traffic light condition block enabled. You can do this in the Level Editor - It is for Rapid Router but you can still create Python levels there - bear in mind the level will appear in the Rapid Router page.

Good places to start

Python generation code for Blockly with Python levels: https://github.com/ocadotechnology/rapid-router/blob/8b28179b9cfecd2db8d51ac4b2671a78130a24d5/game/static/game/js/blocklyCustomBlocks.js

@faucomte97 faucomte97 added volunteers Tasks that can be picked up by anyone active cadets labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
active cadets volunteers Tasks that can be picked up by anyone
Projects
None yet
Development

No branches or pull requests

2 participants