## Digital Learning & Computing - Year 8

### A King's Prep Blog

#### Category: Coding (page 1 of 3)

1  The algorithms I have been using for the Micro bits is that I made a smile face using the LED lights to create the figure of a smiley face. After that I made a compass, how I done that is that there is a metal piece at the end of the Micro bit and all I had to do was put the degrees in and what way it is facing. The final Algorithm I made was a higher or lower game. For that I had to put in numbers 1 to 10, after that I had to make a shake sensor on it so when you shake it the numbers would change.

2 Sequencing has affected my code because I only knew the basic sequences for code like the Forever loop, go forward one step etc. but now I have learnt how to use micro bit, I have learnt more harder sequences to perform harder games or pictures.

3 I have debugged a code a couple of times on the micro bit before because once I was getting a picture of a smiley face but when the smiley face was flashing it was going too slow so I changed the speed of the flashing, so that the smiley face was visible more than going on and off slower so you can’t see it a lot.

4 I have used a lot of variables before for example I had to show the LED’s, so I had to make a loop that would make the smiley face show more than once and not go off and only see it once.

5 I have used loops because when I made the Higher or lower game I had to put the numbers on a loop so that they would show if they are higher or lower, than not having any numbers once because it would be too easy.

6 Function is as language or a sequence in computing terms. I have used them before to make a project on the micro bit tutorial.

What Algorithms have you been creating on the microbits?

I have created many algorithms for example I have made pong. The game pong to quite a long time to make because is such a big game and more complex than other games that i could of chose but i decided to challenge myself as an individual. I also made a compass to point to north east south west.

How has sequencing affected your coding?

Sequencing has affected my coding because it needs to be in the right order otherwise the program will be wrong. For example if you were about to play football and you put your socks on before your shin pads that would be the wrong order and I would have to correct it.

Have you had to debug anything?

No I haven’t had to debug anything because I got all of it right and therefore had no errors to debug.

What variables have you used when programming the microbits?

I used many variables in pong because I had to make the ball deflect off of the paddles for the ball to stay alive and carry on playing the game. I also had to make a variable for when the ball got past the paddle and make it go game over.

Have you used any loops?

I have used loops for when the  game finishes and it has to start again once game over has been read.

What are functions and how you used them?

Functions is a language or a sequence in computing terms. I used them bye typing in numbers a letters into the code to program pong.

What algorithms have you been creating on the microbits?

In the lent term we have been working on a project using microbits, I have created algorithms on the microbit website which can then be transferred onto the microbit and games/projects are shown from LED’s lighting up. An example of this is creating the algorithm for a dodge the meteorite game and a pong game.

How has sequencing affected your code?

It is important that code is in the correct order otherwise the game will not function in the way it is suppposed to do fortunately the website guided us into putting our code in the correct order therefore our microbits would be programmed correctly.

Have you had to debug anything?

Yes, the one time I had to debug a piece of code was in the meteorite game, when i started playing it on the microbit one of the meteorites stopped on the bottom row rather than going off the edge so when I moved left or right i  would loose easier. Fortunately I spotted what needed fixing and I debugged it.

What are variables and have you used them when programming microbits?

Variables are a way of storing a piece of particular code they might be randomizing the code so different things happen Variables can change when triggered by an event. An example of thisis when a meteorite came of the bottom edge it changed a variable storing the speed making it faster thus making the game harder .

Have you used loops ? Give an example

Loops repeat a sequence of code for x amount of times they are useful so you don’t have to keep writing code over again, I have used some loops in the process of coding my microbit for example I had to forever loop the code for the falling meteorites so they were never ending and you could keep going on forever.

What are functions and how have you used them when coding microbits?

Functions are sets of instructions in sequence that have variables which make your code work in a certain way. We have used them a lot in programming our micro bits, as they preform a routing within a code.

Users who have LIKED this post:

An Algorithm is a step by step precise sequence of instructions or a set of rules when performing a task. We all made a game on the micro bit by following an Instruction that the tutorials have given us. We have made different on how to make a pong game, a meteorite game and a racing car game. We have created these games by making LEDs light up and making it so that when the A or B buttons are pressed the LEDs string changes it’s position on the Micro bit.

A Sequence helps put the code in the right order and make sure everything is not in the wrong order. Sequencing has been useful in my code as it helps me via loops and functions. It helps us input code such as repeat a step as many times until something happens.

Debugging is when you look through your code and you find something wrong. I have only had to debug once or twice. One of the times that I debugged is when I coded the Micro bit to say the wrong thing. Debugging is very useful and helps you find if there is anything wrong in your code.

A variable stores a piece of information in the computer whilst a program is running so it can be running and retrieved later. Variables help me as I use them quite frequently. They are used as the X and Y on the Micro bit.

A loop is something that happens over and over again. Loops are really use full and I use quite a lot of them and they make coding quite easy because it just repeats the same code so you don’[t have to write out the same thing over and over again. An Example of this is an Infinite loop as these keep your game running and it makes it so that you don’t have to keep starting up the game.

A function is a type of procedure or routine. Most programming languages come with a prewritten set of functions that are kept in a library and our text editor has it’s own. You can also write your own functions to perform specialized tasks. An Example of a function is when you tell the computer what LEDs need to light up.

What Algorithms have we been creating on the Microbits?

An algorithm is a set of instructions in the right order for a computer or game to follow. We have been creating some complexed algorithms on our computers which we then download the code onto our microbit. We used the touch develop  tutorials to follow in order for us to create this code in the microbit touch develop section. I created Whack-a-Mole  which was a complexed piece of algorithm. This game used the while do block in order for something else to be happening while the game is also doing another piece of code.

How has sequencing affected your code?

Sequencing has been important because if you got the code in the wrong order the game wouldn’t work. This is because in order for the game to work the algorithm needs to be in a systematic format for the game to work properly.

Have you had to debug anything?

Yes, I have had to debug my game of Whack-a-Mole because instead of the arrow coming up when you hit the mole the arrow came up every time even if you missed. So, I had to find the problem and it was that the show leds block with a tick was in the forever loop which meant it wouldn’t stop showing the tick forever it is also meant it in the loop name ‘forever.’

What are variables and have you used them when programming Microbits?

A variable is a store of information that can change and record a certain piece of code. I have used variables in my game of Whack-a-Mole. For example: I used a variable to store information  on the position of the mole throughout my algorithms  and I used the start time variable to know how long the player has to hit the mole.

Have you used any loops?

Yes, in Whack-a-Mole I used the while if do loop. This means while my code was moving the mole if button A was pressed add one point to the score.  I used also used the while do loop which means to do two things at once. While button A is pressed add one to score and while this is happening move the position from side to side.

What are functions and have you used them when coding Microbits?

Functions are a piece of code that can be called over and over again and they are segments of code that perform the steps of the code. I used a function in the spinner game. The function included all the code for the game.

1. What algorithms have you been creating on the microbit?

This term I have been creating algorithms that I have then downloaded onto the microbit in order to play them. An algorithm is a set of rules or instructions that the code follows – making your program. I have made a lot of games like flappy bird, pong and a spinner. These are only a few examples. I have also made a compass and a love calculator. The love calculator wasn’t very good to start with but then I debugged my code and then it worked a lot better. Debugging is when you go through your code and find the mistake to then fix it.

1. How has sequencing affected you code?

Sequencing affected my code because if I don’t sequence my code then the program will run in the wrong order.

1. What are variables and have you ever used them when programming microbits?

A variable is a value that can change. An example of this in the games I have produced is in flappy bird – the bird. This is a variable, because if you press the A button for example the bird would have to change it’s position on the screen.

1. Have you used any loops? Give Some examples.

A loop is a series of instructions that is continually repeated the amount of times that you want it to be. The most common types of a loop is a forever loop, a if loop and a when loop. I have used these in all of my games, because they are very important. An if loop basically does something ‘if’ something else happens. You have to program what the something else is. A when loop basically completes an action – that you have coded – ‘when’ something else has been completed. And then a forever loop basically makes something loop forever.

1. What are functions and how have you used them when coding microbits?

A function is a procedure or a routine. In my work on microbits, I have used functions in my flappy bird project because, at the beginning of making the code for the game, we had to create a function for the flappy bird and we called it  ‘flappy bird’.

##### What Algorithms have you been creating on the Microbits?

I have been using many types algorithms over the course of this half-term. I have used algorithms to create compasses on the microbit, made games e.g. Minesweeper. I have also used algorithms to scroll words across the screen, e.g. Hello my name is Oliver. I’ve also used algorithms to create fast-paced reaction testers and a Tamagotchi style virtual pet.

##### How has sequencing affected your code?

If you haven’t sequenced your code correctly it will not work properly. I found this out when I was programming my car dodge game. I didn’t sequence my code properly so everything was either doing the wrong thing at the wrong time or it just didn’t show up. Then after some movement of the code to its correct sequence everything was working as it should. We used sequencing by following a simple but useful guide that took you through every process step-by-step .

##### Have you had to debug anything? Provide examples

Yes, I have had to debug certain elements of difficult code. The one that took me the longest was the Car Dodge game again. There was one tiny mistake in the x and y coordinates. I was duplicating code and I forgot to change the x axis to make the car move. This meant the car was stuck in one permanent position whilst the cars were driving into it. After I debugged this tiny error, I had fixed the game.

##### What is a Variable and have you used them when programming Microbits?

A variable stores a piece of Information in the computer’s memory while a program is running so it can be retrieved later. We have been using Variables a lot in this project. When we were making games we had to create variables so they stored information whilst other information was running. Then when we finished the games it was stored inside the microbit so whenever we turned it on, it would always do the exact command I put in.

##### Have you used any loops? Give some examples.

Whilst I was making the game “Meteorites” I had to create a loop that made Meteors constantly fall from the sky.  A loop is a line of code that keeps doing something over and over again until there is something that tells it to stop or someone stops the loop.

##### What are functions and how have you used them when coding Microbits?

A function is code that completes a certain task. We have used many functions in this topic. One of the biggest scripts that included a lot of functions was the game Pong. For this we created Functions then put the needed code in it. An example of this was the Paddles in Pong.

What algorithms have you been creating on the microbits?

I have been creating many algorithms over the course of this term. I have used algorithms to create games on the microbit eg. pong, minesweeper and catch the egg. Another algorithm I used showed a line of text on the microbit. On the microbit it would say whatever I coded it to say on the line of text eg. ‘hello’! An algorithm is a set of instructions for the code to follow and do.

How has sequences affected your code?

Sequencing affected my code by if I didn’t put the code in the right order the whole code wouldn’t work properly  because in a way the code relies on each other. For example, if you put ‘end’ at the beginning of the script then when you compile it onto the microbit it would say ‘end’ when you turn it on instead of ‘start’. A sequence is when you put the script and code into the right order.

Have you had to debug anything? Provide examples.

When I made the car dodging game and I compiled it onto the microbit I relised that the cars you had to dodge only went down one row. To debug this what I had to do was work out where the code was wrong and attempt to fix it. I did find what was wrong and I debugged it, I compiled it back onto the microbit and it was working right. Debugging means you have to figure out what is wrong with your code and fix it.

What are variables and have you used them when programming microbits?

I did use variables when I made the games. When I made the car racing game the variable I used most was ‘set to’ . There are quite a few variables in coding. A variable is a part of your code that store information so it can change information so it can change them to make the code work or to record a certain thing.

Have you used any loops? Give examples.

I have used loops in coding. The loop I used most was ‘repeat times do’ and ‘while do’. The ‘repeat times do’ loop tells the code to repeat the next part of code however many times you want it to (eg4) and then after it does if (eg4) times it will do whatever you code it to do next. A loop is a part of code that keeps on getting repeated over and over again.

What are functions and how have you used them when coding your microbit?

A function is a piece of code that you can place anywhere  over and over again. I have used many functions in the coding project. For example, you could put your code in a forever loop so it carries on repeating it and so you don’t have to type it out again and again.

What algorithms have you been creating on the Microbits?

I have been using many algorithms this term. For example I used a algorithm which shows a line of text on the Microbit. This algorithm is show string “hello”. I normally use algorithms to create a game like Flappy bird or catch the egg. For the Flappy bird game there was more that one algorithm and each one did a different thing. The main one was (i = make _pipe(). This bit of code was short for a longer bit of code so I could easily put it in my code. An algorithm is a process or a instruction for the code to do.

How has sequencing affected your code?

Sequencing  has affected my code because if I don’t put the code in the right order it might show the wrong thing at the wrong time. For example if I put show string “Game Over” at the start of the game then it will show that first instead of “get ready”. A sequence is when you put every thing in the correct order.

Have you had to debug anything? Provide examples.

I have had to debug one thing when I was making my Flappy bird code. The problem was I put if >99 rather than <99. This effected it because it made an error which made the led go off the Microbit’s screen and then it glitches out. Debugging is when you find a bug in your code (a problem) and then you remove the bug so then you code starts working again.

What are variables and have you use them when programming your code?

I have used many variables when making my game. The most common one I used was score. When making my Flappy bird game I had some code that every time you went through a pipe you got one point added to your score. A variable is a part of your code that stores information so it can change them to make the code work or to record a certain thing.

Have you used any loops? Give examples.

I have used a large amount of loops during this term. For example most of my Flappy bird code is a loop. For example it is looping the gravity so it doesn’t stop. If it didn’t do this then the bird would just stay still and wouldn’t fall down. A loop is part of a code that keeps on getting repeated for the amount of times you tell it to and is useful because then you don’t have to type it out loads of times.

What are functions and how have you used them when coding your Microbit?

I have used functions in my Flappy bird code. As I said the bit of code (i = make _pipe() is a function. This a bit of code that can be placed in your code anywhere and it will do the long bit of code you told it to do. The (i = make _pipe() makes a pipe generate and be shows on the screen. The point in this is so I don’t have to spend ages typing out this code over and over again.

##### What ALGORITHMS have you been CREATING on the Microbits?

On the Microbit, I have been creating different algorithms on the microbit over this half of the term. I have created these in the form of games, such as Meteorite, and useful utensils such as a compass. I have also used algorithms to create scrolling text on my microbit, that included, ‘Hello World’ and , ‘My Name Is James’.

##### How has sequences affected your code?

If you put a line of code in the wrong sequence, then the algorithms you are writing will not be right and the thing you are trying to create won’t work. However, sequencing helps by making you put the things in the right order and then your working project will become successful. We used sequencing by following a step-by-step guide on the microbit website to help us create our games.

##### Have you had to debug anything? Provide examples.

I have not had to debug anything in my microbit projects, because I try to follow the instructions as best as I can and try to not make mistakes. I have not had to find out what is wrong in my algorithms or programs, so I haven’t had to fix anything.

##### What is a variable and have you used them when programming microbits?

A variable stores a piece of information in the computer’s memory while a program is running so it can be retrieved later. We have used these in our microbits, as they have stored variables that will continuously run so we can play the games we have created over and over again. The information has been stored in the microbit so it will always play that particular thing we have created unless the person programming it changes the game/utensil they are making.

##### Have you used any loops? Give some examples.

I have had to use loops in my algorithms. One example would be when I created the game, ‘Meteorite’. I had to create a continuous loop of meteorites that fell to the ground and the character you controlled had to try and dodge them. If you got hit by one, you would lose the game. Loops are something that you put into a line of code to make something repeat an action over and over again.

##### What are functions and how have you used them when coding Microbits.

Functions are ‘self contained’ modules of code that complete a specific task. Functions will store data, process it, and ‘return’ it as a result. We have used these when creating our microbit projects, such as the paddles we had in the game, ‘Pong’.

Theme by Anders NorenUp ↑