SHENZHEN I/OBUILD CIRCUITS. WRITE CODE. RTFM
Congratulations employee! You've opened up the correct thread to read about
Shenzhen I/O, a game from
Zachtronics - the creators of
SpaceChem.
https://www.youtube.com/watch?v=vpoJbIaBg8E
Shenzhen I/O is a puzzle game where you are the newest engineer at Shenzhen Longteng Electronics Co., Ltd, tasked with the creation of the latest line of gadgets for the greater glory of the company.
This game takes inspiration from previous games in the series - especially
TIS-100.
You are given an input, and are expected to wire up/program your components to generate a specific output:
Just like being a real engineer!
Come in and post your solutions, puzzles, and we'll shoot the breeze. Or something.
Penny Arcade Developers at
PADev.net.
Posts
As it turns out, after actually playing the game - "Yes, things would have been easier with a printed manual" is the correct answer.
I "make do" with putting the PDF on my second monitor, though.
One of them, i got a solution that's slighlty out-of-phase making it invalid, the other looks like magic to me.
Check out my site, the Bismuth Heart | My Twitter
Check out my site, the Bismuth Heart | My Twitter
I managed to get it on my first try!
But then I put it away again so that I could keep saying that I had a 100% success rate.
As far as the main game is concerned, I've only done the first 5 problems. Debating if I should buy some paper to print out the manual.
This cuts too damned close to the bone.
Serious spoiler (After COOL DAD!!! e-mail)
Undocumented instructions!
This is too close to my real job!
As a game, Shenzhen I/O takes cues from real embedded development, and simplifies things to make it manageable and fun for those who don't want to get into the nitty gritty of professional development. I thought it might be interesting for those who enjoy Shenzhen I/O but aren't in the industry to hear some of my real life experiences and thoughts in relation to the puzzles.
As some of you might know, I am a professional embedded developer. I've worked with tiny 8-bit microcontrollers (like the ones that power the popular Arduino range of products), to your industry bog standard ARM running Linux (like the ones that power most smartphones). I'll be ruminating on random stuff that's related to puzzles in the game that I pick (or if there's a particular one that you're stuck on, post and I'll see what I can do).
I will try and avoid giving direct solutions to the puzzles, since half the fun is solving the puzzle in the first place. If I do give a solution to prove a point, it'll be one that will be average at best.
Security Camera (Fake)
Ah, Blinkenlights - a key part of any feedback mechanism. I guarantee you that over half your embedded devices will have LEDs on them, if only to indicate the presence of power/activity.
Here, we're tasked to blink LEDs in a certain pattern:
What's interesting in this particular example is the second waveform.
I believe the way that Shenzhen I/O encourages you to look at is is that it's a periodic waveform made up of two patterns of smaller periods:
This isn't a bad way to look at it - if this was an actual product, blinking light patterns may actually be implemented as two separate patterns placed one after another.
What's interesting is that you can also approach this as a composition of two patterns of equal periods, overlapped with one another:
The key advantage of this perspective is that there are two patterns of equal periods. A lot of microcontrollers have timing units that can be configured to generate simple on/off PWM patterns like pattern 1 and 2 are, and once configured, can run without further CPU interaction. By reducing the slightly complicated output pattern into two simple patterns, we are now able to potentially use timer units, and because they are of equal periods, we can easily combine them without using any processing power.
We can actually use hardware (resistors, circuit layout, output drives, and the innate nature of the LED) to implement the addition/subtraction necessary to combine two simple patterns into the output pattern that we want.
Now why would we want to approach a problem like so? Because using these timer units only requires a one time initial configuration to set up the patterns that they need to generate. Once you set them up, they just run - even if you put the processing core of your microcontroller to sleep. For battery operated situations, this may be an advantage because the processing core of a microcontroller is typically a large percentage of the power consumption.
Again, which particular solution you'd pick in practice would depend on your overall situation/product goal.
So the concept is simple: Given a signal, double it, and output the result:
So in this particular case, we can rewrite the problem as:
Doubling a signal is not particularly difficult to implement.
But what happens when we have a time consuming/complicated processing function that is hard to implement in a given processor?
One common technique is to utilise lookup tables. People who are older (before the age of digital calculators, some time during the age of slide rules) may remember sine and logarithmic tables. A lookup table is the digital equivalent.
Hilariously, what's old is new again - in some scenarios, embedded microcontrollers that require trigonometric or logarithmic operations will often have said lookup tables, because unlike your modern day desktop CPU, those microcontrollers do not have hardware trigonometric or logarithmic instructions.*
You can actually use lookup tables to great effect in Shenzhen I/O. Some of the puzzles can require complex calculations which are hard to fit into the space allowed... or you can convert the possible inputs into rows of a lookup table, and then do a read from ROM to get the precalculated results.
* Admittedly, there are also iterative methods to calculate sine/log, so brush up on your maths! =P
Unreal Engine 4 Developers Community.
I'm working on a cute little video game! Here's a link for you.