The Snake-Game Test 🐍

Photo by Albert on Unsplash

This is my favorite way to learn embedded systems:

The Snake-Game Test.

When we’re learning any topic in embedded systems, what really important is the relevance between what we know vs. what we can do.

That’s why hands-on experiment is extremely important in embedded systems.

The Snake-Game Test is a simple test to check if we do enough hands-on when learning embedded system. It’s an interesting framework to help you ensure you don’t waste time learning unnecessary things.

The Snake-Game Test was inspired by me when I was trying to build a snake game using C++.

When I was building the game, I didn't learn the entire C++ language constructs, but I only learned what I needed to build the snake game.

That approach gave me a better understanding of basic game design, and basic C++ constructs. I always know if I want to learn more advanced C++ features, then I can learn it by building even more complex programs.

Here are the 4 foundational concepts of The Snake-Game Test:

  1. Real-World Project
  2. Just-In-Time learning
  3. Extremely Hands-On
  4. Iteratively Improve the Project

Let's dive right into each concept.

Real-World Project

If what you do is hypothetical projects like foobar, building linked list, etc. You'll struggle to apply the topic you're learning.

Instead, pick a real-world project, that's concrete enough for you to work on, like the Snake game. Everyone has played snake game at some point in their life.

Instead of writing program with 1000 linked-list, why not create a snake-game that applies linked-list concept to the snake?

Just-In-Time Learning

Instead of learning everything upfront (which takes too much time), The Snake-Game Framework encourages you to learn just enough to make the project work.

Instead of learning every C++ feature from a book, learn just enough to make the snake move. Start by asking questions:

  • Snake usually moves in grid, how to implement grid system in C++?
  • How do I actually draw image using C++?
  • How to make the snake move? What data structure to use?
  • How to place snake's food at random places?
  • How to detect the snake biting itself?
  • Etc.

By answering the questions above, you are guaranteed to learn and use only the important things of C++ for the snake game.

Another example, let's say you want to learn MQTT and decide to build a temperature monitoring system. You don't read the source code of HiveMQ Broker. Instead, you ask these questions:

  • What is MQTT? How can I send data from A to B?
  • What is MQTT Topic? What is QoS? What's the difference?
  • Should I write my own client or is there ready-to-use library for MQTT?
  • etc.

That way, you won't overwhelm yourself with the complexity of MQTT broker source code. You will have good experience and great understanding of the basics.

Extremely Hands-On

We're not doing theoretical study here.

We're not analyzing the game design mechanics, reward system, level-up mechanism, etc. We want to build the damn snake-eating-food game until it dies.

We're not writing an essay on how MQTT actually sends and transmits data.

We're not writing an essay comparing MQTT vs. HTTP vs. WebSocket.

We're building something. Period.

Yes, you might have to research a bit, but the goal is to assist you in building the project, not writing essay.

Iterative Approach

The Snake-Game Framework encourages iterative process.

First, you make the program draw grid. No snake yet? No problem.

Second, you make the program render the snake. No foods yet? No problem.

Third, you make the snake move and add food. Buggy? Good. Fix it.

Next, you start adding wall detection, self-bite detection, etc.

The point is, nobody is watching you, so you might want to make as many stupid mistakes as humanly possible (you will be surprised how many recompilations I did just to fix a simple bug).

This Snake-Game Test (probably I should call it "framework") will help you close the gap between what you know vs. what you can do.

Happy learning! 🐍

Whenever you're ready, there are 2 ways I can help you:

1. FREE Firmware Development Email Course. A free 7-Day Email Course to teach you the foundational concepts you should know to start firmware development. Full of practical tips and industrial insights.

2. FREE Embedded Freelancing Email Course. Another free Email Course to help you grasp the basics of embedded freelancing and make more money as an embedded engineer.