Coding Challenge #43 - Tetris
John Crickett
Helping you become a better software engineer by building real-world applications.
Tetris hit the news this week with reports that a US teenager Willis Gibson claims to be the first person to beat Tetris by reaching level 157 at which point the game apparently crashed.
With that in mind and amid many request for more Coding Challenges related to computer games, this challenge is to build your own version of the famous computer game Tetris.
The requests make sense; for as long as I have been interested in programming, programmers have been learning by building computer games
I certainly spent a lot of my childhood cloning Sensible Soccer and the Alien Breed franchise before moving on to writing ‘AI’ based bots for Quake, Quake 2 and Quake 4.
New Year Deal: 20% Off All Courses
To celebrate the new year I’m offering 20% off all my courses from now until midnight (GMT) January 7th 2024. Use the code NEWYEAR2024 to claim the discount when purchasing:
You can also get 20% off an annual subscription to the Coding Challenges newsletter - paid subscribers get 20% off all my courses at any time.
The Challenge - Building Your Own Tetris
Tetris is a computer game that has been around since 1985 and has appeared on many platforms since then. It is one of the best selling computer games of all time.
Fundamentally the game is quite simple the player completes horizontal lines at the bottom of the screen by fitting in shapes that descend from the top of the screen. Completed lines disappear, earning the player points. The game ends when the uncleared lines reach the top of the screen.
领英推荐
Step Zero
In this step you decide which programming language
If you’re from a data engineering or site-reliability engineering background you could leverage your knowledge of Python with PyGame or Go with Ebitenegine. Rustaceans can check out?are we game yet?for useful crates.
Tetris is a relatively simple game to build and as such, is a great platform for learning a new technology
Step 1
In this step your goal is to create your welcome screen. This screen should give the player the option to start a game or access some basic instructions
You could even include some high scores. Something like the following:
Continued...
You can find Step 2 and beyond on the Coding Challenges website as build your own Tetris.
Or if you'd rather get the whole challenge delivered to you inbox every week, you can subscribe on the Coding Challenges Substack.
2 Other Ways I Can Help You:
Dynamic Technology Leader | Innovator in .NET Development and Cloud Solutions
1 年Very useful. Challenges build us stronger. Thank you John Crickett
Student
1 年Always good
Lead Data Scientist
1 年Still working on my Tetris (In Python), but have a working version here- https://github.com/MatthewK84/LinkedIn-Learning-Journey/blob/main/Tetris.py
Simplifying System Design
1 年I love Tetris! Good challenge John Crickett
I Teach You System Design ? Founder @ System Design One
1 年this is amazing, John Crickett