Question 16

AQA Computer Science June 2023 Paper 1 (7517/1)A level13 marks

On the specification

16.1
3.1 Fundamentals of programming3.2 Fundamentals of data structures
16.2
3.3 Systematic approach to problem solving
Question text

16 This question extends the program by telling the player how many legal moves they have in the current state of the game. A legal move is when, using one of the first three move options in their move option queue, a player’s piece will move to a square that contains an opponent’s piece or to a square that does not contain a piece. There are 45 legal moves at the start of the game for the first player. When answering this question, you should ignore the option to use the move option offer and the option to use a bhukampa (from Question 14) as these do not count as moves. What you need to do Task 1 Create a new method called GetNoOfPossibleMoves in the Player class that takes Board as a parameter and returns the total number of possible legal moves for that player based on the contents of the squares in the Board list. Task 2 Modify the DisplayState method in the Dastan class so that it displays the value returned by a call to GetNoOfPossibleMoves for the current player. Task 3 Test that the changes you have made work: • run the Skeleton Program • enter 1 • enter 22 • enter 12 Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 16.1 Your PROGRAM SOURCE CODE for the new method GetNoOfPossibleMoves and the amended method DisplayState. [12 marks] 16.2 SCREEN CAPTURE(S) showing the requested test with the number of legal moves for the second player displayed. [1 mark]