OCR Computing A-Level Revision


Light Bot (2.1.f)

An algorithm is a set of rules to solve a problem. A recipe from a cook book could be considered to be an algorithm. Below is a game called "Light Bot", which demonstrates creating simple algorithms.

The object of the game is to turn all the blue squares yellow. In later levels, you will need to use the subroutines (labelled f1 and f2), as you do not have enough space in the main method.

Flowcharts (2.1.g)

Flowcharts are a simple, visual way to describe algorithms. They are made up of 4 key shapes:

Rectangle (with rounded corners) - start / stop _(n.b. there can be multiple "start" blocks, although there is normally only 1).
Rectangle - process, any operation which does not involve making a decision, taking an input, or displaying an output.
Diamond - decision, there should be one "entry" point, and at least two "exit" points (for example, true and false).
Parallelogram - input or output.

The four key flowchart symbols

It's important that every flowchart includes "start" and "stop" symbols, as they can be worth a mark each. Generally, exam questions will either require you to create a flowchart based on a problem, or complete a flowchart where part of the flowchart has been given to you.

Pseudo Code (2.1.h)

Pseudo code is similar to real code, but without syntax, allowing flexibility. It means the code produced does not need to use the exact syntax of any single programming language. See 2.4.2 Operators and 2.4.3 String Manipulation for concepts which could be used in pseudo code (although you do not need to learn the syntax). Often, questions will give a problem, and ask you to produce an algorithm in pseudo-code.

Evaluating Algorithms (2.1.i)

Some questions will ask you to read through an algorithm (although it could be shown using a flowchart) and show, line by line, how an output will be calculated for a set of given inputs. Alternatively, you might be asked to explain how you would modify an algorithm given a change in the problem.