Read in an angry birds file stating the types and locations of the birds. (sample here) This file contains a description of the starting configuration of the pigs, only the pigs are named by type.
- The types of pigs you must support are are "regular," "helmet", "moustache", and "king." (That link is for fun, not because you actually need to read any of that information.) In your program, each type of pig starts with a certain number of points. Regular pigs start with 1 point, helmet pigs with 2, moustache with 3, and kings with 5.
- A pig disappears when its energy drops to zero or below.
- When a pig disappears, it leaves a gap where it used to be; the other pigs do not "slide over" to fill the gap. In other words, the list of pigs always stays the same length; it does not get smaller and smaller as the pigs are defeated.
- You may not assume that there will always be five pigs at the beginning; there could be more or fewer.
Main program
Read in your angry birds file and make a list containing the energy levels (points) for all the pigs. For instance, if your angry birds starting file contains the lines regular, regular, helmet, moustache, regular, then you'd make a list containing [1, 1, 2, 3, 1]. (The point of reading from a file is so you can have different files with different levels of difficulty.)
Then enter a loop that lets the user choose a bird type and launch it. Some bird types will need to ask the user where they want to launch the bird. Display the pigs on a canvas after each launch. You may find it helpful to open one canvas at the start of the program and keep re-drawing the pigs on it; the clear_canvas() function may prove useful (rather than re-opening and re-closing the canvas after every launch).
This is the minimum you must do for this project. I highly encourage you to add whatever features you think would be fun. After all, this is your final project, you're working with a partner, and you two should explore what you've learned and make this something you can be proud of.
Bird types you must include
- A red bird is the simplest bird. It is launched at a specific pig, and always decreases that pig's energy by 1 point.
- A blue bird zooms over all the pigs and decreases all their energies by 1 point.
- A purple bird seeks out the pig with the highest energy still remaining and eliminates that pig (sets its energy to zero).
- An orange bird seeks out the pig with the lowest energy (but still greater than zero) remaining and eliminates it.
Hints
- I'm going to leave program design completely up to you. Use whatever functions you deem appropriate or necessary (there's no "right way" to do this). However, that doesn't mean you can forget or ignore all of the good coding practices you have learned.
- The graphics do not have to be animated. You just have to show what the row of pigs looks like after each bird has been launched and the pigs' energies have been updated.
Possible enhancements
- Add more bird types. Ideas:
- A bird that is targeted at a specific pig, but also damages the pigs to the immediate left and right as well.
- A bird that is launched at a specific pig, but then bounces to a neighboring pig and eliminates it (similar to this bird).
- A magnetic bird that is launched at a target and draws all the other pigs around it to that target (moves them as close as possible, removing any gaps). This way you can then launch a bird that damages surrounding pigs next.
What to turn in
Through Moodle, turn in your code as a file called angrybirds_yourLastName_yourFirstName.py.
Alternate challenge programs
- Angry Birds with a 2-d list instead of a 1-d list.
- Candy Crush Saga
- Minesweeper
- Diamond Dash
- Bubble Safari