So you're getting better at coding? We've got some challenges for you.
So you're getting better at coding. Maybe you've earned some CoderDojo Stirling badges. Now try some of our challenges below!
Start completing challenges today:
Scratch Tutorial: 'Attack of the Bug-Eyed Fish Monsters' game
Scratch: Avoid Cake
Coding: How Long Was The Light On?
Scratch is a nice programming language for learning how to code. If you haven't used Scratch before, you can do our Scratch badges to get started. If you have used Scratch before, pick a challenge below and do it!
Make a theatre stage with a band on it: a drummer, a guitarist, a singer, and anyone else you want. When you click on a person (or their instrument), the instrument sound should play. So when you click on the drums, you hear drums!
More advanced: Try clicking your band members at the right time, so it sounds like a proper song!
Make a story about a bear searching for his dinner. The bear should move around, and tell the following joke to a frog:
Create a maze game. If you collide with a wall, you get teleported to the start, and told “you clumsy oaf”!
Make an animation of your name, so each letter does something cool like make a sound, or move around or change colour. I’m called GREG, so the G might spin around, the R might change from red to blue, and so on. The animation should start when the Green Flag is clicked.
More advanced: Make the animation cooler. You could make the background change, or make a bird fly around, or make the letters do things when you click on them.
Create a game where the player gets points when the cat catches a mouse, and loses points when the cat steps in a dog-poo.
More advanced: can you make this game two-player?
Build an aquarium with fish swimming around and plants at the bottom. The fish should turn round when they hit the aquarium edge.
More advanced: Add a shark into the aquarium that is controlled with the arrow keys. Make the fish run away when they bump into the shark.
Make a game about a space miner:
Make a Hide and Seek game with the Scratch Cat: the Cat will appear somewhere on the screen, then vanish after 2 seconds. 6 seconds later, the Cat will appear somewhere else on the screen, then vanish again after 2 seconds. It does this forever. The player gets one point when they click on the cat, and lose a point if they click on the background.
Make a game about escaping a graveyard. You start at one side of the graveyard, and have to escape through a gate on the other side. The graveyard has grave-stones in the ground, and ghosts that move around. If you collide with a grave-stone or a ghost, you get teleported to the start.
More advanced: Make the graveyard more spooky. What about making an invisible ghost appear when the player hits a gravestone? Maybe it says “boo!” (record the sound effect)
Make a game about someone doing a parachute jump, and having to dodge moving clouds. If they hit a cloud, they lose the game.
More advanced: make things harder, with more clouds moving randomly at different speeds. You could also keep score by counting how many clouds the parachutist dodged. Or make things look cooler by changing the background: what about thunder and lightning, or snow?
Make a quiz where the player has to multiply random numbers together. "What's 2 times 7?". "14". "Correct!".
More advanced: make the quiz ask 10 questions, and keep a score of correct answers. And do more fun stuff when the player gives a right answer (yay!) or wrong answer (boo!).
Make a scene with a windmill (or wind turbine) and a cloud. Make the windmill turn and the cloud move across the sky. Now here's the fun bit: make the windmill turn faster the louder you whistle (or yell) into your computer's microphone. The cloud should move faster too. The louder you whistle, the stronger the wind!
Make a game that measures your reaction time: how fast you can click when Scratch cat changes from his normal orange colour to blue. At the end of the game, show your reaction time (it will be in milliseconds, which is a second divided into 1000 parts). What's the fastest you can click?
Make a Scratch program that generates random insults :-) Scratch cat first asks for your name, then insults you. Here goes..
Write a game about flying to the moon. There should be three stages in your game: one set on Earth; one in space and one on the moon.
To start the rocket the player should press the space bar five times. Then the rocket should fly into the air. When the rocket reaches the top of the screen, the background should be changed to the next background (e.g. from Earth to space). Along with placing the rocket at the bottom of the screen again. The player should be able to move the rocket left and right using the arrow keys. There should be Aliens and other space-ships flying around. If the player touches one of these they lose the game. When the player reaches the last stage (the moon) a target should appear. The target should be placed at the top of the screen. If the player hits the target then they win the game.
For a spaceship sprite look in the sprite library (they'll be found in flying).
To count the number of times the player has pressed space make a variable (found under data). Then every time space is pressed add one to this variable. Use the wait until block to make the sure the rocket doesn't fly off until the variable equals five. Ask a mentor for help if you haven't used variables before.
To change the background check whether the y coordinate is bigger than 180, then use the switch background block.
If you manage to complete the above try and place the target at the bottom of the screen. Then have the rocket start at the top and move down the screen (towards the target).
Write a small game about popping balloons. In the game the balloons should float from the bottom to the top of the screen. When the player clicks on a balloon then it should disappear from the screen, and a popping sound should be played. Then one should be added to their score. There should be other items floating up the screen; if the player clicks on any of these they should lose a point.
So you're going back to school - you'll need to make sure you've got a pencil, notebook and calculator.
Fortunately, it's raining school supplies. Your sprite needs to walk back and forth across the screen catching pencils, notebooks and calculators in their backpack. Set up a timer so that players have one minute to collect as many as they can. Set up a counter to count how many items they catch.
Make your own version of a classic 1980s game called "Frogger". Check out this video. The aim of the game is to guide a frog from the bottom of the screen to the top of the screen, whilst crossing lanes of a busy road. Each lane contains moving cars, buses, cyclists and other vehicles - don't let the frog get run over! The player moves the frog using the arrow keys (hopping forwards, back, left or right). The player wins by guiding the frog safely to the top of the screen.
Create a Halloween scene: for example a spooky forest or a graveyard. When you click on anything in the scene, something scary should happen. A spider drops from this tree; an owl flies out of that one; a ghost pops out from behind a gravestone; a witch flies cackling across the moon. How many spooky surprises can you put in?
Santa needs help dropping presents down chimneys. Make a game where Santa flies across the sky over some houses with chimneys. When the mouse is clicked, Santa drops a present which falls downwards. If the present hits a chimney, you score 1 point. If the present hits something else (like a roof), you score nothing. In either case, the present vanishes, and you get to try again. You win once you've scored 10 points.
Scratch Cat has made a New Year Resolution not to eat cake. Write a game where Scratch Cat has to dodge cakes that fly round the screen. If Scratch Cat touches cake, he loses a life (and the cake vanishes - yum yum!). Scratch Cat has 9 lives. When he runs out of lives, the game finishes. The player should then be told how many seconds Scratch Cat survived.
If you’ve never built a website before, do our badge called Get your own website on the Internet. If you have built a website before, pick a challenge below and do it!
Create a website about the solar system. It will need a start page describing the solar system, and a page about every planet. You could even do pages about different space missions involving astronauts.
Create a website about the place where you live. Let’s say you live in Stirling. Where is it? How old is it? What would you show someone who came to visit? What interesting things can you do there?
What do you want for Christmas? Let Santa (and mum, dad, gran and anyone else) know with your own website.
Your website should have descriptions and pictures of the items you want and links to where they can be bought. You could prioritise the items with a star rating to say how much you want that item, or organise it by price so everyone can find the right gift for you!
More advanced: Add some Christmas style and Christmas tunes to get everyone in the present-buying mood!
Chemistry, computing, psychology, microbiology, astronomy…. how many types of science can you think of?
Make a guide to science: your website should have one page for each type of science. Explain what it is. Include pictures of famous scientists or discoveries, and links to other websites so that your readers can find out more.
Make a website game about a haunted house. Each webpage is a room in the house, and describes the spookiness happening in the room. The links on a room’s webpage take the player to other rooms nearby.
The player starts outside the haunted house (on the website’s main page). They then choose which links to follow to take them though the haunted house, and out the back door!
So you watched the Olympics? There were loads of cool sports: swimming, triathlon, fencing, …
Make a website about the Olympics. You can have pages about different sports and athletes. Maybe a page about Rio de Janeiro in Brazil. Include pictures and videos (try including a youtube video). Link to other websites where your readers can find out more.
Make a webpage with lots of animal pictures. When you click on a picture ("sheep"), an alert box should pop up with the animal noise ("baa").
Make a website for Bob's Bakery.
"My name's Bob, and I run Bob's Bakery. We make lots of cakes and tasty things: chocolate cake, gingerbread men, jam doughnuts, ring doughnuts, strawberry tarts, and lots more. I'd like to start selling my cakes on the internet, so will need a website. I reckon it needs:
I bet you've got a few favourite films. So make a website about them! You will need:
Make a website for Bob the Builder.
"I'm Bob the Builder. I build houses: houses for people, dog-houses, dolls-houses, tree-houses.. If it's a house, I can build it. I want a website so people can find me on the Internet, see what I do, and contact me if they're interested. Hopefully I'll get some new customers! I reckon the website needs:
My favourite game. Write a small website about your favourite game(s). The website should contains:
A short of description of the game. What's about it? What are the goals of the game? How long does it take to complete? Is there a story? Who's it developed by? And any other relevant.
A link to the game site
Images and videos of gameplay
Write a website about your summer holiday. The site should have a page for each activity you have done. Every page should have a brief description of what you did, who you were with and where you were. Along with some pictures of the place. Every page should link to the others.
Write a website about the teachers in your school. Each teacher should have their own page, describing what they teach, how much homework they give, how strict they are, what their classroom is like, etc. You could add a drawing of each teacher to help new pupils identify them. Don't forget the Head Teacher! You could arrange the front page so that the teachers are organised by subject.
Make a website with the best memes ever. It should be possible to view memes by animal type, subject and year, so you'll need different web pages for this.
How text appears on a webpage depends on which font is used. For example, we could use the Courier font, or Verdana font. Write a webpage that shows the same piece of text with different fonts: use the sentence "the quick brown fox jumped over the lazy dog". The text will feel different, depending on the font used. Try finding fonts that look official, funny, old or futuristic. What's your favourite?
Twine is an online tool for telling interactive stories. Here are two examples:
Make a "Choose Your Own Adventure" story with Twine called "A Day in the Life of Timmy the Dog".
If you don't know how to use Twine to make stories, then do the "Make Stories with Twine" challenge first.
To start you off, your first page might look like:
Timmy the Dog is sniffing the rubbish bin outside his house. Suddenly he hears a rustle behind him, and sees Sooty the Cat staring. Timmy: * Walks up to Sooty, and tries to make friends. * Bounces up to Sooty, and starts a fight. That cat needs a lesson. * Runs awwaaaaay! Sooty is scary.Each choice is a link to another page, where the story continues. So what happens when Timmy runs away, or starts a fight?
Here are two online environments where you can start coding immediately (or use whatever setup you want):
Write a program that asks someone their name, then outputs it in reverse. So “GREG” becomes “GERG”.
Write a program that asks for a country name, then outputs the capital city. So “France” returns “Paris”.
Write a program that plays ‘rock paper scissors’:
Write a program that plays ‘hangman’. The player guesses letters to complete a secret word. You decide how many turns they get. On each turn:
Write a program that counts the number of words in a sentence. For example, for “i am an example sentence”, the program would print 5 (words).
Then improve your sentence analyser:
Write a calculator that can add, subtract, multiply or divide two numbers. Make the calculator accept the two numbers and command one line at a time. Like:
More advanced: make the calculator accept everything on one line, like: 2 + 3.
Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print “FizzBuzz".
Write a program that prints out the first 100 numbers in the Fibonacci sequence. In the Fibonacci sequence the first two numbers are zero and one. Every number after that is the sum of the previous 2 numbers. So the first seven numbers are: 0 1 1 2 3 5 8.
Write a program that turns a sentence into a secret message by replacing each letter with the next letter. So the letter ‘a’ is replaced by ‘b’, and ‘f’ by ‘g’, etc. Here’s an example:
Hint: letters are represented inside a computer as numbers. This is called ASCII: so an ‘a’ in ASCII is 97. You’ll need to convert the sentence letters into ASCII, do some addition, then convert them back again. Google to learn about ASCII, and how you convert letters to ASCII (and back again) in your particular programming language.
More advanced: so you’ve written a program that ‘encrypts’ a sentence into a secret message. Write a ‘decrypt’ program that turns a secret message back into the original sentence.
Write a program that outputs whether two phrases are anagrams of one another. For example:
Write a program that outputs whether a given number is a factorial (or not).
A factorial of a particular number is that number multiplied by all numbers below it. So 5! (meaning 5 factorial) = 5 * 4 * 3 * 2 * 1 = 120.
Calculating 5! is easy. But we want to reverse this. Write a program that tells us that "120" is "5!". The program should work for any number, either reporting that that the number is a factorial, or "NONE" if it isn't. For example:
Write a program that lets you create and manage a 'to-do list'. You should be able to: add an item, delete an item, and view the whole list (of items). Here's my example to-do list:
Write a game that measures your reaction time: how fast you hit the space-bar when told 'hit it!'. At the end of the game, show your reaction time in milliseconds (a second divided into 1000 parts). What's your fastest reaction time?
Make a program that generates random insults :-) The program first asks for your name, then insults you. Here goes..
Write a small program that takes in a number and then prints off a triangle of that height. Here is an example:
Please enter the height of the triangle: 5 Output: # ## ### #### #####
The program should only accept whole numbers between 3 and 10.
Once you've finished the basic version, try and produce the following output:
Please enter the height of the triangle: 5 Output: ## #### ###### ######## ##########
Write a small program that takes an amount of change, and then works out the minimal coins required to make it. You may only use the: 50, 20, 10, 5, 2, and 1 pence coins.
Input: 0.73 Output: 1 x 50 1 x 20 1 x 2 1 x 1
The program should only accept positive numbers and the input must never be bigger or equal to one.
So you're going back to school. Write a program that manages your school timetable. It should record which subjects you take during your school day. E.g.:
Input: MON-PERIOD2 Output: ENGLISH
Getting your driving licence requires you to pass a "theory test". Write a program that lets you practice the theory test: the program asks you a set of multiple-choice questions, tells you whether you correctly answered each question, and tells you your final score at the end. Here's an example question:
You will find that driving smoothly can:
Write a program that takes a time in 24 hour numeric form, and outputs it as words.
Can you make the computer actually speak the time as words, so you have a real speaking clock?
Thanks to Reddit dailyprogrammer
Write the smallest possible program to print all the lyrics to the "Twelve Days of Christmas":
On the first day of Christmas my true love sent to me: a Partridge in a Pear Tree On the second day of Christmas my true love sent to me: two Turtle Doves and a Partridge in a Pear Tree On the third day of Christmas my true love sent to me: three French Hens ...
To start with, get things working by using numbers (rather than words) for the gift counts:
On the second day of Christmas my true love sent to me: 2 Turtle Doves and 1 Partridge in a Pear Tree
There is a light that switches on when someone enters the room, and switches off when they leave. If multiple people are in the room, the light stays on until the last person leaves. Write a program that outputs how long the light stays on, given a list of when people entered and left the room.
More input and output:
Input: 2 4 3 6 1 3 6 8 Output: 7
Input: 6 8 5 8 8 9 5 7 4 7 Output: 5
Can you change the program to work with more precise times? E.g 09:00 09:25.
Thanks to Reddit dailyprogrammer
At Stirling CoderDojo, we have micro:bits to play with. Ask a mentor if you would like to use one. A micro:bit is a cool little computer with LEDs, a compass, motion detection and temperature detection. So you can make it to do cool stuff like show the temperature when you shake it! There’s a web-based Block Editor (like Scratch) for writing and testing code. When you’re happy with the code, you need to transfer the code to the micro:bit. To do this: