Of all the ways of improving your coding skills, a game is one of my favorites. To skip my commentary you can just play the game here.
Elevator Saga is a fun game that uses JavaScript to control elevators. It starts out simple enough, it starts out with one elevator, and 3 floors. Your goal is to move 15 people in 60 seconds or less.
You do this by editing the JavaScript included on the page, you can do things like:
- controlling where elevators go
- controlling what happens when elevator buttons are pressed
- make changes based on how many people are on the elevator
And much more. There’s full API documentation here.
You don’t need a ton of JavaScript experience to play this game, and it’s not extremely technical. But you will need a mind for solving problems and building software. If you don’t have that already this game will help build that.
What to consider
Theoretically, you could just have elevators going up and down floors fast enough and it would move all the people through. This works in the first couple levels but after that you need optimization.
Here are some things you need to think about:
- Coordinating elevators - Don’t just make two elevators take the same path, it’s wasteful.
- Prioritizing busier floors - Some floors are busier than others, which means just going up and down floors sequentially won’t cut it
- Optimizing your routes - Taking wasteful trips adds up. You need to be intentional about controlling where elevators go.
- Capacity of elevators - You have to be mindful about cramming too many people in an elevator.
These are some things you must think about and write code around. You need to think of the entire system and how to keep people moving quickly.
How does this make me a better coder?
While this game doesn’t use complex JavaScript, it will improve skills you’ll use for development. You must think about the strategy and workflow. You’ll optimize your JavaScript code because it gets old scrolling through all the lines to make changes. You may even start experimenting with different algorithms.
You can improve your skills and have fun doing it. While it may feel like you’re wasting your time with a game, you’re improving your abilities. I encourage you to give it a try even for a few minutes. It’s lots of fun!
If you want some more games to try, Francesco Leardini has shared a bunch of games to improve your web dev skills here. Check it out!