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

This is for the AQA A 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 the page, as this would affect students' preparation for exams!

Please do not discuss questions on this page. Instead use the discussion page.

Section C Predictions
The 2024 paper 1 will contain 3 questions worth 11 marks in total (one 3 marker one 2 marker and one 6 marker). As long as you know the program well i.e. that understanding each line of code and and you know what each line of code does, you can also do this by using Chatgpt and Gemini and its important you use all the tools availble to you, this will be dead easy. I'm predicting this year there will be a question on Inheritance about the cell and they will ask what it means so will be worth 3 marks. Also they could be a question on overriding and they could be a question about difference from the protected, private and public methods from looking at past papers.

Section D Predictions
Programming Questions on Skeleton Program


 * The 2024 paper 1 contains 4 questions: a 5 mark, a 6 mark question and two 14 mark questions - these marks include the screen capture, so the likely marks for the coding will be 1-2 marks lower. On top of this, can someone please add some more solution in VB.net for these problems. Message for moderator - I added a question I think could come up please put a link up then delete this message - Thanks for such a brilliant resources you have provide for help for all students!
 * The 2023 paper 1 contains 4 questions: a 5 mark, a 9 mark question, a 10 mark question and one 13 mark question - these marks include the screen capture(s), so the likely marks for the coding will be 1-2 marks lower.
 * The 2022 paper 1 contained 4 questions: a 5 mark, a 9 mark question, a 11 mark question and one 13 mark question - these marks include the screen capture(s), so the likely marks for the coding will be 1-2 marks lower.
 * The 2021 paper 1 contained 4 questions: a 6 mark, an 8 mark question, a 9 mark question and one 14 mark question - these marks include the screen capture(s), so the likely marks for the coding will be 1-2 marks lower.
 * The 2020 paper 1 contained 4 questions: a 6 mark, an 8 mark question, a 11 mark question and one 12 mark question - these marks include the screen capture(s), so the likely marks for the coding will be 1-2 marks lower.
 * The 2019 paper 1 contained 4 questions: a 5 mark, an 8 mark question, a 9 mark question and one 13 mark question - these marks include the screen capture(s), so the marks for the coding will be 1-2 marks lower.
 * The 2018 paper 1 contained 5 questions: a 2 mark question, a 5 mark question, two 9 mark questions, and one 12 mark question - these marks include the screen capture(s).
 * The 2017 paper 1 contained 5 questions: a 5 mark question, three 6 mark questions, and one 12 mark question.

Current questions are speculation by contributors to this page.

Question 1 - Symbol Case [3 marks]
Lower case symbols are not accepted. E.g. if you enter 'q' it is not recognized as 'Q'. Fix this.

Easy solution just add .ToUpper and it will change your lowercase inputs to uppercase and allow them to work.}}

A simple solution, just add UCase to change all input to upper case.

Question 2 - Game file not existing [4 marks]
If a filename is entered that does not exist, the game is unplayable (infinite loop). Amend the program so that in this case the default game is played, with a suitable message to indicate this.

}}

def __LoadPuzzle(self, Filename): try: with open(Filename) as f:               NoOfSymbols = int(f.readline.rstrip) for Count in range (1, NoOfSymbols + 1): self.__AllowedSymbols.append(f.readline.rstrip) NoOfPatterns = int(f.readline.rstrip) for Count in range(1, NoOfPatterns + 1): Items = f.readline.rstrip.split(",") P = Pattern(Items[0], Items[1]) self.__AllowedPatterns.append(P) self.__GridSize = int(f.readline.rstrip) for Count in range (1, self.__GridSize * self.__GridSize + 1): Items = f.readline.rstrip.split(",") if Items[0] == "@": C = BlockedCell self.__Grid.append(C) else: C = Cell C.ChangeSymbolInCell(Items[0]) for CurrentSymbol in range(1, len(Items)): C.AddToNotAllowedSymbols(Items[CurrentSymbol]) self.__Grid.append(C) self.__Score = int(f.readline.rstrip) self.__SymbolsLeft = int(f.readline.rstrip) except: print("Puzzle not loaded") Main

This helps to reset the code so that the program isn't stuck in an infinite loop trying to collect information that cannot be used. Allows the user another chance to re-enter the file name for the puzzle. Alternative approach --> The question asks us to only accept files that exist otherwise play a default game. I have used a function instead as it is more easier to remember.
 * 1) WikiBooks Q2

Main Sub isValid function

Question 3 - Blow up a block (blocked cell) [10 marks]
Have a 'bomb' that can remove or 'blow-up' a block in a 'blocked cell', but costs you some of your score (minus some points):

Adding another symbol B to the list to recognise it in the process.

And add a condition to the update loop (attemptPuzzle) for the "B" symbol

This adds a new symbol "B" which can only be played on a blocked tile.

Question 4 - Add additional symbols/letters [3 marks]
Add additional letters/symbols e.g. L or O or U or V or C or H or I.


 * The code here will allow you to get 10 points for creating an L shape in the grid.

If you look carefully, you can spot that the pattern recognition goes in a spiral:

0_1_2

7_8_3

6_5_4

So we are going to need to map our new letter the same way:

Example of "L":

L_*_*

L_*_*

L_L_L

Next, simply follow the pattern to create a string:

The way that the pattern checking works is in clockwise. This is the order

so the pattern for Q is QQ**Q**QQ, and if you place the symbols in that order, you get the correct pattern.

This allows the user to create an L pattern that results in them earning 10 points.

Dim LPattern As Pattern = New Pattern("L", "L***LLLL*") AllowedPatterns.Add(LPattern) AllowedSymbols.Add("L")

Question 5 - Save current game (status) [5 marks]
Save the current status of the game (file-handling)/writing to a text file.

}

Sub SaveGame Console.WriteLine("Enter filename") Dim filename As String = Console.ReadLine filename = filename & ".txt" Dim SR As New StreamWriter(filename) 'this is the number of symbols SR.WriteLine(AllowedSymbols.Count) 'this loops through the different symbols For i As Integer = 0 To AllowedSymbols.Count - 1 SR.WriteLine(AllowedSymbols(i)) Next 'this is the number of patterns SR.WriteLine(AllowedPatterns.Count) 'displays the different patterns For j As Integer = 0 To AllowedPatterns.Count - 1 SR.WriteLine(AllowedSymbols(j) & "," & AllowedPatterns(j).GetPatternSequence) Next 'this is the gridsize SR.WriteLine(GridSize) 'this writes out the grid For a As Integer = 0 To Grid.Count - 1 SR.WriteLine(Grid(a).GetSymbol & Grid(a).returnNotAllowedList) Next 'this is the current score SR.WriteLine(Score) 'this is the number of symbols left SR.WriteLine(SymbolsLeft) SR.Close End Sub

'cleaned version (above version has a few issues)

Public Overridable Function AttemptPuzzle As Integer Dim Finished As Boolean = False While Not Finished DisplayPuzzle Console.WriteLine("Current score: " & Score) Dim Valid As Boolean = False Dim Row As Integer = -1 While Not Valid Console.Write("Enter row number: ") Try Row = Console.ReadLine Valid = True Catch End Try End While Dim Column As Integer = -1 Valid = False While Not Valid Console.Write("Enter column number: ") Try Column = Console.ReadLine Valid = True Catch End Try End While Dim Symbol As String = GetSymbolFromUser Dim CurrentCell As Cell = GetCell(Row, Column)

If (Symbol = "bomb") AndAlso (Score >= 10) Then Dim i As Integer = ((GridSize - Row) * GridSize + Column) - 1 Grid(i) = New Cell Score -= 10

ElseIf Symbol = "Bomb" AndAlso Score < 10 Then Console.WriteLine("You do not have sufficient score to use this move") Else SymbolsLeft -= 1 If CurrentCell.CheckSymbolAllowed(Symbol) Then CurrentCell.ChangeSymbolInCell(Symbol) Dim AmountToAddToScore As Integer = CheckForMatchWithPattern(Row, Column) If AmountToAddToScore > 0 Then Score += AmountToAddToScore End If                   End If                    If SymbolsLeft = 0 Then Finished = True End If

Console.WriteLine("Would you like to save your puzzle and exit? (Y/N) ") If UCase(Console.ReadLine) = "Y" Then Console.WriteLine("What name would you like to save your puzzle as ? ") Dim new_filename As String = Console.ReadLine + ".txt" Dim error_status = SavePuzzle(new_filename) If Not error_status Then Console.WriteLine("Puzzle Successfully Saved. ") End If                   End If                End If            End While Console.WriteLine DisplayPuzzle Console.WriteLine Return Score End Function

Private Function SavePuzzle(filename As String) As Boolean

Dim SR As New StreamWriter(filename)

SR.WriteLine(AllowedSymbols.Count)

For i As Integer = 0 To AllowedSymbols.Count - 1 SR.WriteLine(AllowedSymbols(i)) Next

SR.WriteLine(AllowedPatterns.Count)

For j As Integer = 0 To AllowedPatterns.Count - 1 SR.WriteLine(AllowedSymbols(j) & "," & AllowedPatterns(j).GetPatternSequence) Next

SR.WriteLine(GridSize)

For t = 0 To Grid.Count - 1 Dim notAllowedSymbol As String

' Check if returnNotAllowedList is empty If Grid(t).returnNotAllowedList.Count > 0 Then notAllowedSymbol = Grid(t).returnNotAllowedList(0) Else notAllowedSymbol = "" End If

SR.WriteLine(Grid(t).GetSymbol & "," & notAllowedSymbol) Next

SR.WriteLine(Score) SR.WriteLine(SymbolsLeft) SR.Close

Return True End Function

Cell class:

Public Function returnNotAllowedList As List(Of String) Return SymbolsNotAllowed End Function

Alternative approach --> Its better to not modify the Cell class (unless its asked). I have also used string concatenation as its easier to remember during exam stress and is easier to understand/debug.

AttemptPuzzle method SaveGame method findSymbol method

Question 6 - Rotated letter/symbol [9 marks]
Score a 'rotated' symbol/letter (lower score?)

Rotated letters are given 5 points rather than 10.

Question 7 - Game difficulty setting [12 marks]
Offer 'game difficulty' setting to change level of game (with greater number of blocked cells)

(Important -> probably lower mark question than 11 makrs, e.g. 4 mark question)

Difficulty based on number of moves available

Sub Main Dim Again As String = "y" Dim Score As Integer While Again = "y" Console.Write("Press Enter to start a standard puzzle or enter name of file to load: ") Dim Filename As String = Console.ReadLine

'ADDED CODE - checks that the filename entered has a file existing in the DEBUG folder Dim fileExists As Boolean = False Dim FullFilename As String = Filename & ".txt" If FileIO.FileSystem.FileExists(FullFilename) Then fileExists = True End If

'AMENDED CODE - the if statement changed to use the boolean value above instead of           'using the text length Dim MyPuzzle As Puzzle If fileExists Then MyPuzzle = New Puzzle(Filename & ".txt") Else 'ADDED CODE Dim Dif As Integer Do                   Console.WriteLine("Enter a difficulty rating from 1-9") Dif = Console.ReadLine Loop Until Dif >= 1 And Dif < 10

'AMENDED CODE - difficulty rating affects the numbner of moves available MyPuzzle = New Puzzle(8, Int(8 * 8 * (1 - (0.1 * Dif)))) End If

Score = MyPuzzle.AttemptPuzzle Console.WriteLine("Puzzle finished. Your score was: " & Score) Console.Write("Do another puzzle? ") Again = Console.ReadLine.ToLower End While Console.ReadLine End Sub

Question 8 - Fix symbols placed error [9 marks]
When you try place a symbol in a invalid cell it still counts as a placed cell towards the amount of symbols placed.

Question 9 - Create a new puzzle file to be imported [5 marks]
Create a new puzzle file to be imported into the code for the user to play:

Question 10 - Be able to undo a move [10 marks]
Alter the attemptPuzzle subroutine such that the user is asked if they wish to undo their last move prior to the place in the loop where there is a check for symbolsLeft being equal to zero. Warn them that this will lose them 3 points.

If the player chooses to undo:

a.      revert the grid back to its original state

b.      ensure symbolsLeft has the correct value

c.      ensure score reverts to its original value minus the 3 point undo penalty

d.     ensure any changes made to a cell’s symbolsNotAllowed list are undone as required

Question 11- Validation of Row and Column entries [5 marks]
Description of problem: Validate row and column number entries to only allow numbers within the grid size.

Question 12 - Why is UpdateCell empty and never called?
Description of problem: Currently, the UpdateCell method contains 'pass' and is not called anywhere in the program. This will almost certainly be a question, otherwise why would they include it? This may relate to the bombing idea where a Blocked Cell is bombed, and the UpdateCell is then called to modify this Blocked Cell into a normal cell. Please suggest other ideas of what this method could be used for. Its probably used for changing a blocked cell in a pattern to a normal cell to complete a pattern.

UpdateCell could be used for unlocking a 3*3 grid if a pattern is broken allowing you to replace the symbol. This would also need to decrease the score after the pattern is broken.

There are no logical errors with GetCell as the following extract will prove

However, if row and column values beyond that of the grid are entered, errors will occur. See solution for Question 12 to solve this issue.

Question 13 - Implement a wildcard *
Implement a special character * which is a wildcard. The wildcard can be used to represent any character so that multiple matches can be made with the same cell. Give the player 3 wildcards in random positions at the start of the game.

a) Alter the standard Puzzle constructor (not the load game one) to call ChangeSymbolInCell for 3 random cells, passing in * as the new symbol. Note that blocked cells cannot be changed to wildcard ones so you need to add code to ensure the randomly selected cell is not a blocked cell.

b) In class Cell alter the method. ChangeSymbolInCell such that wildcard cells will never have their symbol changed from * once set. In the same class, alter method CheckSymbolAllowed such that wildcard cells always return true.

c) Alter method MatchesPattern in class Pattern to allow correct operation for the new wildcard *

d) Test that a wildcard can successfully match within two different patterns

Change no. 1:

while self.__wildcards_left > 0: SymbolGridCheck = self.__Grid[random.randint(0, len(self.__Grid))] if SymbolGridCheck.GetSymbol != "W": SymbolGridCheck.ChangeSymbolInCell("W") self.__wildcards_left -= 1

Change no. 2:

def MatchesPattern(self, PatternString, SymbolPlaced): if self.__Symbol == "W": ...       elif SymbolPlaced != self.__Symbol: return False for Count in range(0, len(self.__PatternSequence)): try: if self.__PatternSequence[Count] == self.__Symbol and PatternString[Count] == "W": ...               elif self.__PatternSequence[Count] == self.__Symbol and PatternString[Count] != self.__Symbol: return False except Exception as ex: print(f"EXCEPTION in MatchesPattern: {ex}") return True

Change no. 3:

def ChangeSymbolInCell(self, NewSymbol): if self._Symbol == "W": ...       else: self._Symbol = NewSymbol

def CheckSymbolAllowed(self, SymbolToCheck): for Item in self.__SymbolsNotAllowed: if Item == "W": ...           elif Item == SymbolToCheck: return False return True

by Sami Albizreh

Question 14 - Program allows the user to replace already placed symbols [9 marks]
the user can replace already placed symbols, and patterns, and not lose points (can fix either by stopping them replacing, or make them lose the points from the pattern the replaced):

Question 15 - Program allows the user to create their own patterns and symbols [6 marks]
Description of problem:

1) request the user to create their own symbols

2) request the pattern associated with the symbol

3) output an empty grid for the user, so the user can input any coordinates to create their own pattern

4) make sure new symbols and pattern can be verified by the program

EDIT: this would involve changing a text file or creating a new text file - AQA has never told students to do anything text file-based

Question 16- Making a difficulty rating program
Description of problem:

1) this program can save each game in record including their score, number of symbols left, time to complete and the original empty grid

2) using these information to make a difficulty rating board, so the user can see their rating and select the one they want to play

Question 19 - Advanced Wild Card [13 marks]
This questions refers to the class Puzzle. A new option of a wildcard is to be added to the game. When the player uses this option, they are given the opportunity to complete a pattern by overriding existing symbols to make that pattern. The wildcard can only be used once in a game.

Task 1:

Add a new option for the user that will appear before each turn. The user should be asked "Do you want to use your wildcard (Y/N)" If the user responds with "Y" then the Row, Column and Symbol will be taken as normal but then the new method ApplyWildcard should be called and the prompt for using the wildcard should no longer be shown in subsequent turns. If the user responds with "N" then the puzzle continues as normal.

Task 2:

Create a new method called ApplyWildcard that will take the Row, Column and Symbol as parameters and do the following:

1. Determine if the pattern can be completed in a 3x3 given the Row, Column and Symbol passed to it.

a) If the pattern can be made the cells in the pattern should be updated using the method UpdateCell in the Cell class and 5 points added for move.

b) If the pattern cannot be made the user should be given the message "Sorry, the wildcard does not work for this cell – you have no wildcards left"

Question 20 - Shuffle all the blocked cells [9 marks]
Implement a feature where the user can shuffle the blocked cells around.

Question 21 - A challenge option - where The letters the user has to place down will be randomly generated and if the user successfully does it they gain points otherwise they will lose points (10 marks)
 * The new blocked cells cannot be in the same place as they were before
 * They cannot overlap a matched pattern or symbol placed