Educators & parents: You can do this Hour of Code Activity as a class or students can work on it independently. If you have any questions or need help, email email@example.com.
Computer science has a critical role to play even in areas where there is no computer to be seen! For example, coding can help with infrastructure planning.
"Infra... what?" you might be thinking.
Infrastructure is the term used to describe the structures and facilities which support modern human life.
Think of things like roads, sewage, bridges, mass transit, and telecommunications networks.
In today’s project, we are going to build roads! Roads are a really important part of infrastructure. Roads give us safe and convenient ways to get to where we need to go, whether it's a friend's house, school, the hospital, or the airport.
Planning roads is a complex task. Civil engineers use computers to plan out roads that are effective and efficient.
That’s what today’s project is about. This is a game called Build a Road. In the game you build, the user will play the role of a civil engineer to make a road that is
- Effective - making sure the road connects point A to point B, AND
- Efficient - keeping the road as short as possible, using the least amount of resources as possible.
Each time you click, you will get a piece of road to place on the screen. You can’t just place roads anywhere; you must connect the previous road you placed.
Each time you place a road, the number of clicks go up. How many clicks does it take to connect point A to point B? The less clicks, the more efficient your road will be.
Ok, let’s get coding!
Watch the videos below to get started, and follow along with me to build your own Road Game.
Part 1: How do we play?
Part 2: Let's start building the road
Part 3: Adding Game Rules
Bonus: Win and lose screens
Play the completed game below!
Want to go beyond Hour of Code and learn more about painting your own sprites in Scratch?