Skip to content

Identifying Decision Points

2.1.4 Thinking logically · Paper 2 · 2 flashcards · 1 question

Thinking logically means working out, before any code is written, where a solution has to choose between alternatives and what each choice depends on.

Definition
A decision point is a place in an algorithm where a condition is tested and the answer, true or false, determines what happens next. In a flowchart it is drawn as a diamond with two labelled exits; in code it is an if or switch statement, or the condition of a loop.

Finding the Decision Points

Key Point
Where decisions are taken in a solution:
• Wherever the description says if, otherwise, unless, depending on, until or while
• Wherever an input has to be validated before it is used
• Wherever a loop has to decide whether to repeat or to stop
• Wherever the user chooses between options, such as a menu
Worked Example
Worked Example: A Turn in a Board Game

A player rolls a dice, moves that many squares and follows any instruction on the square. The first player to reach square 100 wins, and the game is a draw if a 30-minute timer runs out.
Decision pointCondition testedIf trueIf false
After movingDoes the square have an instruction?Move the number of places it saysStay on the square
After any extra moveIs the player on square 100?Announce the player as the winnerCarry on with the game
After each turnHas the timer reached 0?Announce a drawPass the turn to the next player
A decision point is found wherever the algorithm could do one of two different things.