# A-level Computing 2009/AQA/Problem Solving, Programming, Data Representation and Practical Exercise/Skeleton code/2015 Exam/Section D

I just wanted to say good luck to all on results day after that nightmare of a paper! And good luck to any future years who attempt this in class, you'll need it!
It isn't an extremely bad paper, the FEN question (if someone wants to make a solution) just needed you to do something similar to the display board function, and then express blanks as numbers (I admit, I didn't have time to do that!)

## Give user option to selectively place pieces onto board.

Currently when the sample game is set up, all of the pieces are positioned in certain places. Edit the program to give the user an option to create their own sample game.
Python Solution
Answer:
VB.NET solution
Answer:

## Give an option to exit game

When asking for the coordinates for the startPosition, give an option for the user to exit game.
VB.Net Solution
Answer:
Java Solution
Answer:
void getMove(Position startPosition, Position finishPosition) {
Pascal Solution
Answer:
Procedure GetMove(Var StartSquare, FinishSquare : Integer); Begin
End;
Python Solution
Answer:

## Skill trees and levelling up

Add skill trees to the game so that pieces can learn new abilities and skills upon capturing enemy pieces. For students seeking a challenge at some advanced programming.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Add more options to menu

When you start capture the Sarrum you are asked: "Do you want to play the sample game (enter Y for Yes)? ", Add an option that would allow you to say No to start a new game and then an option to close the program.
VB.Net solution
Answer:
OR
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Give user option to randomly place pieces onto board

Currently when the board is initialised, all of the pieces are positioned in the same place. Edit the program to give the user an option to randomly place the pieces onto the board.
VB.Net solution
Answer:
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Promote Marzaz Pani to Kashshaptu when it reaches home rank

Add a rule that Marzaz Pani (royal attendant) pieces can be promoted to a Kashshaptu (witch) piece if it reaches the front rank (the eighth rank for a white redum, the first rank for a black redum). (NB Makemove already contains code for promoting Redum to Marzaz Pani) This would involve adding the Kashshaptu (witch) piece - which could have the same movement as a queen in chess.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Prevent pieces from moving backwards

Add a rule to CheckMoveIsLegal that means all pieces can only move forward and can not retreat
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Add new piece that behaves like knight in chess

Add a new piece that behaves like a knight in chess - see here for details
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution Jamal Arif of Nelson and Colne College
Answer:
VB6.0 Solution
Answer:

## Allow Sarrum and Gisgigir to castle (as with king and rook in chess)

Allow a Sarrum (king) and Gisgigir (chariot) to castle (as in chess with a king and rook).
See here for details on castling in chess
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Track number of moves

Add variables to keep track of how many moves each player has had. Add an option to limit a game to 10, 20, or 50 moves - with who ever has the most pieces left after said moves declared the winner.
VB.Net solution
Answer:
VB.Net solution alternative
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Allow the player to save the game

This is not a short game, so allow a player to save the game by saving the board array and which play goes first.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
OR alternative answer

## Prevent program from crashing, when entering incorrect coordinates

There are 2 coordinates to enter. If the first is entered incorrectly, you can still enter the second and then it crashes. Fix this.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
OR can change getMove
VB6.0 Solution
Answer:

## Add a new piece to the game: Kashshaptu

Add the Kashshaptu to the game, the Kashshaptu can move in any direction, any number of spaces, but cannot jump. Replace the Marzaz Pani with this piece.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Add a variable to display the number of pieces each player has

An option will appear after or before a move is made so that the user can choose to see the number of pieces he or she has left on the board.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Add taken pieces Counter

Separate taken pieces counter for White and Black
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Prevent pieces moving off the top or left edge of the board

Currently, you can move pieces into the 0 files or ranks.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:
A-level Computing 2009/AQA/Problem Solving, Programming, Data Representation and Practical Exercise/Skeleton code/2015 Exam/Section D

## Allow the Redum to move two pieces as its first move.

Pawns in chess are allowed a "double" move, however only out of their starting position.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Print if moving piece does not belong to current player

The initial program does not allow a player to move their enemy's pieces but only prints the normal "please try again" message. This prints a specialised message if you try to move a piece which does not belong to you.
VB.Net solution
Answer:
Python Solution
Answer:
Patch file: not-your-piece.patch
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Remove the restriction of one tile on the Nabu

Make the Nabu like a bishop in chess, can move any number of tiles diagonally.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Add a way to forfeit the game

Add an option to forfeit each turn (similar to the way you can knock over your king in chess).
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Use GetTypeOfGame to ask the user what type of game they want to play

Currently the program does not use GetTypeOfGame when asking the user whether they want to play a sample game or not. Make the program use GetTypeOfGame to ask the user whether they want to play a sample game or not.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Change the size of the board

The size of the two dimensional array that holds the board is defined by the constant BoardDimension. Change the size of the board to be bigger (for example: 10 by 10)
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Add a point scoring system

Give players a score based on how many pieces they have taken. Additionally give each piece taken its own unique score. Display the score on the players move and display both scores at the end of the game.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Allow the Redum to perform an 'en passant' move

En passant "is a special pawn capture, that can only occur immediately after a pawn moves two ranks forward from its starting position, and an enemy pawn could have captured it had the pawn moved only one square forward". The program code could be adapted to allow Redums to use such a move.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Only allow the user to enter one character when choosing the type of game

Currently, when the user is able to choose the type of game they are able to enter multiple characters, this should be limited to one character excluding numbers
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Allow the user to undo a move

Possibly save the game after every move and allow them to load a previous state of the board?
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Prevent the program from crashing when enter is pressed without any input

This may only be an issue on Python, I don't know if this would cause crashes on other programming languages.
VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:
VB6.0 Solution
Answer:

## Change Colour of pieces

Currently the board is in Black and white text, This is difficult to read and understand. Add visible different colours to the pieces to make it easier to distinguish between the two sides.
VB.Net solution
Answer:
Python solution
Answer:

## Change the Etlu to behave like a knight in chess

VB.Net solution
Answer:
Python Solution
Answer:
Java Solution
Answer:
Pascal Solution
Answer:
C# Solution
Answer:

## Perhaps add demonstration game to demonstrate a move eg Castling

VB.Net
Answer:
Java Solution
Answer:

## Choose what piece the redum is promoted to when it reaches the end of the board

VB.Net
Answer:
Python
Answer:

## Make program exit upon a wrong input entered

VB.NET Solution
Answer:
Python Solution
Answer:

## Modify the program such that you can play against the computer

'Advanced' Solution
Answer:
The code for this solution is too long to post here. It can be found at github with an explanation for the code at Hillsoft Blog. It is also able to win against everyone in my class.
Pascal Solution
Answer:
Java Solution
Answer:
Java Solution
Answer:
Python Solution
Answer:

## Promote Redum to Kashshaptu when it reaches home rank

Add the rule that the Redum (Soldier) pieces is promoted to a Kashshaptu (Witch) piece if it reaches the other side of the board from where it stated. The Kashshaptu will then move like the Queen in chess.
Python Solution
Answer: