Turn over ?
1 7 This question will further change the rules of the game.
When a piece is promoted to a dame, the player who the new dame belongs to now
chooses one of the opponent’s pieces. This piece is removed from the board and the
dame is placed in the square the removed piece was in.
1 7 . 1 State the identifier of the data structure that now needs to be passed as a parameter
into the subroutine MoveDame.
[1 mark]
What you need to do:
Task 1
Amend the subroutine MoveDame.
This subroutine is to:
? ask the player the piece ID of the opponent’s piece they want to remove
? check that the piece is an opponent’s piece and is on the board
? remove the opponent’s piece
? return the coordinates for the new dame.
Task 2
Amend the calls to MoveDame from within the subroutine MovePiece.
You will need to amend the parameter list of the subroutine heading of MovePiece
and the call to MovePiece from within the subroutine MakeMove.
Task 3
Test that the changes you have made work by conducting the following test:
? run the program
? enter Y
? load game3.txt
? move a2 to row 7, column 0
? take piece b1
Task 4
? move b5 to row 0, column 3
? take piece a6
Question 17 continues on the next page
14
IB/M/Jun19/7516/1
END OF QUESTIONS
Evidence that you need to provide
Include the following evidence in your Electronic Answer Document.
1 7 . 2 Your PROGRAM SOURCE CODE for the entire subroutine MoveDame and the
entire subroutine MakeMove.
[9 marks]
1 7 . 3 SCREEN CAPTURE(S) showing the requested test including the board display after
piece b1 has been taken.
[1 mark]
1 7 . 4 SCREEN CAPTURE(S) showing the requested test including the board display after
piece a6 has been taken.
[1 mark]
版权所有:留学生程序网 2020 All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。