Question 17
AQA Computer Science June 2025 Paper 1 (7516/1)AS13 marks
On the specification
- 17.1
- 3.1 Fundamentals of programming3.2 Fundamentals of data structures
- 17.2
- 3.3 Systematic approach to problem solving
Question text
17 This question extends the functionality of the Skeleton Program. If the pirate stands one square to the west of the hut (H), a clue about where the treasure is buried will be displayed. What you need to do: Task 1 Write a new subroutine WestOfHut that checks the pirate’s position. If the pirate is one square to the west of the hut the subroutine should return true; otherwise it should return false. Your solution should work for any map, not just the map provided in the data files. Task 2 Write a new subroutine GetClue that finds the position of the rock (R) on the map and the position of the treasure (T) on the hidden map. The distances (number of squares) between the rock and the treasure are to be calculated in the north-south direction and the east-west direction. The subroutine should display these distances with suitable messages. For example, in Figure 7, the distance between the rock and the treasure is 1 square in the north-south direction and 3 squares in the east-west direction. Figure 7 T ...R Your solution should work for any map, not just the map provided in the data files. A map always has one rock and one treasure. Task 3 Amend the subroutine PirateWalks so that it calls the WestOfHut subroutine after the pirate has finished walking to check whether the pirate is one square to the west of the hut and, if so, calls the GetClue subroutine. Task 4 Test that the changes you have made work by conducting the following test: • run your amended Skeleton Program • if you have answered Question 16, select for the pirate to land where the X is located on the map. • enter W • enter 9NE • enter W • enter 6E Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 17.1 Your PROGRAM SOURCE CODE: • for the entire subroutine WestOfHut • for the entire subroutine GetClue • for the entire subroutine PirateWalks. [12 marks] 17.2 SCREEN CAPTURE(S) showing the requested test described in Task 4. The SCREEN CAPTURE(S) must show the map with the pirate’s position as well as the displayed clue. [1 mark]