National Coding Week: Flappy Bird Python Challenge

16th September 2019 is the start of National Coding Week so it’s an ideal time to for anyone to have a go at writing code for themselves.

To celebrate, here’s a free interactive activity that anyone can use to have fun writing code without needing to download any software or create any accounts.

It doesn’t matter how old you are, how much experience you have (or haven’t) got or what your gender is, hopefully there’ll be something in this python flappy bird challenge that will give you a taste of what’s possible with a few lines of python code.

National Coding Week: Flappy Bird Python Challenge

Stage 1: Type with code

The first stage of the flappy bird python challenge gets you to type out the code for a flappy bird game as fast as you can.

Use the on-screen keyboard to help improve your touch typing by trying not to look at your fingers as you type.

See how your typing speed and accuracy compares to other people.

Once you’ve finished, you get a link to the code so that you can run it and play the flappy bird game

Stage 2: Run the code and play the game

The code for the flappy bird game can be run by pressing Ctrl + Enter in your browser.

Press any key to make the bird jump.

The code uses PyGameZero and was originally written by the marvellous Daniel Pope and the original source is available here: https://github.com/lordmauve/pgzero/blob/master/examples/flappybird/flappybird.py

Have a go at playing the game and see what score you can get to without cheating.

Stage 3: Hack the code

Once you’ve played the code for the flappy bird game you can tweak some of the code to make small changes and see how it affects the game.

Lines 4 – 10 define some constants (including GRAVITY and SPEED) which you can tweak to make the game easier or harder

See what you can create with code.

Next steps

There are some brilliant free python tutorials all over the web.

I’ve published some free interactive self-marking challenges which you can use to pick up new skills, try them out and test yourself to generate a PDF certificate showing your progress.

Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *