0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
No active XP Potion
Accept a Quest
Login to submit answers
Object-Oriented Programming, or "OOP", is a pattern for (allegedly) writing clean and maintainable code.
Admittedly, not everyone agrees that object-oriented programming is the best way to write code, but, to be a good engineer, you should at least understand it.
Throughout this course, we'll be coding small bits of a real-time strategy game called "Age of Dragons". Players control armies of humans, elves, orcs, and dragons in top-down battles. It's similar to Age of Empires or StarCraft.
One of the greatest sins when trying to write "clean code" is using misleading variable and function names. Take a look at the destroy_wall
function. It takes a list of numbers as input (each representing the health of a wall) and returns a new list with each entry of 0
or less removed.
Based on its name, you might assume that destroy_wall
destroys a single wall, but if you look closely, you'll see that it handles multiple walls.
After passing the tests, take a look at the solution to see how we named everything.
Focus Editor
Alt+Shift+]
Next Tab
Alt+Shift+[
Login to Submit
Login to Run
Login to view solution