Question 6(b)(ii) 2016 · May-June · Paper 42 · 0 marks
Reveal official mark-scheme answer
Official answer for Question 6
Part (b)
(ii)
Part (b)
(ii)
Question 42
Question 42
Show text version of question
Question 6
Part (b)
(ii)
Question 6
In a board game, one player has white pieces and the other player has black pieces. Players take alternate turns to move one of their pieces. White always makes the first move. The game ends if: • a player is unable to make a move when it is their turn. In this case, there is no winner. This is called ‘stalemate’. • a player wins the game as a result of their last move and is called a ‘winner’.
Part (b)
The layout of the board at the start of the game is shown below:
x y
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
Question 15
The programmer decides to use a 2D array to represent the board. The index numbering to be used is as shown. Each square on the board is either occupied by one piece only, or is empty. The data stored in the array indicate whether or not that square is occupied, and if so, with a black piece or a white piece.
(ii)
When a piece is to be moved, a procedure will calculate and output the possible destination squares for the moving piece.
This will be a move: • either to an empty square, with no occupied squares on the way • or to a square containing a piece belonging to another player, with no occupied squares on the way. The other player’s piece is then removed. For example, for the circled black piece there are nine possible destination squares. Each of the two destination squares contains a white piece which would be removed. x y
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
The program requires a procedure ValidMoves.
Question 1
It needs three parameters:
Question 2
Question 3
• PieceColour – colour of the moving piece • xCurrent
- current x position
Question 4
• yCurrent
- current y position
Question 5
The procedure will calculate all possible destination squares in the x direction only.
Question 6
Why this question appears here
72% assigned-topic match · Hardware › Logic gates and logic circuits
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_s16_qp_42.pdf
