Question 6

OCR Computer Science November 2020 Paper 1A level8 marks

On the specification

2.2 Problem solving and programming
Question text

6 Two people play a counting game. The rules of the game are as follows: • The first player starts at 1 • Each player may choose one, two or three numbers on their turn and the numbers must be in ascending order • Players take it in turns to choose • The player who chooses “15” loses the game. For example, if the first player chooses three numbers (1, 2, 3) then the second player could choose one number (4), two numbers (4, 5) or three numbers (4, 5, 6). The first player then takes another go. Write an algorithm using pseudocode that allows two players to play this game. The algorithm should: • Alternate between player 1 and player 2 • Ask the player how many numbers they would like to choose, ensuring that this is between 1 and 3 • Display the numbers that the player has chosen • Display a suitable message to say which player has won once the number 15 has been displayed. [8]