Pseudocode & Python
The Pseudocode & Python app runs VCE Maths pseudocode in your browser, shows each step in a trace table, and translates between pseudocode and Python. Nothing is sent anywhere: programs run on your device.
Open it from the Home screen of https://cassim.app/, or use its own site, https://pseudo.cassim.app/, which opens straight into it.
- Pseudocode syntax: everything the app accepts, with the Python for each
- Pseudocode algorithms: the examples explained beside their Python, and exercises to write
Save and open#
Doc ▸ New starts a blank program. Doc ▸ Save keeps your program under a name in this browser, with its number mode and angle, and Doc ▸ Open… lists the programs you have saved, as in the other CASSim apps. Saved programs live on this device and browser only. To keep a copy elsewhere, Doc ▸ Export file… downloads the program as a text file (.pseudo.txt, or .py for Python) and Import file… opens one. Doc ▸ Share link… makes a link that holds the program, so you can send it to a class; the link never sends anything to a server. New, Open, Import and an example ask first if your program has changes you have not saved. Nothing you open, import or follow a link to runs until you press Run.
Write and run#
- Type a program in the Code pane, or choose one from Examples (linear, loops, bisection, GCD and LCM, a prime sieve, dice simulations, Riemann sums, Newton's method). Pseudocode algorithms explains each one beside its Python, with more algorithms and exercises.
- Press Run. Output appears below the code. If something goes wrong, the error is shown after the output so far.
- A program with
inputasks for each value in the Console: "Type a value for a in the box above and press Enter". Type it in the Console's box and press Enter; the program runs again from the start with every value so far. A value that looks like a number (3,-1.5,2/3) is a number; anything else is text, and is never run as code. - Stop ends a program that runs too long. Loops are also limited to 1,000 passes, so a mistake cannot run forever.
The √π button on the toolbar lists the symbols the pseudocode accepts (←, ≠, ≤, ×, ÷, π, ⅇ, superscript powers and more) and templates such as √□ and |□|. Tap one to put it at the cursor in the Code pane, or in the Console's input box if you used that last; a template puts the cursor inside its brackets. Hover over a button to see what you can type instead, such as <- for ← or \sqrt for √: the typing aid turns it into the symbol. The Trace button in the Trace Table pane's title picks the trace layout.
Switch the Code pane between Pseudocode and Python to see the translation. Comments on their own line are kept in both directions.
Trace table#
The trace table records every change to a variable, in order, as a desk check would.
- Step and Back move through the run one row at a time, First and Last jump to either end, and the slider below them goes to any step of a long run. The line reached is highlighted in the code.
- The Symbols pane starts folded. Open it to tick the variables and conditions you want as columns. Drag the line between columns to resize them.
- A long run shows its last 200 rows (or 40 loop passes) up to the step reached; move back with the slider to see earlier ones.
- A call row shows the value it returned, as in
poly([3, 0, −2], 1) → 1. - A
defineline has its own row, where the function is defined. - Step steps over a call to one of your own functions: the whole call runs in one step. Its row has an open button, which opens that call's own trace in a window beside the function's code, with its own Step, First and Last. The window can be moved and resized, and stacks the two parts on a narrow screen.
- Lists show their value at each step.
Settings#
The number mode button on the toolbar (Approx, Auto or Exact) sets how numbers are kept, and is saved with the program:
- Approx: division gives decimals, as in Python.
- Auto: whole numbers and fractions stay exact.
- Exact: decimals are also read as fractions.
The angle button beside it is Radian or Degree. CASSim ▸ Settings… has:
- the code style and symbols the translation writes;
- line numbers;
- the typing aid, on by default. It turns
<-into←,<=into≤,\piintoπ,x^2intox²and so on, a moment after you stop typing.
Views#
CASSim ▸ Computer view, Tablet view or Handheld view (Alt+Shift+C, T or H) chooses the layout. Computer has two columns with a bar between them to drag (on a narrow window they stack); Tablet has the two columns without the bar; Handheld stacks the panes one above the other. Start in, in CASSim ▸ Settings…, chooses the view CASSim opens in.
On a phone#
The view follows the way you hold it: Handheld upright, with the panes one above the other, and Tablet on its side (Computer view is greyed). The typing aid is the quickest way to get ←, ≤, ≠ and powers.