If you have any questions or feedback, pleasefill out this form
Table of Contents
This post is translated by ChatGPT and originally written in Mandarin, so there may be some inaccuracies or mistakes.
We're approaching the tenth day! Let's take a break and share a few games related to programming or computing. The game I want to introduce today is called A=B
, which you can purchase on Steam and is available for download on both Windows and Mac.
A=B
features a programming language designed by the game's protagonist, which only includes the syntax A=B
. You'll need to use this limited syntax to solve various puzzles, and as you solve more puzzles, the syntax will become increasingly rich.
Let's take a look at some reviews on Steam.
Game Content
In the game, you'll encounter various puzzles, all related to string manipulation. The A=B
syntax allows you to replace string A with B. For example, if the program is aaa=bbb
and the string is aaabbb
, the result will be bbbbbb
(replacing aaa with bbb). The explanation of the syntax in the game is quite brief, so I’ll drop a PDF link for you. As the story progresses, you'll encounter more and more syntax.
Here are a few sample puzzles from the game:
1. Sorting abc
Given a string that only contains the letters a, b, and c, with a maximum length of 7, how would you write it using only the a=b
syntax?
The answer to this puzzle is straightforward; you just need to enumerate the three variations:
ba=ab
ca=ac
cb=bc
If the input is: bcba
- Match
ba
, replaceba
withab
, resulting in the stringbcab
- Match
ca
, replaceca
withac
, resulting in the stringbacb
- Match
ba
, replaceba
withab
, resulting in the stringabcb
- Match
cb
, replacecb
withbc
, resulting in the stringabbc
From a programming perspective, this is a problem that could typically be solved with a simple for loop or function call, but now you must tap into a bit of creativity.
2. Palindrome
In this section, a few more syntax options are available:
y=(return)false
When matching y
, it returns false
.
(start)a=(end)b
When matching the starting string a
, it replaces the last character with b
. This characteristic of the prefix altering the suffix might seem counterintuitive, but the game design will guide you to naturally learn how to use this syntax.
The task is a well-known one: determining whether a string is a palindrome, with the input consisting only of the three letters a, b, and c.
axAy=
bxBy=
cxCy=
(start)a=(end)xAy
(start)b=(end)xBy
(start)c=(end)xCy
yx=(return)false
=(return)true
At first glance, it may seem difficult to understand, but after examining the code, the core concept becomes clear.
First, if a string starting with a, b, or c is matched, the end will be transformed into the form xAy; here, xy can be replaced with other strings, indicating that it has already been processed. Assuming the input string is abba, after the first round of processing, the string will change to: bbaxAy.
At this point, executing axAy=
will eliminate a set of palindromes. Ideally, all palindromes will be removed; if any remain, it will result in a situation like yx
, indicating that some strings did not match.
Reflections
Playing this game doesn't require knowledge of any programming language, but it can be difficult to dive in without a basic understanding of problem-solving concepts. For software engineers, playing this game feels a bit like solving problems using a poorly designed language.
However, I think this is a good thing. We’ve become accustomed to the concepts of programming languages, and after writing loops and functions, occasionally approaching problems from a different angle can lead to greater enjoyment.
The two examples above could be solved in just a few minutes using programming languages, but implementing them using the A=B
syntax requires a fair amount of thought and leads to entirely different ways of thinking to achieve the desired outcome.
If you found this article helpful, please consider buying me a coffee ☕ It'll make my ordinary day shine ✨
☕Buy me a coffee