I want to improve the content I build for dev.to. Topic ideas and feedback are welcomed! Reach out to me!!
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.
- 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.
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.
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!