A-level Computing/AQA/Paper 1/Skeleton program/AS2019

This is for the AQA AS Level Computer Science Specification.

This is where suggestions can be made about what some of the questions might be and how we can solve them.

Please be respectful and do not vandalise or tamper with the page, as this would affect students' preparation for exams! Please do not discuss questions on this page. Instead use the discussion page:Talk:A-level Computing/AQA/Paper 1/Skeleton program/AS2019

Make Player skip turn
Allow player 'a' and 'b' to be able to skip their turn

created by accident, like louis

Input file ends with ".txt"
The user has to enter a file which ends with ".txt", else it will add it for them.

Coded by Sol, of Brockenhurst College. Coded by accident

Coded by Nevans the knowledgeable of Kennet School

boolean setUpBoard(String[][] board, int[][] a, int[][] b, boolean fileFound) { String fileName = "game1.txt"; Console.write("Do you want to load a saved game? (Y/N): "); String answer = Console.readLine; if (answer.equals("Y") || answer.equals("y")) { Console.write("Enter the filename: "); fileName = Console.readLine; // oh look at me my name is nathen and i think im soooo smart compared to others! Well guess what see why fact checkers say this is false. fileName = fileName.endsWith(".txt") ? fileName : (fileName += ".txt"); }       try { BufferedReader fileHandle = new BufferedReader(new FileReader(fileName)); fileFound = true; a = loadPieces(fileHandle, a); b = loadPieces(fileHandle, b); fileHandle.close; createNewBoard(board); addPlayerA(board, a); addPlayerB(board, b); } catch (IOException e) { displayErrorCode(4); }       return fileFound; }

Display number of moves taken.
Displays the number of moves taken after each turn.

void game { int[][] a = new int[NUMBER_OF_PIECES + 1][3]; int[][] b = new int[NUMBER_OF_PIECES + 1][3]; String[][] board = new String[BOARD_SIZE][BOARD_SIZE]; MoveRecord[] listOfMoves = new MoveRecord[MAX_MOVES]; boolean gameEnd = false; boolean fileFound = false; String nextPlayer = "a"; int pieceIndex; fileFound = setUpBoard(board, a, b, fileFound); if (!fileFound) { gameEnd = true; }       while (!gameEnd) { printPlayerPieces(a, b); displayBoard(board); Console.writeLine("Next player: " + nextPlayer);

//Outputs a line which indexes parts of array a and b which are incremented every turn System.out.println("PLAYER A HAS TAKEN " + a[0][0] + " MOVES"); System.out.println("PLAYER B HAS TAKEN " + b[0][0] + " MOVES");

listOfMoves = clearList(listOfMoves); if (nextPlayer.equals("a")) { listOfMoves = listPossibleMoves(board, a, nextPlayer, listOfMoves); if (!listEmpty(listOfMoves)) { pieceIndex = selectMove(listOfMoves); makeMove(board, a, b, listOfMoves, pieceIndex); nextPlayer = swapPlayer(nextPlayer); } else { gameEnd = true; }           } else { listOfMoves = listPossibleMoves(board, b, nextPlayer, listOfMoves); if (!listEmpty(listOfMoves)) { pieceIndex = selectMove(listOfMoves); makeMove(board, b, a, listOfMoves, pieceIndex); nextPlayer = swapPlayer(nextPlayer); } else { gameEnd = true; }           }        }        if (fileFound) { printResult(a, b, nextPlayer); }   }

Coded by James Trenaman of Kennet School

Displays error value meanings
Error values 1-4 don't have any notation as to what each error means. Add a description for each one when displayed.

Coded by Sol, of Brockenhurst College.

Allow taking of other players pieces as in draughts
The original game of Checkers (or Draughts, as I'd prefer to call it) is a game where you are able to 'jump over' your opponent's pieces to take them off the board. In the skeleton, you aren't able to do as such. To add this gameplay mechanic, you'd want to edit the ValidJump and MakeMove methods, but it may be difficult as it requires understanding of the data structures used.

Save the game
Add a new function/method called from Game. All elements in the arrays can be saved, there is no requirement to miss the first element off of each array. Look at SetupBoard and LoadPieces for better understanding.

Created by accident

Allow saves to specify the next player
Currently, all saved games will give the next turn to A, even if A was the last player to have a turn. This is unfair to the person playing as B. You will need to modify both your implementation of savegames and the game's own load game and main subroutines to achieve this.

Don't allow move to create dame under certain conditions
If there is no room for the dame to be created, don't allow the move to be made. You may want to edit ListPossibleMoves to do this.

Coded by Sol, of Brockenhurst College.

Allow the dame to have better movement
The dame seems a bit bland. Why not allow the dame to move 2 spaces vertically as well? Or 2 spaces diagonally? I would recommend doing it all in ListPossibleMoves, by setting up a bool to be set to True if the current piece is a dame, and add a new selection statement after the existing move checks that adds to the list the new movement. It is quite easy to test using game3.txt. Perhaps allow it to move like a Queen from chess? Or at least be able to move backwards.

Player B is controlled by the computer
Have an AI control B instead of having another player do it. It isn't too difficult to set up. I would recommend replacing the function call to SelectMove in Game with a new function to generate a valid number for pieceIndex. The way the AI works can be up to you, whether it is just random or actually has a strategy to it.

Allow the user to create a custom game file
Give the user the option to add a custom game file (as in, create another default file to pick from (e.g game5.txt)), and allow the user to dictate the starting positions of the pieces, as well as the number of pieces and the type of pieces.

Double jump as in Draughts
The original game of Draughts allows 'double jumps', where if you make a jump and are able to make a second after aforementioned jump, you are able to if you so choose. You can use game3.txt to help using the a6 piece.

Try next row to add dame
Similar to a previous question: if there is no space to create a dame on the home row, try the next row on, and continue to do so until it can place a dame.

Random player starts
Random player starts

created by accident

Use for 'game4.txt'
When a player has no possible moves available when it is their turn, the game ends and that player has lost the game. Rather than losing the game under these circumstances, it has been suggested that if the player has a Dame piece on the board, the Dame can be moved to any empty square at the opposite end to their home end. (Row 7 for Player A, Row 0 for Player B)