StepVioz is open source too: its code is under the MIT license and its lessons under CC BY-SA 4.0. It accepts time and skill, never money, and every contributor is credited. It is a good first project, because you already know how it looks from the outside.
Ways to help
- Report a mistake in a lesson, a quiz or a problem, as an issue.
- Report a program where StepVioz prints something different from a real gcc or g++: that is a bug in the interpreter.
- Write a practice problem or improve a lesson.
- Test the site on a cheap phone and a slow connection.
How the project is laid out
| Folder | What is in it |
|---|---|
content/<track>/<lesson>/ | a lesson: meta.json, the text in index.mdx, and examples/ |
content/practice/<problem>/ | a problem: meta.json, index.mdx, starter.py, solution.py, tests.json |
packages/ | the tracers that run code step by step, and the explanations |
apps/web/ | the website |
CONTRIBUTING.md lists the rules for content: original text, small examples, and every claim about the visualizer checked against the real trace.
Adding a practice problem
- Make a folder in
content/practice/with the five files. Intests.json, write the inputs and leave each"output"empty. - Run
npm run practice:outputs: it runs your solution on every input and fills in the outputs. - Run
npm test. Among other things, it checks that your solution passes and the starter code does not. - Commit on a branch and open a pull request, as in the last lessons.
tests = [
{"input": "2 3\n", "output": "5\n", "hidden": False},
{"input": "10 -4\n", "output": "6\n", "hidden": False},
{"input": "0 0\n", "output": "0\n", "hidden": True},
{"input": "7 8\n", "output": "", "hidden": True},
]
samples = sum(1 for t in tests if not t["hidden"])
hidden = len(tests) - samples
problems = []
if samples < 2:
problems.append("needs at least 2 sample tests")
if hidden < 3:
problems.append("needs at least 3 hidden tests")
for i, t in enumerate(tests):
if not t["output"]:
problems.append(f"test {i} has no expected output")
print(samples, "samples,", hidden, "hidden")
for p in problems:
print("problem:", p)This program does one of those checks by hand. A problem needs at least 2 sample tests (shown to the learner) and 3 hidden ones, and every test needs its expected output. This tests.json fails two of the rules. The project's own tests check the same rules automatically, so a pull request that breaks them shows a red check.
Before you open the pull request: run the tests, read your own diff once more (git diff main), and write a description that says what you added and how you checked it.
Quick check
My notes
Write down what you want to remember from this lesson. Notes are saved on this device as you type, and appear on your dashboard.