• Home

  • Productivity

  • App tips

App tips

7 min read

while True: learn(): Understand machine learning by playing a game

By Miguel Rebelo · February 7, 2023
Hero image with a screenshot of while True: learn()

You're a machine learning specialist (bear with me). One night, while trying to solve a bug in your code, you step away from your computer to brew another cup of coffee. As you leave for the kitchen, your cat leaps onto your chair and starts typing the solution on your keyboard. When you return, the code is working, and your cat is sitting there, innocently licking its paws.

Struck by this feline surprise, you decide to build a machine learning model that can interpret everything your cat can teach you. You hop on Catoverflow and take the first step toward understanding the meaning behind all that mysterious meowing.

And that's the gist of while True: learn(), a cartoony puzzle game that'll give you a big-picture idea of what machine learning is all about. I just finished the game—I still have to work on the gold medals, though—and I can tell you this is the most fun I've had doing a deep dive into a new topic in a long time.

Help! My cat is smarter than me

while True: learn(), like all good puzzle games, is simple in nature and gets complicated as more ingredients are added. In each level, your main task is to:

  • Take data from an input

  • Process the data using machine learning models

  • Deliver the sorted data to the outputs, based on what each output requires

A machine learning network in while True: learn()

For the sake of simplicity, the game's developers represent different data by using three colors (red, green, and blue) and three shapes (triangles, squares, and circles). In the real world, this could translate to text, images, or any other data type. Once you connect your machine learning network together and press Play, you see a procession of colored shapes making their way from the left to the right of the screen.

Each level has its own objective. Most involve delivering the correct amount of data accurately enough to each of the outputs. If you're super efficient—meaning, you use the fewest number of nodes and complete the level as fast as possible—you'll get a gold medal.

I was really confident after the first few levels, but things got hard quickly. Also, I was confused by the game using the term "machine learning" frequently and "artificial intelligence" almost never. What's up with that? I thought they were the same.

Machine learning vs. AI: What's the difference?

I tabbed out for my first Google search, and no—artificial intelligence (AI) and machine learning (ML) aren't as interchangeable as I thought they were.

Artificial intelligence deals with building features into a machine that make it capable of matching (and surpassing) the abilities of natural intelligence; these machines should be able to see, hear, reason, and act in the world with a level of flexibility and competence comparable (ish) to what humans can do.

But even humans aren't born ready for everything. As we grow, we learn and accumulate experience, improving most of our skills in the process. Machines need to do the same, and that's the purpose of machine learning (which is part of AI). Instead of going to elementary school, computers learn by taking huge sets of data, processing that data using algorithms at an astoundingly high speed, and then drawing on the results of that processing to make more accurate decisions in the future.

So, while AI and ML often appear together, they're not synonyms: ML is one of the technologies that builds AI. That's one less mistake I'll make. One more victory for human learning.

Freelance machine learning developer, at your service

A job for reward in while True: learn()

Back to the game. While the main objective is to understand your cat using machine learning, you'll have to take freelance jobs to make money and gain experience. Universities, companies, and individuals reach out to you, hoping you can build a network tailored to their needs. These jobs, while fictional and goofy, suggest possible real-world applications of the technology:

  • Choosing the best ingredients in a dairy product factory by analyzing data on ingredients used in the past

  • Creating a pathfinding system in a city to help traffic avoid road work

  • Predicting the winner of the next presidential election from a huge database of relevant data

In addition to freelance jobs, you can also get involved with startups. Once you buy in, set up a machine learning solution and see how the users like (or don't like) your approach. Tweaking is encouraged, so you can go back to your original design to make changes, try out other configurations, or make the network more efficient.

The better you are at meeting your user's needs—such as training a self-driving car to stay on the road—the more cat bucks you'll make. And with those bucks, you can buy upgrades in C-Bay, helping you solve the next puzzles faster. Or you can just blow it all on swag for your cat as I did.

Buying upgrades in while True: learn()

Iron Cat costume or no, there are things you absolutely have to buy whenever they become available: new machine learning nodes. If you don't, you might not be able to make a passing grade on a few levels later in the game. But why are these nodes so important?

Machine learning algorithms, from bad to awesome

Learning about machine learning in while True: learn()

In basic terms, each machine learning node represents a unique method of processing information and making decisions.

At the beginning of the game, you'll only have access to primitive technologies. As you unlock each new one, you'll have a quick explanation of how it works in the game and also how it works in the real world. The real-world tutorials contain links to articles, videos, and courses to learn more. 

Here are a few terms I picked up as I played the game:

Expert system: A computer system that compares the input with information inside a knowledge base. It can explain things and give advice. It's heavily limited by the amount and quality of data inside the knowledge base.

Supervised machine learning: A method used for training algorithms. Think of it as giving a child a test and the cheat sheet together. It will work to understand the relationship between the questions and the correct answers. Then, when a real-world question comes along, it has a good idea of how to plot its way toward the best possible answer.

Decision tree: A supervised learning algorithm used to classify problems. It represents all the possible solutions to a problem in a tree-shaped scheme:

  • The root contains the problem. For example, at what time will I wake up tomorrow?

  • Each branch contains a possible decision. At what time did I go to bed? How many cups of coffee did I have?

  • Each leaf contains a possible solution. If I went to bed late, it's probable I won't get up early.

Random forest: A collection of decision trees. Why use only one decision tree to know what time I'll be up tomorrow? Run the data through 1,000 decision trees and make an average of all their responses, thus reducing the impact of variance.

Genetic algorithm: An algorithm inspired by Charles Darwin's theory of evolution to determine the best answer to a problem. Each answer is like an individual in a population. The algorithm labels each individual based on their success, and then pairs the two best ones together. The result is a new member of the population that contains data from both "parents" and a random element to keep the population diverse.

This is a sample of all the terminology you'll become acquainted with. Now, the next time you sit down with ChatGPT for your five o'clock idea-generating session, you'll have a nice mental picture of what's going on behind the scenes.

What you'll learn (and what you won't)

while True: learn() is good fun for people who like brainy puzzles. But will you be able to start your machine learning career from scratch right here? When you click the Education button on the main menu, you get a 10-step list to land a job as a machine learning specialist. Among other steps, it involves:

  • Watching a short YouTube playlist with the core concepts

  • Learning Python

  • Completing the Google ML course

  • Practicing for a long, long time on real-world problems

If you have professional experience as a software developer, I'd say it's possible to plot your career switch from this game. For those of us without as much technical knowledge, we'll have to learn foundational skills in programming and computer science first.

But that doesn't mean that while True: learn() is just a guilty pleasure. Even if you don't decide to pursue machine learning, you'll walk away with some transferable skills. For example, the focus on systems design is great for understanding how networks work: there's an input of data on one side, that data is then processed through one or more programs or algorithms, and it's delivered to an output, so it can be stored, shown to the user, or serve as an input for another system.

Build your automation muscles too

Understanding these concepts can help you brainstorm better ways to leverage everything Zapier offers, too. When you start planning your Zaps using a flowchart—identifying where the initial data is, how you're going to process it, and where it should be delivered to—you can go from simple data transmission to full automation. Here are some articles here on the blog that help build this mindset:

  • Maximize your productivity with multi-step Zaps

  • Zapier Paths: A smarter way to build conditional workflows

  • Efficient automation: how to get the most out of your Zaps

Zapier is a no-code automation tool that lets you connect your apps into automated workflows, so that every person and every business can move forward at growth speed. Learn more about how it works.

while True: learn() is also a great stepping stone to other programming games, such as Human Resource Machine or almost every game by Zachtronics. The only challenge will be finding the time to sit down and play. Maybe I can get an AI scheduling assistant to help me free up my calendar?

Cat-human understanding achieved

A screenshot of while True: learn()

You serviced dozens of clients, rode the startup wave, and processed tons of data. I won't spoil the ending. There's a Hitchhiker's Guide to the Galaxy vibe, and that's as far as I'll go.

Getting all the gold medals is difficult, so chances are, you'll reach the end of the game with still a lot to do. You can go back and find better ways of solving each level, turning your track record from silver and bronze to solid gold. I'm 15 hours in and halfway to all gold. Your mileage may vary depending on how much of a puzzle game champion you are.

So, if you've got some time this year to flex your brain and learn something new, while True: learn() offers a set of fun puzzles that'll demystify AI, ML, and systems design. And who knows if that isn't the first step to a career switch?

Related reading:

  • AI for business: What is AI and how will it impact work?

  • How you can (and when you shouldn't) use ChatGPT to write marketing copy

  • How to write an effective GPT-3 prompt

  • The best AI productivity tools

Get productivity tips delivered straight to your inbox

We’ll email you 1-3 times per week—and never share your information.

tags

Related articles

Improve your productivity automatically. Use Zapier to get your apps working together.

Sign up
See how Zapier works
A Zap with the trigger 'When I get a new lead from Facebook,' and the action 'Notify my team in Slack'