Question 16
AQA Computer Science June 2019 Paper 1AS10 marks
On the specification
- 16.1
- 3.1 Fundamentals of programming
- 16.2
- 3.3 Systematic approach to problem solving
Question text
16 This question refers to the subroutine PrintResult. The rules of the game are to be amended. The game still ends when a player cannot make a move, but the winner is to be determined using a formula that calculates a score for each player. The winner is the player with the lowest score. The formula to calculate the score is shown in Figure 5. Figure 5 Player’s score = Number of that player’s moves minus total number of player’s pieces on the board minus number of that player’s dames multiplied by 10 For example, if Player A made 40 moves and has 12 pieces on the board, and 3 of them are dames, then Player A’s score is 40 – 12 – (3 × 10) = -2 Note that a dame is also considered to be a piece. What you need to do: Task 1 Create a new subroutine CountNumberOfPieces. This subroutine is to count the number of pieces a player has on the board. Task 2 Amend the subroutine PrintResult to implement the formula given in Figure 5 and output the score for each player and display the winner. You must consider the possibility of a draw. Task 3 • run the program • enter Y • load game4.txt Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 16.1 Your PROGRAM SOURCE CODE for the entire subroutine CountNumberOfPieces and the entire subroutine PrintResult. [9 marks] 16.2 SCREEN CAPTURE(S) showing all the output from the requested test including the board display. [1 mark]