In this challenge we will write a Python program to help us find out hold we will be in the coming years! We have designed the algorithm of our program using both a Flowchart and Pseudocode.

year = 2017
age = INPUT("How old are you?")
FOR i FROM 1 TO 50
year = year + 1
age = age + 1
OUTPUT("In " + year + ", you will be " + age + " years old.")
END FOR
Check the above flowchart and answer the following questions:


Before attempting this task make sure you understand what is meant by sampling sound.
Complete this drag and drop activity to highlight the key concepts of sound sampling.
Sampling is a method of converting an analogue audio signal into a digital signal. While sampling a sound wave, the computer takes measurements of this sound wave at a regular interval called sampling interval. Each measurement is then saved as a number in binary format.

Sampling Interval: 15 ms

Sampling Interval: 40ms
The sample rate (in Hz) is the number of samples in one seconds.

Sample Rate: 66Hz

Sample Rate: 25Hz
In graphical perspective, a vanishing point is an abstract point on the image plane where 2D projections (or drawings) of a set of parallel lines in 3D space appear to converge. The vanishing point may also be referred to as the “direction point”.

Vanishing Point Perspective is used in Graphic editing and 3D video games. It can be used to render 3D shapes (3D Buildings and objects), add perspective to a background scene (road, train track) or add shadow effects.
The following slideshow, demonstrates the use of vanishing points in computer graphics:
You can read more about Vanishing Point Perspective on Wikipedia.
In many arcade video games objects are flying across the screen (either vertically: falling objects, upcoming cars in car racing game) or horizontally (e.g. pipes in Super Mario or flappy bird, cars in Crossy Road).
In frame based games, motions is often implemented by positioning sprites on the screen using (x,y) coordinates and applying a velocity vector (Vx,Vy) to each sprite to indicate the direction and speed of the sprite.
Let’s review the algorithms used to implement three types of motions:
If you are confident enough with your Python skills, you might feel ready to move on to the next stage and start creating your own arcade video game.
To do so you will have to research and investigate existing video games to identify some of the key computational features of these games and see how these can be implemented.
For arcade games we advise you to investigate the classic games including:
When investigating these video games try to identify their main features:
You will then be able to research these characteristics further and identify the computational features that you could use to build your own game.
To help you getting started we have listed here a few blog posts from this blog describing a range of computational features further:

In a game of Pacman a specific algorithm is used to control the movement of the ghosts who are chasing (running towards) Pacman.
For this challenge we will assume that ghosts can walk through walls (as ghosts do!). So we will implement an algorithm that is slightly different to the algorithm used in the real game of Pacman where ghosts can only run alongside the corridors of the maze.
Our algorithm will be used in a frame based game where the sprites (e.g. Pacman, Ghosts) are positioned using (x,y) coordinates. The Pacman movement will be based on the position of the mouse cursor whereas the Ghosts will use a velocity vector (vx,vy) to move/translate between two frames.

The next step of our algorithm will use this angle to calculate the velocity vector (Vx,Vy) of the ghost:

The final step of our algorithm will update the (x,y) coordinates of our ghost to apply the velocity vector translation before drawing the ghost sprite on the screen.

Bouncing algorithms are often used in arcade games such as Pong or Breakout.
To understand how to implement a bouncing algorithm, it is essential to understand how the computer controls the trajectory of a sprite (e.g. ball) on the screen. Arcade games are based on a frame based animation where the screen is refreshed every x milliseconds. Moving sprites are positioned using (x,y) coordinates and have a velocity vector (Vx,Vy) which specifies the delta in pixels to apply to the (x,y) coordinates of a sprite between two frames:

As the sprite moves across the screen, it may need to bounce against another sprite or against the edge of the screen.
Let’s investigate how the velocity vector is affected when the sprite bounces against vertical and horizontal walls/edges.




Have you ever noticed when playing a team sport video game such as a (football, basketball, rugby game, etc.) the computer often finds out who the closest player to the ball is so that you can run to the ball with the closest player.
To do so the computer uses a specific algorithm to identify who, of all the players in your team, is the closest to the ball. This algorithm can also be used when you already control a player who has the ball to find out who is your closest team player to pass the ball to.
In this blog post we will investigate how this algorithm works and will implement this algorithm using Python.
On a team sport video game, each player is a sprite that is given an x and a y coordinate to be positioned on the pitch/screen.
The ball is also positioned using (x,y) coordinates.
To find out who the closest player is to the ball, we need to calculate the distance between the ball and each player of the team. To do so we will use Pythagoras formula:

We can then use an algorithm to find the shortest distance and highlight the corresponding player.