Algorithm Flowcharts: User & Teacher Guide
Draw algorithms as flowcharts in the Moodle editor, run them step by step and back again, watch arrays being sorted, measure how fast an algorithm grows, see the code in twelve languages, draw with a turtle, work with files, and grade quiz answers automatically.
The flowchart editor in the Algorithm button of the editor: blocks, functions, the interpreter, the code panel, turtle graphics and files.
Shows interactive diagrams on pages, in forums and in assignments: Run, Step, variables, code, and exercises where students edit and test their own copy.
Students draw the algorithm in a quiz; the answer is graded automatically with tests computed from the teacher's solution.
1. Drawing an algorithm
Click a + sign to insert a block, or drag a block onto a + sign. Click a block to change it in the panel beside the diagram.
- Blocks: Declare, Assign, Input, Output, If, For, While, Do … While, Call, Return, Break, Continue and Comment, the turtle blocks and the file blocks. Several functions, with parameters and return values.
- Editing: Undo and Redo; Ctrl + C, X, V and D copy, cut, paste and duplicate blocks, also between diagrams.
- Comments on blocks: every block can have a comment, shown as a tooltip on a small bubble. In the reader view the Comments switch numbers the bubbles and lists all comments under the diagram.
- Help: File, Operators and functions (or the link under a block with an expression) lists the operators and functions with an example and its result.
- File menu: a library of school algorithm templates, Flowgorithm .fprg import and export, copy the picture, save as SVG or PNG.
- Full screen: the button beside the close button makes the editor dialog fill the window.
2. Running and stepping
- Run runs the algorithm to the end; Step goes one block on. The current block and the branch each condition takes are marked.
- Input: when an Input block is reached, a field in the console asks for the value, which must fit the type of the variable.
- Speed and breakpoints: the slider sets the speed; F9 sets a breakpoint where Run stops.
- Step back and the timeline: ◀ Back (F8) takes the algorithm one step back, and the slider under the buttons goes to any step of the run, also after it has ended. The variables, the console, the drawing and the files are as they were at that step. Random numbers and the values entered stay the same; going back before an Input asks for the value again, so another value can be tried.
- Variables and trace table: the variables panel shows every variable, arrays and matrices too; the trace table lists each step with the values after it.
- Warnings and errors: before a run the console warns about blocks that never run or a variable declared twice; an error marks the block where it happened.
3. Code in twelve languages
The code panel shows the algorithm in pseudo-code, Python, C, C++, Java, C#, JavaScript, TypeScript, PHP, Pascal, Visual Basic, Go, Rust, Kotlin. A click on a block marks its lines in the code, and a click on a line selects its block.
- Site: the administrator chooses the default language and the languages offered.
- Course: Course, More, Filters, Algorithm viewer, Settings: a language for the course, for every algorithm if wanted, and locked for students if wanted.
- Algorithm: the language chosen in the code panel of the dialog, and Students see only this language.
4. Turtle graphics
The blocks Forward (with the pen down or up), Turn (right or left, in degrees), Pen (ten colours), Home and Clear move a turtle that starts in the centre and looks up. The Drawing panel shows the lines while the algorithm runs or steps. The Python code uses the turtle module.
5. Files
Open (for reading, writing or appending), Read (the next line into a variable), Write and Close, with the function EOF() for a loop that reads a file to its end. The files are kept with the algorithm and edited in the Files panel; the files the algorithm writes appear there and can be downloaded.
6. Exercises and quiz questions
- Exercises in any content: tick Students can edit and test the algorithm; students change their own copy, run the tests and may show the solution when the teacher allows it. The copy is kept on the server too, so a student who starts at school continues at home on another device (the newer copy wins).
- Quiz questions: the teacher draws the solution and may give a starting template; the tests need only the inputs, the expected outputs are computed from the solution.
- Grading: hidden tests, weights, function tests, comparison options, required structures (If, For, While, Do loop, array, matrix), hints and several tries. Answers that use files are graded with the files of the solution.
- Parsons problems: tick Parsons problem in the question: students get the blocks of the solution in a random order (loops and branches empty, and up to five extra blocks with a small mistake) and move them to their places. Try the third question of the quiz in this course.
- Efficiency: a question can also ask for a fast algorithm: at most k times the steps of the solution in every test, steps that grow at most like n, n log n or n², and at most so many blocks. An answer that passes the tests but is too slow loses the penalty the teacher sets, and the feedback says why. The fourth question of the quiz starts from a slow algorithm.
- AI hints (optional): on a site with an AI provider the administrator can switch on AI hints: after an error the console has Explain with AI and a failed test Hint from AI. The AI gets the algorithm and the error or the test, and is told never to give the solution; in a quiz only questions with the option AI hints allow it. This demo site has no AI provider.
- Class work: in an exercise the teacher has a Class work button: the copies the students are changing, as small diagrams with their test results, refreshed every 10 seconds. A click shows one large on the projector; Hide the names keeps the class anonymous.
7. Arrays and matrices
Declare an array with a size, or a matrix with two sizes, and use a[i] and m[i, j]. Indexes start from 0. The variables panel shows a matrix as a small table.
- Arrays panel: while the algorithm runs or steps, its arrays are drawn: numbers as bars, other values as boxes, a matrix as a grid. The elements the last block read are yellow and those it wrote green, so every comparison and swap can be seen. The variables used as an index (i, j, low, high) point at their element with an arrow.
- Try it: File, Templates…, Arrays has Bubble Sort, Selection Sort and Binary Search. Load one, press Step a few times and watch the bars.
- Call tree (recursion): an algorithm with functions has a Call tree panel: every call is drawn under the call that made it. The running call is blue, a finished call shows the value it returned, and a call made again with the same arguments is amber. Try File, Templates…, Recursion, Fibonacci (recursive) with n = 5: 15 calls, 9 of them repeated work.
- Records: File, Records… defines a type such as
Studentwith the fieldsname: String, avg: Real. Declare a variable or an array of the type Student and uses.nameora[i].avg; an assignment copies the whole record, and the code panel shows the type in every language (a dataclass, a struct, a class). Try File, Templates…, Records, Students (records).
8. How fast does it grow? Complexity
File, Complexity… in the editor (or the Complexity… button under a diagram) runs the algorithm for several sizes n, for example 10, 20, 50, 100, 200 and 500, and counts its steps.
- What is n: the value of an Assign such as
n = 8, or the first value the algorithm reads. The values it reads after n are random numbers, the same in every measuring. - The chart: the steps against n, beside the grey curves n, n log n and n². Under the chart the growth that fits best is named, for example the steps grow like O(n²), and a table lists the numbers.
- Compare: choose a template, for example Selection Sort beside your Bubble Sort, and both are drawn in one chart.
9. Code to diagram
File, Code to diagram… makes a flowchart from Python code: paste the code and click Make the diagram. Functions, input() and print(), if / elif / else, while, for … in range(), lists, matrices and f-strings become blocks, with their Declare blocks. A line that has no block becomes a comment and is listed, so nothing is lost. Undo brings the old diagram back.