Skip to 0 minutes and 9 secondsIt might come as a surprise to you, but we actually got quite a few algorithms in our game already. Let's look at the setup beginning here. If you go through it step by step, we'll see that this is actually an algorithm. We first say that let's initalise the speeds of a ball, then place the ball, then place the paddle, set up the smiley ball-- the positions, that is-- and then set up the positions of all the sad bails. And after that, find the minimum distance that it should be between the small ball and one of the big balls. And that's an algorithm.
Skip to 0 minutes and 48 secondsWe have a start, we have an ending, and we are doing things in between that are necessary for our programme to work. Each of these different methods do draw action on touch, action when phone is moved, update game. They are all algorithms. I have actually created a little document which you can find in TheGame folder where we have all the different versions. And this is called week5 updategameAlgorithm. And if you go through it, you should be able to relate this to the updated game and see that it is an algorithm. Try and go through it step by step and connect it with the code that you have in it.
Skip to 1 minute and 41 secondsThere might be a little mistake in there, so see if you can spot that as well. But try and see how this is indeed algorithm.
Skip to 1 minute and 53 secondsThis is how I normally work. I think about how is what I'm going to do an algorithm, how can I create small steps that will do what I need to do, and then I transform those small steps into a code.
Introduction to algorithms
In this video, we’ll look more in depth at algorithms and how they can be developed to complete tasks, and find solutions to problems.
You can also download the algorithm referred to in the video.