Human Resource Machine: Part 2

created on updated on 🕰️ 6 minutes

This is a second article on HRM game. Read part 1 here.

A game about computation, problem solving, and free thinking.

HRM keeps you entertained as you play and learn about computers; it fosters imagination and problem solving skills that are much needed in today’s modern world. And best of all, no formal training or knowledge is required.

“The idea behind digital computers may be explained by saying that these machines are intended to carry out any operations which could be done by a human computer. The human computer is supposed to be following fixed rules; he has no authority to deviate from them in any detail. We may suppose that these rules are supplied in a book, which is altered whenever he is put on to a new job. He has also an unlimited supply of paper on which he does his calculations. He may also do his multiplications and additions on a ‘desk machine’, but this is not important.”

A. M. TURING, I.—COMPUTING MACHINERY AND INTELLIGENCE, Mind, Volume LIX, Issue 236, October 1950, Pages 433–460, https://doi.org/10.1093/mind/LIX.236.433

Figure 1: Magic. The game will teach these things to you.

Figure 1: Magic. The game will teach these things to you.

Human Resource Machine is a clever game that exposes the player to the fundamentals of computation and theoretical inner workings of computers. HRM uses a cute office worker in an office environment as an informal model of computation. A Model of computation describes how an input of the system is processed to produce a desired output. This model is not so different from the original model Alan Turing described whereby a problem is solved with pen and paper by following an exact and finite series of steps. HRM resembles this process one to one. HRM has an exact set of possible rules to choose from, a finitely sized list of rules arranged in a specific order (the program), a cute office worker who blindly interprets the rules, some scratch working space, a way to read the input, and write the output.

The Basics

figure 2: “In science, computing, and engineering, a black box is a system which can be viewed in terms of its inputs and outputs (or transfer characteristics), without any knowledge of its internal workings.” see: https://en.wikipedia.org/wiki/Black_box

figure 2: “In science, computing, and engineering, a black box is a system which can be viewed in terms of its inputs and outputs (or transfer characteristics), without any knowledge of its internal workings.” see: https://en.wikipedia.org/wiki/Black_box

The player is introduced to an input and output system by the use of INBOX and OUTBOX commands. The IN labeled conveyor belt moves the boxes with values, just like a real assembly line moves packages with items. In the same fashion, another OUT labeled conveyor belt carries the boxes out of the room. The avatar is represented as an office worker who dutifully follows the player’s commands. The player assembles the commands in the command instruction area for the office worker to follow.

The avatar can carry a single box at a time. She can manipulate the boxes by moving them around, placing them on the floor, delivering them to the outbox conveyor belt, adding or subtracting values with other values in the boxes on the floor, and making decisions on primitive condition statements. Fortunately and surprisingly, this is enough to write any kind of program to solve any kind of problem that is solvable by a modern computer, today, which makes HRM as expressively powerful as the device you are reading from!

Useful programs consume input and produce a desired output. Each floor is a tiny black box system that has an input coming in and an output going out.

Our avatar lives inside this black box. It is up to us to transform the input to a desired output as specified by the requirements of the level—that is to write valid programs that pass the judge (the gatekeeper). We slowly build on commands which allow us to solve ever harder problems.

Admittingly, it takes an effort to write more complex programs, and no one is spared some frustration. But the mastery is well worth the hard work invested. There is a great reward for mastery as well as attained joy and the pleasure of figuring things out. Going through this iterative process develops a computational mindset and a higher capacity for solving increasingly difficult problems. Difficult problems are challenging today and become trivial tomorrow.

Play to learn

The game also provides optional levels which might appear to be more difficult but only at first. By the time they become available, we would have the tools to solve them, as they are the same kind of problems we have solved before, for we just do not recognize them; for example, there is very little difference between Level 10: Octoplier Room and Level 12: Tetracontiplier room problems. One asks to multiply a number by eight while the other by forty. Understanding prime factorization allows the player to solve both problems efficiently.

HRM teaches the player to break down any problem into manageable pieces. And sometimes these pieces can be used verbatim as components for solving future problems. It is through a combination of simple steps that the solution is realized. Furthermore, there are even more challenges for the determined: the optimization for speed and size. Such challenges are a classic in competitive programming communities.

figure 3: The challenge. It is not always possible to satisfy both conditions at the same time.

figure 3: The challenge. It is not always possible to satisfy both conditions at the same time.

Later in the game, the player learns about memory. HRM cleverly uses tiles and allows the player to reference them by their numerical name (location number). Future levels allow indirect addressing. The game never uses technical jargon, but more importantly the concepts are indirectly understood through play and experimentation. The player learns how to work with memory, which is not very different from the way real programming languages handle arrays or vectors.

The player also learns extensively about control flow, and implements the inner workings of while loops at the assembly level. This is not a well understood mechanism by newcomers, and HRM unveils the magic behind higher level concepts without confusion.

More than a game

The game covers at least a few textbook chapters on programming for beginners; the player will learn about queues, control flow, variables, registers, memory, addressing, bookkeeping, program states, null terminated strings, decision trees (think three sort level), etc. Furthermore, all of these ideas are distilled to their basic forms. HRM prepares the player for the future: be it going on to learn about programming, or just thinking about real life processes.

Lastly, HRM asks big questions that inspire, cause wonder, probe the deep ideas about mathematics, science, and philosophy.

We have neglected talking about a few aspects of the game that inspire us to look a bit further. One of them is the judge. The judge validates our programs. The judge tells us if we are right or wrong. And if we are right, we are allowed to advance up the next level.

But how does the judge know what makes a valid program? How does the judge verify correctness of valid programs? How does the judge verify our output? Is it easier to check our work than to solve it? These are just a few of many questions with surprising answers.

We may be convinced of an all powerful knowing figure, but the judge can be fooled and tricked. Gasp.

This touches upon a very important concept in computability about what is computable and at what cost? Can all programs be free of errors? Can we guarantee a program will terminate? How long will it run? Can we design an adversary to trick the judge? In the real world scenario, the programmer has to write the test cases and hope for the best code coverage she can. There is always a possibility for a case to be missed or a hidden bug lurking to be discovered by an unlucky user or worse an adversary with ill intentions.

figure 4: Thinking about edge cases.

figure 4: Thinking about edge cases.

In the end, HRM makes it accessible for anyone to develop problem solving skills without fear, anxiety, or blocks that come with formal learning of STEM topics. Playing is a stress free way to acquire a taste for something quite essential and much needed: free and critical thinking—the kind of thinking that is needed for finding answers to big questions about life, the universe, and everything.

figure 5: Buffer overflow! Someone will try this.

figure 5: Buffer overflow! Someone will try this.