This repository contains a collection of programming exercises in NetsBlox. Each exercise contains a starter template ("template.xml") and most contain test cases. These exercises have been designed to be compatible with the autograding capabilities in NetsBlox and should be pretty easily composed into your own lessons!
Feel free to browse the exercises and open the starter template (ie, the "template.xml" file) of exercises that pique your interest!
- Acronym. Available as a Parsons problem, too!
- Actor's Birthday. Available as a Parsons problem, too!
- Anagram.
- Atbash Cipher. Available as a Parsons problem, too!
- Compute the Average. Available as a Parsons problem, too!
- Compute the Average of a List. Available as a Parsons problem, too!
- Between. Available as a Parsons problem, too!
- Bigram Autocomplete. Available as a Parsons problem, too!
- Caesar Shift. Available as a Parsons problem, too!
- Cracking the Caesar Shift with Brute Force. Available as a Parsons problem, too!
- Cracking the Caesar Shift with a Partial Solution. Available as a Parsons problem, too!
- Cyclic Iterator. Available as a Parsons problem, too!
- Factorial. Available as a Parsons problem, too!
- FizzBuzz.
- Greet. Available as a Parsons problem, too!
- Intro to Infinite Sequences. Available as a Parsons problem, too!
- Isogram.
- Leap Year.
- Counting Letter Frequency. Available as a Parsons problem, too!
- Counting Letter Frequency as Dictionary. Available as a Parsons problem, too!
- Luhn Formula. Available as a Parsons problem, too!
- Mapping Over Infinite Sequences. Available as a Parsons problem, too!
- Minesweeper. Available as a Parsons problem, too!
- Moving Average. Available as a Parsons problem, too!
- Pangram. Available as a Parsons problem, too!
- Sieve of Eratosthenes. Available as a Parsons problem, too!
- Sliding Windows.
- From Infinite Sequences to Finite Lists. Available as a Parsons problem, too!
- Transposing Music.
- Vigenere Cipher. Available as a Parsons problem, too!
If you want to compose these exercises into autograded (and automatically loaded!) activities, simply import the "AutograderTools.xml" file into NetsBlox and then use the Autograders service to create your own lesson/set of assignments! An example can be found below:
After cloning the repository, configure the githooks with:
git config core.hooksPath .githooks
This will ensure that any automated preparation will happen automatically such as updating the autograder tools library.
Next, create the starter template with NetsBlox. Ideally, it includes the following sections:
- The custom block by itself at the top of the scripting area
- A few examples using the block with the expected output
- An advanced example that will work once the custom block is implemented
See the "Moving Average" or "Counting Letter Frequency" exercises for a couple examples.
After implementing the custom block and completing the template, scramble (disconnecting all the blocks) the implementation of the custom block so it is a Parsons problem. Then save it as
exercises/<exercise-name>/parsons.xml
The empty version of the exercise will be created automatically via one of the githooks.
Next, we need to add the automated tests for the exercise. The tests are defined using the (JSON) specification found in the Autograders service. Since multidimensional lists can be easily exported as JSON, we can define the tests in the environment using the custom blocks from the "Autograder helpers" community library. Here is an example for the "Actor's Birthday" exercise:
After setting the variable to these tests, we can right click the watcher and select "export" to download them as JSON. Simply copy this file to exercises/<exercise-name>/tests.json
and the tests will be added!
Finally, we can add some of the last remaining metadata. Most importantly, we need to add a name.txt
file with the assignment name. An overview of the files for the exercise can be found below.
- name.txt: The display name for the activity
- parsons.xml: The activity as a Parsons problem. Used to generate the empty version.
- template.xml: The starter template for the project (Generated automatically from the parsons.xml file)
- tests.json: The test cases to use when grading the activity
- credits.txt [optional]: Any attributions to sources of inspiration, etc, for the activity