Coding Challenge  #43 - Tetris

Coding Challenge #43 - Tetris

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. Many of us started by building our own Pong and over time progress to either copying other more complex games, building our own game from scratch or customising existing 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 and development environment you’re going to use. This would be a great project to try a frontend stack if you’re a backend developer and if you’re a frontend developer perhaps try building a desktop application.

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, or programming language.


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 on how to play the game - i.e. the controls and perhaps an introduction to the gameplay. You can leave starting the game until the next step, but you should render the help screen as part of this one.

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:

  1. I write another FREE newsletter Developing Skills that helps you level up the other skills you need to be a great software developer.
  2. I have some courses available:Become a Better Software Developer by Building Your Own Redis Server (Python Edition) which guides you through solving the Redis Coding Challenge in Python.Build Your Own Shell (Go Edition) which guides you through solving the Shell Coding Challenge in Go.

Ayman Anaam

Dynamic Technology Leader | Innovator in .NET Development and Cloud Solutions

1 年

Very useful. Challenges build us stronger. Thank you John Crickett

Matthew Kolakowski

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

Raul Junco

Simplifying System Design

1 年

I love Tetris! Good challenge John Crickett

回复
Neo Kim

I Teach You System Design ? Founder @ System Design One

1 年

this is amazing, John Crickett

要查看或添加评论,请登录

John Crickett的更多文章

  • Coding Challenge #86 - Strace

    Coding Challenge #86 - Strace

    This challenge is to build your own version of Linux tool strace. It’s a useful tool to debug programs that you don’t…

    9 条评论
  • From The Challenges - Memcached Server

    From The Challenges - Memcached Server

    ?? ?? Happy Birthday Coding Challenges - Two Years Old! ?? ?? Coding Challenges is turning two this week! To celebrate…

    13 条评论
  • Coding Challenge #85 - Time Zone Converter

    Coding Challenge #85 - Time Zone Converter

    Coding Challenge #85 - Time Zone Converter This challenge is to build your own Time Zone Converter. That is a tool to…

    12 条评论
  • From The Challenges - IRC Client

    From The Challenges - IRC Client

    Welcome To Coding Challenges - From The Challenges! In this Coding Challenges “from the challenges” newsletter I’m…

    5 条评论
  • Coding Challenge #84 - Mandelbrot Set Explorer

    Coding Challenge #84 - Mandelbrot Set Explorer

    This challenge is to build your own Mandelbrot set explorer. The Mandelbrot set is a set of fractals that exhibit great…

    4 条评论
  • From The Challenges - Cat

    From The Challenges - Cat

    Welcome To Coding Challenges - From The Challenges! In this Coding Challenges “from the challenges” newsletter I’m…

    7 条评论
  • Coding Challenge #83 - Markdown Presentation Tool

    Coding Challenge #83 - Markdown Presentation Tool

    Coding Challenge #83 - Markdown Presentation Tool This challenge is to build your own version of Go’s Present or…

    3 条评论
  • From The Challenges - Shell

    From The Challenges - Shell

    Welcome To Coding Challenges - From The Challenges! In this Coding Challenges “from the challenges” newsletter I’m…

    3 条评论
  • Coding Challenge #82 - Markdown To PDF Editor

    Coding Challenge #82 - Markdown To PDF Editor

    Coding Challenge #82 - Markdown To PDF Editor This challenge is to build your own tool to convert markdown to PDF. It…

    14 条评论
  • From The Challenges - Diff

    From The Challenges - Diff

    Welcome To Coding Challenges - From The Challenges! In this Coding Challenges “from the challenges” newsletter I’m…

    7 条评论

社区洞察

其他会员也浏览了