1

We are pleased that you are considering the study of Computer Science at A level. This AQA exam board course is assessed by 2 exams worth 80% of the A level and coursework worth 20%. Further information about the course can be found at: tinyurl.com/compsciaqa Computer Science students will develop an understanding of why computer work in the way that they do as well as learning how to create computer programs using a A cat looking at a computer screen. number of programming paradigms. In order to prepare students to study Computer Science at Richard Huish College, we have included in this booklet some links to videos and online activities as well as some activities that we’d like you to try. Some useful web links to get you started BBC Bitesize GCSE Computer Make sure that you are prepared for A Level by reviewing Science (AQA) the GCSE content. This will be useful whether you have studied Computer Science already or not. The Computer Programme BBC programme from 1982 introducing the ‘latest’ (BBC iPlayer) technology available and what the next development will be. Computerphile (YouTube) A series of videos presented by professors from the University of Nottingham all about computers and computer stuff, from why hexadecimal is a useful number system to understanding artificial intelligence.

Getting Started with Visual Get started with some VB.NET programming using Visual Basic.Net Studio 2019 (download for free).

Contents ...... 3 Bitmaps ...... 4 Sorting Algorithms ...... 5 The Turing Machine ...... 6 Summer Homework ...... 8

2

Encryption Encryption methods can be symmetric (same used to encrypt as to decrypt) or asymmetric (two different keys used; one to encrypt, another to decrypt). We study both methods in Computer Science. An example of a symmetric encryption method is the rail fence . See here for more information: crypto.interactive-maths.com/rail-fence-cipher For example, to encrypt the message: “Help me, Obi-Wan Kenobi. You’re my only hope.” we remove punctuation, ignore spaces and decide what key to use. The key gives us the height of the grid into which our plaintext is going to be entered and the message is entered along the diagonals, as shown below. Key = 6 H A U O E W N O R H P L I K Y E Y E P B E I M L X M O N B Y N X E O O X (Xs are typically used to complete the columns) The cipher text is then read across each row: HAUOEWNORHPLIKYEYEPBEIMLXMONBYNXEOOX To decrypt this message (the key, 6, needs to be known) a grid with a height of the value of the key is drawn and dashes are used as place holders for unknown letters. The is then entered into the positions until the message can be read along the diagonals. H A U O E W N O R H P ------

Now you try A plaintext message has been encrypted using the rail fence cipher and a key of 4 to produce the ciphertext: CENOEOTRECFRNRMUSIESWNSPCIIX

Q. What is the original plaintext message?

Did you know… The Vernam cipher is the only encryption method that is considered to be 100% mathematically secure. It was developed in 1917 and it has been used for critical international diplomatic and military communications. Careers…. University degree courses and level 4 apprenticeships are available in cyber security, either of which can lead to a career in thee field. There is a recognised shortage of cyber security experts in the industry in the UK. Previous students have gone on to study at university as well as apprenticeships, including at GCHQ. What next…? You might like to try this cyber security challenge: cyber-school.joincyberdiscovery.com/ It is free for all 11 to 18 year olds in the UK. 3

Bitmaps Digital images can be stored using bitmaps or vector graphics. Both are studied in Computer Science. A bitmap is stored using a binary value for each pixel, where the binary value represents a colour. High quality bitmap images (such as photographs) use 24 bits for each pixel, 8 bits for each colour red, blue and green. These are often represented using 6 hexadecimal numbers. Examples can be found here: htmlcolorcodes.com/color-names/

Early computer games used 3 bits or 6 bits to represent graphics. For example, a colour pallet for 3-bit images uses the following colour codes: Black 000 Aqua 011

Red 100 Magenta 101

Green 010 Yellow 110

Blue 001 White 111

Using a 3-bit colour pallet, the first two rows of the image to the left can be represented as: 111111110110110110111111111111 111110110111110110110111111111 Alongside these binary value, other metadata would need to be stored, such as the height and width of the image. Now you try Q. How would rows 6 and 7 be stored using the 3-bit binary described above?

The file size of the above image (not including metadata) is calculated by: h × w × n Where h is the height of the image in pixels, w is the width of the image in pixels and n is the number of bits used to represent colour in each pixel (also known as bit depth or colour depth). Q. What is the file size of the image above in bits?

There are 8 bits in a byte. Can you also give the file size in bytes?

The number of available colours for each bit increases as the number of bits used to represent colour increases. For example, 1 bit allows 2 colours (black and white), 2 bits allow 4 colours and 3 bits allow 8 colours. Q. How many colours could be represented if 4 bits are used?

Q. How many colours could be represented if 6 bits are used?

Q. How many colours could be represented if 24 bits are used? (You may need to use a calculator!)

Did you know… Run Length Encoding (RLE) is a technique used to compress bitmap images. The value given to a pixel is stored alongside the number consecutive pixels of the same colour. So the first line of the image above could be represented as 2W 4Y 4W Careers… Computer games developers require a good understanding of how images are stored and how much memory is used. What next…? pixelart.com can be used to create your own bitmap images. Daily challenges are available and images can be shared with others.

4

Sorting Algorithms There are a number of sorting algorithms that can be used by a computer. The most famous is probably the bubble sort. It is easy to follow and to , but it is quite inefficient. A YouTube video that compares some of the most well known sorting algorithms is here: youtu.be/ZZuD6iUe3Pc The bubble sort works by comparing pairs of values and switching them if they are in the wrong order over a number of passes. The basic bubble sort will do this a sufficient number of times to ensure that all the possible comparisons are made. Compare the 1st and 2nd value 5 8 2 6 9 3 5 and 8 are in the correct order, don’t swap Compare the 2nd and 3rd value 5 8 2 6 9 3 8 and 2 are in the incorrect order, swap. Compare the 3rd and 4th value 5 2 8 6 9 3 8 and 6 are in the incorrect order, swap Compare the 4th and 5th value 5 2 6 8 9 3 8 and 9 are in the correct order, don’t swap Compare the 5th and 6th value 5 2 6 8 9 3 9 and 3 are in the incorrect order, swap Result of 1st pass 5 2 6 8 3 9 Now you try Q. Use the table below to show the result of each comparison for the 2nd pass. st nd Compare the 1 and 2 value 5 2 6 8 3 9 nd rd Compare the 2 and 3 value rd th Compare the 3 and 4 value th th Compare the 4 and 5 value th th Compare the 5 and 6 value nd Result of 2 pass

In a Computer Program, in order for the swap to be made, if the following value is in the wrong place, it needs to be stored in a temporary position so that the current value can take its place. An algorithm (using pseudo code) is below. Some lines have been left out. It uses two ‘loop’ structures; one to go through all the passes (m), and the other to make all the comparisons in each pass (n). Q. Choose the missing lines of code from the right hand side and write them in to complete the algorithm.

For m = 1 to numberOfValues Missing lines of code

If (n+1)th value > nth value Move temp value into nth value’s position Move nth value into (n+1)th value’s position For n = 1 to numberOfValues End if Next Move (n+1)th value into temp Next

Did you know… Big O notation is used to compare the efficiency of algorithms. The bubble sort has a O(n2) which means that (very) approximately if there are n items, n×n operations are required. Careers… Software developers need to know how to produce code that runs efficiently, using as little memory and time as possible. University degrees and level 4 apprenticeships are both progression routes that students can take to become a software developer and many of our previous students have done so. What next…? Learn about different programming languages. At the time of writing, this online Futurelearn course was available: www.futurelearn.com/courses/computer-programming -for-everyone 5

The Turing Machine Alan Turing was a mathematician and logician who is famous for, amongst other things, helping to develop a ‘computing’ device that was instrumental in cracking the Enigma cipher codes that German forces were using during WWII. For computer scientists, the most significant development that Turing was responsible for is the Turing Machine (not that he gave it that name!). An excellent introduction has been provided by Commputerphile here: youtu.be/dNRDvLACg5Q In 1936, well before we had the concept of computers that we do now, Turing described an abstract idea of a very simple, hypothetical machine that could compute any algorithm, given a tape to input values from and output values to, a series of The Turing Machine. instructions that changed state depending on the current state and A visualisation by Tom Dunne 2002 The description of a Turing Machine instruction can be given using transition rules as follows: δ(Current state, Input) = (New state, Output, Direction) For example δ(S0,□)=(S1,□,L) means if the machine is in state S0 and it reads a blank (□) , then change to state S1, write a blank (□) and move to the left. The list of instructions given below describe a simple operation that adds 1 to a binary number. The ‘tape’ further down the page is used to trace the instructions until the ‘halting state’ SH is reached.

δ(S0,□)=(S1,□,L) δ(S1,□)=(S2,1,R) δ(S2,□)=(SH,□,L) δ(S0,0)=(S0,0,R) δ(S1,0)=(S2,1,L) δ(S2,0)=(S2,0,R) δ(S0,1)=(S0,1,R) δ(S1,1)=(S1,0,L) δ(S2,1)=(S2,1,R)

First three transition rules used

δ(S0,1)=(S0,1,R) Current state: S0 Read: 1 New state: S0 Write: 1 Move: Right

δ(S0,0)=(S0,0,R) Current state: S0 Read: 0 New state: S0 Write: 0 Move: Right

δ(S0,□)=(S0,□,L) Current state: S0 Read: □ New state: S1 Write: □ Move: Left

6

Now you try Use a pencil, in case you make a mistake!

δ(S0,□)=(S1,□,L) δ(S1,□)=(S2,1,R) δ(S2,□)=(SH,□,L) δ(S0,0)=(S0,0,R) δ(S1,0)=(S2,1,L) δ(S2,0)=(S2,0,R) δ(S0,1)=(S0,1,R) δ(S1,1)=(S1,0,L) δ(S2,1)=(S2,1,R)

Did you know… Alan Turing’s concept of defining what is computable is still used today, and we describe computing systems as ‘Turing complete’ if they could be used to emulate a Turing Machine. Most modern programming languages are considered to be Turing complete Careers… Many of our students progress to university to study Computer Science. This can lead to many careers including software development, systems management and cyber analyst. Many careers that current student will pursue are not likely to have been invented yet! What next…? Find out more about Alan Turing. For example Alan Turing: Creator of modern computing (BBC) Alan Turing - Celebrating the life of a genius (YouTube)

7

Computer Science Summer Homework

There are three tasks to complete. Type your answers onto a MS Word document or similar word processing application (e.g. Google Doc) and bring an electronic copy of it with you for the first lesson in September.

Task 1 – Computer Science research task

The Turing machine is a theoretical model developed by Alan Turing as a way of trying to solve what was called ‘the decision problem’. The Turing machine was devised as a concept rather than as an actual machine and its invention predates microprocessors and computing as we know it today. Physical machines have since been created according to Turing’s model and software simulations have also been made.

1. Describe the components of a Turing machine.

2. Why did Alan Turing develop the Turing machine?

3. Why did he develop the universal machine?

4. Identify two states that a Turing machine should have.

5. Why are the Turing machine and universal machines still relevant to modern computing?

joyreactor.com/post/352907

8

Task 2 – Binary numbers

Computers need their instructions to be provided in terms of 1s and 0s (which represent high and low currents moving through transistors). For example, some decimal numbers can be converted into 8-bit binary where 110 = 000000012, 210 = 000000102, ..., 5010 = 001100102, etc. Fixed point numbers can be used to represent parts or fractions of a number, where each bit after the bi- 1 1 1 nary point represents ∕2, ∕4, ∕8, etc.

For example if there are 4 bits before and 4 bits after the binary point, then 1.510 can be represented as 0001.10002 and 6.7510 = 0110.11002. See tinyurl.com/CSFixedPoint or tinyurl.com/YouTubeFixedPoint for help if required.

1. How can the following decimal numbers be represented in 8-bit binary (if the number has fractional parts, represent it in fixed point notation with 4 bits before and 4 bits after the binary point)? a) 3 b) 10 c) 100 d) 255 e) 8.5 f) 2.125 g) 0.0625 h) 11.6875

2. How can the following 8-bit binary numbers be represented in decimal? a) 10000000 b) 10000001 c) 10011001 d) 00101010 e) 0111.0100 f) 1100.1100 g) 1001.1001 h) 0110.0110

3. What is the highest possible number (in binary and decimal) that can be represented using 8 bits?

4. What is the highest possible number (in binary and decimal) that can be represented in 8-bit fixed point notation, with 4 bits before and 4 bits after the binary point?

3 2 1 0 -1 -2 -3 -4 1 2 = 8 2 = 4 2 = 2 2 = 1 b.p. 2 = ½ 2 = ¼ 2 = ⅛ 2 = /16 0 1 1 0 . 1 1 0 0

9

Task 3 – Programming preparation

At Richard Huish College we use VB.NET in Visual Studio, which you can download from www.visualstudio.com (choose the Community 2019 version).

There are many online tutorials to get you started with Visual Basic.

Watch the YouTube video here: tinyurl.com/VB2017Tutorial. You will be shown how to use some of the features of Visual Basic 2017 in Visual Studio, including forms, text boxes, buttons and exception handling. Although this is an earlier version of Visual Studio, the principles remain the same. You might try the examples shown in the video to test your understanding.

Your task is to build an application that simulates the Dice Cricket game. Players take turns to roll a dice multiple times, adding up their scores as they go along. Once a player rolls a 5, they are out.

Using Visual Studio, create a VB Windows Form project (you may choose to complete this in C# instead). The form should look something like this:

Form properties: Label 3 properties TextBox 3 properites Name: frmDiceCricket Name: lblTotal Name: txtTotal Text: Dice Cricket Text: Total: Button 1 properties Label 1 properties: TextBox 1 properties Name: btnPlay- Name: lblPlayerName Name: txtPlayerName erName Text: Player Name: Text: Add Name TextBox 2 properties Label 2 properties Name: txtScores Button 2 properties Name: lblMessages Multiline: True Name: btnNextShot Text: Let’s play dice cricket! Text: Next Shot AutoSize: False

Ideas to improve the program: • Create a leader board. • Add random ways that that the batter is dismissed (e.g. bowled, caught, lbw). Any additional enhancements are encouraged.

If you need help getting started with this, make sure that you have watched the video at the link above. If you get completely stuck, I have added a tutorial video here: tinyurl.com/DiceCricketDemoVB

Copy and paste a screenshot of your program when it is running into your Word document (or appropriate alternative) and include a copy of the actual code. If you are not able to complete this task, just copy and paste what you have managed to achieve.

10