We working to create an AP CS Principles course based on MakeCode Arcade. In one of the units of this course, students need to complete a bunch of Robot Tracing exercises like this:
The Robot is represented as a triangle, the grid is a 7 x 7 matrix, and there are only 3 functions - Move Forward (1), Turn Right, and Turn Left.
If anyone has some time, I would be eternally grateful if you want to try implementing this in MakeCode Arcade (maybe as an extension with custom blocks?) Would love to include it in the CSP course!
Seemed like a fun project. I put together a very simple implementation over lunch:
You’ll notice there’s a new RoboDrawing category that has the three blocks you mentioned plus a reset function (which is also required to initialize the sprite and grid).
Right now the sprite just follows instructions blindly; it doesn’t verify that it doesn’t move outside the bounds of the grid or anything…
… also I didn’t spend much time coming up with good names for the blocks or adding documentation.
Feel free to modify/improve the code any way you like.
Wow!!! Jacob, I love this, it’s perfect! Thanks so much for doing this. Will get this included in the course curriculum - lots of kids will be playing this! Do you want me to add a credit/link to you below the game?
Hey Jacob,
Quick question - would it be possible for the Reset function to take a coordinate value? So students could place the robot on any of the tiles?
Those examples appear to use a different grid size, starting location for the robot, and starting orientation of the robot. (It also looks like there may be obstacles and an additional conditional instruction later on…)
Do any of your curriculum’s exercises involve different grid sizes or starting configurations (position/orientation)?
@jacqueline.russell Here is an update to the robot drawing with the ability to customize the starting location and direction:
I also started doing some questionable things in the design of the JavaScript API to enable a blocks convenience: the turn blocks now allow you to pick the other turn direction with a drop-down. (I wanted it to work kind of like the Math operators, where +, -, ✖️ and ➗ are all listed, but if you pick the wrong one, you can swap over to another.)
… but I really don’t like the JS that it creates. Is it a priority that the generated JS be reasonable? Will the students be looking at that code?
I can roll back that change if it’d be better to force them to swap blocks to change turning directions.
Wow! Even better Jacob! This is perfect! No, students won’t be looking at the JavaScript - it’s all going to be block-based, so no worries there. Thank you so much!!!
We’ve built a similar project for hour of code campaign( but no i18n (yet)), same purpose with some features for new coders.
a) Navigating mode, in which students can navigate levels and draw flowcharts on paper or planning their programs (simulator automatically restart after changes detected)
b) Summary after running all levels;
c) Barriers like walls / boulders, context for introducing conditionals (if…then…)
This MakeCode extension is great! However, the AP Computer Science Principles curriculum has one more function that goes along with these three basic robot movement commands. It is: CAN_MOVE(direction). The direction argument can be left, right, forward, or backward. All 4 functions are used on a grid that is a variable size and has open squares (white), blocked off squares (black) and a goal square (gray).
Example grid and code:
REPEAT UNTIL (Goal_Reached ())
{
IF (CAN_MOVE (right))
{
ROTATE_RIGHT ()
}
ELSE
{
IF (CAN_MOVE (left) )
{
ROTATE_LEFT ()
}
}
IF (CAN_MOVE (forward) )
{
MOVE_FORWARD ()
}
}
I copied your repository and tried to change it to add the function and have a way to modify the grid size and change the squares to different types. I gave up after a while. Any suggestions on how to make this possible?
You can import it by putting that link into the extensions search bar or by searching WoofWoofCodes/pxt-robo
Here is a small example project:
As you can see in the code, there are a few new blocks. Most are self explanatory. When creating a grid with walls using the “set grid image (image)” block, placing the color green will place a goal tile, and any other color will place a wall.
If you have any questions, don’t hesitate to ask! I can always edit the extension.