Question 4

OCR Computer Science June 2019 Paper 2A level27 marks

On the specification

(a)
2.1 Elements of computational thinking2.2 Problem solving and programming
(b)(i)
2.1 Elements of computational thinking
(b)(ii)
2.1 Elements of computational thinking
(b)(iii)
2.2 Problem solving and programming
(c)
2.3 Algorithms
(d)
2.2 Problem solving and programming
Question text

4 Mabel is a software engineer. She is writing a computer game for a client. In the game the main character has to avoid their enemies. This becomes more difficult as the levels of the game increase. (a) Mabel uses decomposition to design the program. Explain how decomposition can aid the design of this program. [2] (b) The computer game allows a user to select a character (e.g. name, gender). They can then choose a level for the game (easy, normal, challenging). The user controls their character by moving it left or right. The character can jump using space bar as an input. If the character touches one of the enemies then it loses a life. The character has to make it to the end of the level without losing all their lives. The game is designed in a modular way. (i) One sub-procedure will handle the user input. Describe three other sub-procedures Mabel could create for the given game description. 1 2 3 [6] (ii) Describe the decision that the program will need to make within the user input sub- procedure and the result of this decision. [2] (iii) Define pipelining and give an example of how it could be applied in the program. [2] (c) The game’s ‘challenging’ level has intelligent enemies that hunt down the character in an attempt to stop the user from winning. The program plans the enemies’ moves in advance to identify the most efficient way to stop the user from winning the game. The possible moves are shown in a graph. Each node represents a different state in the game. The lines represent the number of moves it will take to get to that state. 4 1 B E A 1 H 22 1 D 4 C 3 F 2 G Show how Dijkstra’s algorithm would find the shortest path from A to H. [6] (d)* Mabel has been told that true programmers write programs in a text editor, and do not use IDEs. Mabel does not agree with this statement. Discuss the use of an IDE in the development of this program. [9]