Let's Look At: Shenzhen I⧸O
The full transcript of Let's Look At: Shenzhen I⧸O, a 45-minute Northernlion video (Shenzhen I⧸O) uploaded on October 11, 2016: 106 timestamped lines, about 8,400 words. Press any timestamp to play the video from that moment.
- 0:00 hey everybody and welcome to let's look at shenzhen io. this is a game from zachtronics games and right off the bat if you recognize the name they made tis 100, they made infinifactory, they made spacechem, and they also made ironclad tactics but that game is kind of an anomaly in their collection. not to say that it's bad, i actually liked it but most of their games are
- 0:21 programming puzzle games this is in the same vein as a game like tis 100 a game where you are assembling a system via a programming language to accomplish a puzzle that they give you it might sound boring i really think that for my money zach's ronix are making some of the most interesting puzzle games in the market right now and the they have a huge audience of people that really love these things they optimize them and i am becoming part of that market. you know i've been learning programming in my downtime and
- 0:50 i don't think that you need to know programming to understand what's going on here, but you do some skills that are relevant in this game, and it is a difficult game as zachtronics has a reputation for creating, but some skills that are relevant in learning programming, like for example referring to documentation, are very relevant when playing this game. i've had a great time with it so far, i've played maybe two or three hours, that's enough to solve five puzzles, four puzzles, it's beguiling. i did get a review copy of this for free from zachtronics, it's available on steam for 15 bucks.
- 1:18 if you're the kind of person that's into this sort of thing, you're gonna love it. bear with me here, um, just keep in mind i can click this button here that says data sheets. this for me brings up a pdf of reference material, like a 30, 40 page pdf here, with syntax and other specifications for products and stuff we'll be using here that i may have to refer to over the course of this video, and that's the intention. and for those of you who are saying, you know, why don't you just program something for real? you don't get it. you just don't get it, okay?
- 1:46 this is a way it's like if being really good at football and then you go to the combine and you're throwing you know passes through hula hoops or something like that to show how good you are to your coach your coach being like oh, i'm gonna just play a real game of football. you don't understand. this is a it's code kata. it's a test of your skill it's a good way to refine simple loops and algorithms. let's get started here so the compared to something like tis 100 this has a really really intuitive interface i think
- 2:11 and it actually is a story that undercuts what's going on. basically, you're a disgruntled expat in the near future from england, i think, and you have decided, hey, i'm gonna move to i'm gonna pursue my career as an electrical engineer or whatever you are that creates these things in shenzhen, china. you know, shenzhen famous for having a lot of electronics, basically.
- 2:31 being the world capital for electronics and every day or you know whenever you desire you will get emails and these emails will give you specifications for products that they need made so these are the leaderboards for the solutions that i've done here you can see check marks mean solutions, so i've made five things, and then i've got a few outstanding puzzles. i have not yet done
- 2:51 so we got an email this product is an imitation security camera it has two blinking lights the first light blinks in a regular pattern the second light is an internet light so it should be blinking in a more random intermittent pattern to resemble data upload as you'll notice the design is partially complete already a previous engineer left before finishing the assignment blah blah blah i'll explain that myself, so we're just gonna start a new design here and open it up and
- 3:15 this is basically the tutorial so at first you're gonna look at this and you're gonna say what in the goddamn hell am i even looking at right now, and that's by design
- 3:25 you do have to learn a new way of interfacing with this game, but it's not as complicated as it may seem at first blush. so basically, here's our information. these are the project specifications. we're making a fake surveillance camera. active and network are simple outputs connected to leds. this is active, this is network. you can just think of these as interactive objects for now. you don't need to think, is this an i.o. port? is this a random access memory slot or something like that? don't worry about it.
- 3:55 control the active and network outputs with fixed repeating signals as indicated in the verification tab. the verification tab tells you what you're supposed to do.
- 4:05 so for simple output, we're supposed to... it's gonna be off, and then it's gonna be on. and then it's gonna be off, and then it's gonna be on. and then it's gonna be off, then it's gonna be on. for simple output, it's gonna be off, it's gonna be on for a bit, it's gonna go off for a bit, it's gonna go on for a bit, and this is a repeating pattern. and then that'll be modeled here with the red light, i think, as our power, or our feed, or whatever it's called, let's see.
- 4:28 active i guess and then network is going to blink like on and off these are connected to time steps so this is how you get the pattern you want to sleep for one two three four five six and then go up and one two three four five six turn off, okay?
- 4:43 so how are we gonna do this? this is where i'm gonna need you to bear with me. because we're gonna be writing in an assembly esque programming language that i'm not really familiar with, but i've read enough and played enough that i can at least figure my way around this. first off, let's test this and see how it works right now just by hitting simulate.
- 4:59 as you can see, the first part of our program already works here. like it already matches the graph. red lines indicate where we deviate from what they actually want from us. so the orange line indicates that everything's going well. so this is what the computer has written for us. let's reset here.
- 5:17 so what exactly is happening here? basically, information is coming through our active port. the information is either going to be 0, meaning that the light shouldn't be on, or it's going to be 100, indicating that the light should be on. the first thing we're going to do is move 0 to p0.
- 5:36 i'm not quite sure why the game is doing this but that oh you know what because it doesn't even matter this this doesn't even necessarily have to be connected except to send an output here. okay, this disregard no information is coming from active. i know that sounds confusing forget everything i just said imagine this is our origin point p0 is basically where we're going to send data in order to make the light blink up so we're gonna start and we're gonna move 0 to p0 basically, we're gonna say hey
- 6:01 don't send any information. we're gonna send zero information to p0. it's gonna send that to active so the light will be off then we're gonna sleep for six time cycles, and then we're gonna say okay. you've slept for six now we're gonna move 100 which basically means you're gonna be on at max power and then you're gonna sleep for six so what should happen here well we'll advance first cycle sleep two three four five six
- 6:24 six so we slept for six and then one two three four five six. we're on four six basically we're assigning a variable zero for six cycles then assigning to 106 cycles and repeating it now we're going to do the same thing here, but we're going to do it with
- 6:39 with a slightly different pattern here. there's probably a more elegant way to do this, and that's part of what these games are all about once you get to a high level. but we're just gonna connect to this. don't worry about the x's for now, i'll talk about those. we can draw the wires, you know, differently if we so choose. we can even use things like bridges. i don't know if we can use them here. yeah, they won't let us use them here, but we can use bridges to make our wires more convoluted, but for now it's not that relevant. so what do we do in this one?
- 7:04 well, we're on a cycle of, you know, 1, 2, 3, 4. we sleep for 4, on for 2, sleep for 1, on for 1. so we're on a cycle like that. so let's just start with move 0, p0, same as up above, and then we're gonna sleep for 4. and then if we walk through this, you should see...
- 7:24 there you go. so we're good. unfortunately now it goes back to the top of our microcontroller, and it's just gonna move zero and sleep before it's just gonna sleep forever, but in a more roundabout fashion. so we need to add a little bit more. then we're gonna move 100 to p0, and we're gonna have it do that for two cycles, and we'll advance here. so this should give us the first part of our pattern, and then it'll go back down to zero, but then it's gonna stay at zero when we advance beyond this. good debugging tools, by the way, like really intuitive debugging tools in the game.
- 7:53 then we're gonna move 0 to p0 and we're gonna have it sleep for 1 and then we're gonna have move 100 p0 and have it sleep for 1. now this, i did a couple of steps at the same time there but you probably have figured it out. basically i'm just filling in the rest of the pattern. it's gonna sleep for 4, up for 2, down for 1, up for 1 and then it's gonna repeat that pattern over and over and as you can see
- 8:20 works out in order to show that it wasn't just a fluke and go through maybe some more test cases it's going to go through four like full cycles here to make sure that it's actually going to complete and it wasn't a fluke that we finished it the first time and voila we finished it for six one we made a
- 8:38 we made a fake surveillance camera. somebody is really good with the power usage here. i don't know how you saved yourself power usage here with less cycles. there's probably some kind of elegant loop that you can do that's a little better, but we're gonna return to our email. so that's a really simple project there that we can do. what is this one? our factory floor has some examples of older equipment that require control signals to be amplified. let's open that up and we'll do a
- 9:01 well, we can just do a new design, but it doesn't matter. okay, yeah, tomo, you can enter. hello, buddy. escape from ryuka, get some refuge. all right, so that was just the very basics. and if you're not understanding everything, let me start with the other case. if you're understanding everything, this game might be for you. if you're not understanding everything, don't freak out yet. you don't need a degree in programming, computer science, electrical engineering to play this game. you just need to learn a different way to interface with it. and one of the things that
- 9:30 that kind of bugs me about the reaction to zachtronics games, it's like, oh, if you're a genius, you'll love this. if you're not a genius, if you're not in the top like 0.5% of the population, you know, these games aren't made for you. i really disagree with that. you've seen my videos, you know that i possess no superior intellect for certain things, especially gameplay mechanics.
- 9:51 i've learned how to play these games and it hasn't been tough. there's simple steps, you just have to have patience, and really the manual that this comes with is very helpful. it's almost like papers, please, in the sense that you have to refer to a manual for the rules of the game, but you're actually referring to a pdf. and if that sounds boring, you just don't get it, man. you just don't get it. but also, these are niche games, you know, they're not for absolutely everyone. but for the people they hit, they hit really good. i've become obsessed with this already. okay.
- 10:20 so this time we're making an amplifier. basically, we're gonna get a signal and we have to amplify it. easy enough, right? well, easy enough in concept.
- 10:27 control in right here is a simple input connected to factory equipment so let's imagine that's connected to like a you know drill press or something control out is a simple output connected to other factory equipment so we got two drill presses connected and the one of them needs to go twice as hard as the other one the signal from control in should be multiplied by two and copied to control out so we're just gonna continue to use a simple microcontroller here to make this as easy as possible for me and for you and you can see this is the input that comes in
- 10:56 this is the output that needs to come out. so we basically just need to multiply the input by two. there's a really easy way to do this, by the way. let me see if i can handle this by myself first. we're just gonna say... give me a sec.
- 11:13 i want to see if i can do this in less power than i did it the first time. an easy way to do this would just be like move p0 to acc. i'll talk about what acc is. basically, it's memory. it's a stored variable. and then we're gonna, you know, multiply acc by 2 and then we're gonna move acc to p1. and this should really just work right off the bat. oh, it doesn't sleep. you have to have a sleep in it.
- 11:38 the sleep is mostly, i think, to keep the game in sync with itself, if that makes sense, to make sure that all of your microcontrollers are firing off and staying in sync with respect to time units with each other. so yeah, this'll totally work, and after we finish the simulation once here so you can see that it works, i'll explain what's going on here. this tutorial basically just tells you that, you know, you can...
- 11:59 manipulate data with a stored variable. so this microcontroller has a bit of ram on it basically called acc. what are we doing here? well, we're taking a signal, which is a variable like a number from control in so that it's saying, oh, we want you to fire at 25. so it's a signal of 25 strength comes in and then we say, okay, read that we got 25 and then move it to our, our memory. so we've stored 25 and actually if we step here,
- 12:29 and get to that point, you can see that actually on the visualizer here we can see that acc says 25. state is executing which means it's doing something and this is the power consumption right now. so we've stored 25 on our microcontroller. then we're gonna multiply it by 2. we only need one parameter here because multiplying, adding, subtracting always affect acc. even if we have two variables like this microcontroller over here has a dat variable as well, it always manipulates acc.
- 12:57 and then we'll step and you can see acc should be 50. and then we're just gonna say, okay, we've doubled it, so let's move acc to p1. basically we're gonna send it out. and then we're gonna sleep for one, which is necessary in order to finish the cycle here. so we'll run this and we'll crank up the speed a little bit.
- 13:16 just because we know that it's gonna work. and we'll see what our power usage is. it's possible we might be able to get a little cheaper on power usage, but only a very, very small subset of the population was able to do that. so i'm trying to think of... the way that we might be able to do it is like... it's like... p's... you have to add... i wonder if adding is cheaper than multiplication in memory terms. just bear with me here. move p0, acc, add acc.
- 13:52 and then move to p1. you do need another parameter there. i thought it might be implicit and then sleep one. so we're just gonna see if we use less power here. it's doing exactly the same thing. no, it's using exactly the same amount of power as well. i don't know, i was like, instead of multiplying something by two, we could just add it to itself, and that accomplishes the same thing, but it doesn't actually save us any memory. okay. so, you're like, oh, this is way too easy. like, each one of these puzzles is just one step. alright, be careful what you wish for, shitbirds. i'm gonna show you first, um...
- 14:22 this one took me forever and i was really bad at it. really, really bad at it. look at that. way more expensive than average and power usage is like, when i looked at this yesterday i took a screenshot and put it on twitter. i was off the graph. this is puzzle 4. puzzle 4 sent me for a loop like this. okay, so let's open up my existing design and look at this right here. first off you're gonna say what the hell is going on?
- 14:47 we got four microcontrollers, one of which is stacked in terms of its... like it's actually full of instructions. we can't put more instructions in there. and we're seeing some things for the first time, like for example, you have a bigger microcontroller. what's the reason for that? well, in this case i just needed more space to write instructions, so it's more expensive but it carries more space. it also has extra ports.
- 15:10 which is important because in this case i'm actually feeding five different ports information which is a bit of a leap forward from where we started beyond that it also holds a second variable which i don't use here but maybe i'll try to make a more elegant solution now, and it'll use it so what is this on godly contraption actually do here well before we do that? let's also talk about i use a different kind of port here. i use a
- 15:31 most of them are just the p ports and which is something that hahaha i giggle when i say because i'm 10 years old but a people are too simple input output to put it in layman's terms for those of you who don't want the pdf right now this can be read at any time. it doesn't need a specific
- 15:48 synced instruction. the exports are x bus memory. they have to be read and written at the same time. so basically, this one goes move p0 to x1. so it's sending data through x1, and then the first command on this one is read x1. otherwise they won't function. so what does this do? this animates this esports sign right here.
- 16:11 and we can slow it down just a little bit here. so we have to make an animation effectively. there's some clicking, there's some drinking, and the idea is that you could give this to somebody in the audience of dota 2 international or league of legends or something, and they could hold this up and it would be really cool and relatively cheap. i don't know what 15 yuan is from a...
- 16:32 american dollar standpoint, but it doesn't really matter you get the idea we're trying to build these as cheaply and as efficiently as possible so that's what that does and we'll try to make it better here but you know this could take us half an hour, and i'm being honest with you so let's rename this one, and we'll call this you know suboptimal profit suboptimal profit gouging profit price gouging and then we're gonna call this one dopest sign ever and we're gonna make it better and
- 17:02 this is where things are gonna start to get a little complicated. i'm by no means a master at this, but i'm gonna do my best
- 17:09 well, i mean without further ado let's get started. oh, you know the last thing i wanted to say is you might be saying well you're making an esports sign, but you're not really making an esports sign and while that is true we're only designing the logic later in the game you get access to displays you get access to actual like input output controllers like like an nes controller basically and you know basic
- 17:33 lcd? i think they're lcd screens or led screens that you can do like a simple count on. so it does get more complex. i've seen some people on the shenzhen.io subreddit have already made like pong, which fucking blows me away. it's crazy. the stuff that you can do in this game, it's it's zachtronics, you know, it's
- 17:51 you know the expression, you know, easy to play tough to master? they're tough to play and tough to master, tough to play tougher to master, but then, you know, the amount of flexibility and freedom you have when creating that stuff is off the charts. so let's start with the easy one. basically...
- 18:07 the clicking is either on or off. if one is on, the other's off. so we can read our specs here quickly. click one and click zero are simple outputs connected to display segments corresponding to a clicking animation. let's do that as easily as we possibly can. so we're just gonna put this over here and we're gonna say click zero goes in here, click one comes through here, and we don't have to put our controller there. do it like this.
- 18:33 ryuka i know you want to get in and fight tomo buddy. i'm gonna let you but don't don't make me regret it, okay by the way have mercy. i did this at 2 a.m.. last night, so i might be a little finicky on the solutions, but i think essentially the way that we want this one to go very simply would just be okay, here's how i think we're gonna do it. we're gonna start by moving 1 to p 0 moving 0 to p 1 and
- 19:03 although no wait sorry move 100 to p0 and moving 0 to p1 and then we're gonna sleep 1 and we're gonna move 0 to p0 and move 100 to p1. what do i want this to do in theory? well, it should first cycle p zeros on p1 is off second then it's gonna sleep for one second cycle p's click zero is off click one is on alright, so that's
- 19:31 a fairly good compromise, i think, for how we can sort that out. that's already sorted. i made this way more complicated for myself last night. now the second thing we're gonna do is much more complicated because we have three ports that need information. you can't connect an xbox port to an input output port, which is something that took me a while to wrap my head around. so we're going to need three output ports one way or the other. one thing we could do is have two different, or we could have one
- 20:02 port go to two different ports like that but this only really works for us, and there might be a way to make this work by the way but this only works for us if both of these need the same information like if p1 or if drink 0 and drink 1 are always doing the same thing. this is easy easy way to save money and and save power, but otherwise we're going to need some calculation to be done that makes that actually sensible and the way that we would do
- 20:30 do that is by having another microcontroller and then look at, i don't even know. one day we're gonna get into this and this is gonna be garbage but thankfully that day is not today so let's just, this is like the second element of the gameplay loop is just overlaying things on the board here. we could do this a few different ways. one way would be with two microcontrollers. i'm gonna see if we can do it like this to save ourselves a little bit of money. this is not the way that i did it last time. and how would we do this?
- 21:02 think? we need p1 to be accessible. so i think we'll move this down here. p0 like this, p1 like this. you don't really get bonus points for saving space, but it does help you out either way.
- 21:19 and these don't actually require too many tests to be done, because really they're just on a fixed cycle. the only question is how, you know, what the cycle actually is. so drink 0 is really easy. it's on for what appears to be 6, and then it's off for what appears to be 4. so we should just be able to like move 100, p0, move, uh, and then sleep for f sleep for 6? and then move 0, p0, and sleep for 4? is that right? man, this is so much easier!
- 21:50 than the way that i did this yesterday. i'll go back to the other one. this is not a show, by the way. this is me being like, i've gotten way better at this game very recently. i was using...
- 22:00 i was using x bus memory to pass numbers and counters back and forth. i made it way more complicated. it's another good lesson for programming, not that i'm an expert, but sometimes, you know, the best thing that you can do for your program if you're having a problem is step away from the monitor or, you know, actually go to sleep and come back in the morning. and maybe distract yourself by talking about it while you're doing it. apparently, that's made it way easier. so we've solved drink zero. now, for the slightly tougher part, drink one and drink two.
- 22:28 all being handled in the same controller, but it seems pretty easy. we might need more space for instructions though. let me see. so drink two is an easy one. we're just going to say move... wait a minute, let me think about this. let me think about this. maybe this is where things get more complicated. these are on the same pattern. again, if we could do this with three microcontrollers, it would actually be easier. i may do that now just to make my life easier.
- 23:04 and we're just gonna give ourselves some more space here. wires don't cost me money. and then it would be like this
- 23:14 and this is gonna be way more expensive, but maybe we'll try to refactor it in a bit. okay, so this, you don't need to do it this way, but this is, for the purposes of our video, this is gonna be better. because basically this allows me to make drink one and drink two independent of one another, which is easier for me. if we have them on the same controller, we can do it, but it's gonna be a little slightly more cumbersome. so let's focus on drink one. it's gonna sleep for six, it's gonna be on for one. it's gonna sleep for two, it's gonna be on for one, and then it's gonna repeat the cycle. so it's gonna sleep for six, which is gonna be move p zero, or move zero,
- 23:43 p0 sleep six we might even just be able to have it sleep for six at the start in fact let's try that maybe it'll save some power sleep six move 100 p0 sleep one move 0 p0 sleep to move 100 p0 sleep one a we have to turn it off again. which would be move
- 24:11 0 p 0 sleep 1 okay, so thankfully we did get another microcontroller cuz we oh i'm off and i'm getting increasingly off actually each time okay, basically i'm writing this in really inelegant fashion so it's taking up a lot of space, but we can't actually fit two of these microcontrollers on here. i think this is just me having a little bit of a brain fart, so we're gonna move 0 p 0 we're gonna sleep 6
- 24:42 is this correct? well, you know first let's try to move 100 p0, sleep 1, see if this works. alright, yeah so far so good. okay, then we're gonna move 0 p0, sleep 2, move 100 p0, sleep 1. this one might be off again. no, okay, this one actually works, so that's fine.
- 25:07 but in elegant in elegant and inefficient and expensive because it's using another microcontroller here and then the way that we would do drink to is is actually much simpler that will just be like move 0 to p0 sleep for what appears to be 7 maybe 8 and then it's on for to move 100 to p0 sleep 2 and then just repeat dope ok oh wait wait wait. it's getting increasingly off. oh
- 25:40 why is it getting increasingly odd? it's getting increasingly fast. this is where, you know, debugging becomes important. let's work through it step by does it change every time? one, two, three, four, five, six, seven. boom, boom. one, two, three, four, five, six, seven, eight. one, two, three, four, five, six, seven, eight.
- 26:09 one, two, three, four, five, six, seven... what?! does it really start by going, uh... one, two, th ah, you know what? alright, well, this is getting i'm getting a little big for my britches right now, but basically, maybe it's important to have these two tied together. uh, to have drink 1 and drink 2 tied together, because basically, when drink 1 is on,
- 26:34 drink two should be off except at the start and when drink one is off drink two should be on except at the start so we could i don't know are we really going to do this we're going to connect these two controllers, and then say oh here we go we do have space for one more thing here as much as i know, but that's it's so cumbersome i'm probably missing something so simple here like is that in case you don't see what the problem is there's a differing amount of
- 27:03 of spaces between each one. like, the first cycle is 1, 2, 3, 4, 5, 6, 7, and then this one is 1, 2, 3, 4, 5, 6, 7, 8, and then it's on. there is a way we can do this. we can start a loop that goes from 0 to 7, but started at negative 1 the very first time. just bear with me here. we're gonna move negative 1 to acc, and then
- 27:38 if acc is... this is making my previous solution not look that bad. move negative one to acc. basically we're gonna, for those of you computer science minded folks out there, we're gonna do like a for loop, but we're gonna start it at negative one, and then at the end of the for loop we're gonna reset it to zero, so it only does one extra cycle once. there might be a better way, but keep in mind i'm a little distracted right now, and also
- 28:09 maybe a little unskilled as well. let's start. so let's move a negative one to ac. i just want to make sure that i'm not doing this the wrong, like making a mistake for no reason here. what if we just like move zero, p zero, sleep six, move 100, p zero, sleep two, and then repeat. no, we're getting like increasingly off. and we can't just make it like sleep seven, right? no, because every one from that point on is supposed to be eight. but if we sleep for eight right off the bat, it's not gonna line up, because it's gonna start too far off.
- 28:48 but then it's gonna be in phase. so basically we need to keep the exact phase of the wave that we have right here, and we need to move it to the left. you know, we need to adjust when it starts, basically. and i wonder... what if you try this? what if you try a little cheeky sleep negative one? okay, i thought i was a genius, but apparently our computer does not give us the ability to travel back through time. that's fine, i understand.
- 29:21 for reference, by the way, this let's look at is like off the rails right now. if you want to pick up shenzhen i.o. yourself, do so at steam. it's 15 bucks. it's probably, in my opinion, the most accessible and polished of the zachtronics games, maybe even more so than infinifactory, although i was a lot stupider from an engineering standpoint when i played infinifactory. let me explain to you what's going on in my inelegant solution for this exact same puzzle, which works, by the way.
- 29:48 this is doing a bunch of tests. so first it's looking at the value of acc. and it's like if acc is zero, then you're gonna move a hundred to click zero. and then you're gonna move zero to click one. so basically, every this is going through a loop over and over, and it's like, if it's zero, if it's an even number, click zeros on, click one is off. if it's an odd number, click one is on, click zeros off. okay, and then it's gonna move a hundred to acc. oh no, it just goes between zero and a hundred. and then it's like, if
- 30:21 if it's 100, i don't even remember what i did here. this was at 2 a.m. what was i doing? basically, if acc is 0, do this first step and then make acc 100. if acc is 100, do this and then make acc 0. okay, now what the hell's going on here? if acc is 10...
- 30:42 teq just means if this is equal to and then tlt is like if this is less than tgt which should be around here somewhere. maybe it's like if this is greater than okay so if acc is equal to 10, then you're gonna make acc 0 this is making a loop that goes from 0 to 10 over and over if acc is less than 6 you're gonna move 100 to p 0 ok so if it's less than 6 drink 0 should be on and
- 31:11 if it's not, you're gonna move 0 to p0. so this is this programs for p0. bas er, for for drink 0. basically, if from 0 to 10, if it's between 0 and 6, it's off. if it's between 6 and 10, it's on. or 7 and 10. uh, but then, okay. at the end, you're gonna move your counter through p1.
- 31:32 which is just a simple microcontroller that's gonna take the counter and it's gonna turn it from input output into x bus memory then this is being read and this is where shit gets stupid so it's like this is our 0 to 10 loop because these are all on a 10 cycle i suppose okay
- 31:50 so we're storing the counter in acc. maybe i can step through this, and we'll go to step 7 so you guys can see what's up here. not step 7, but time 7. there we go. okay, so this is where we want to be here. acc is 5, but it should be 6 because we're going to read it through the memory. acc is 6. okay. oh, i shouldn't have done that. okay, step. acc is coming over here as 7. we're so off the rails. what a weird youtube video. okay, acc is 7.
- 32:19 the our counter is currently at seven we're on a seventh of ten phases through this loop or say we're 70% of the way through the loop if that makes sense we're gonna move our x bus memory into this stored variable acc step bitchin then we're gonna check if acc is six it's not so we move down here is acc nine no, it's not
- 32:41 is it 8? no it's not. is it 7? hell yeah dude it's 7. so what do we do with step 7? okay, let's look down here. step 7, 1, 2, 3, 4, 5, 6, 7. so it's this one after it. at this one, drink 2 should be on, drink 1 should be off. okay, so what do we do at step 7? step forward a bit, move 100 to p1, drink 2 should be on. step again, move 0 to p0.
- 33:07 which is this one. so drink zero or drink one should be off. bitchin', is acc equal to 10? no. if it was, we would make it equal to zero again. oh no, we wouldn't make it equal to zero because we don't have to, that's being done here. instead we would just, okay, sweep. and it works. alright, so i've got a refresher here. that's how we can write a loop. dopest sign ever. by the way, i want to go back. dopest sign ever? well, we don't know how much it costs yet because it doesn't work. okay. so we need to... we need to make a loop, basically, but it should be easy enough.
- 33:39 we'll do it this way. is acc equal to 10? if it is, which is the plus sign happens if it is equal, or if it fulfills the condition on the previous line, the minus sign happens if it's not. if it is equal, then we're gonna move acc 0. or move 0 acc, sorry. so if the acc is at 10, if our variable's at 10, we're gonna send it to 0 and it's gonna start the loop all over again. we might need a slightly bigger microcontroller for this.
- 34:09 just so we have more space to write variables. and then it's gonna be even more expensive than my earlier solution, which is looking strikingly elegant as this video stretches into its 35th minute. okay, so then if the acc... what have i done? i'm in the weeds, man! now i'm like, wait a minute, we can't just make a loop because it's not gonna work right the first time through. it's like exactly the same situation.
- 34:45 this is why this game is complicated. i have like pages and pages of actual note text next to me, like i've written down in a book that i have for this exact purpose. uh, of like, okay, we're storing the loop incrementer in dat, and then in acc we're storing the value that we're gonna output to the lcd screen, led screen, and then p0 is gonna be our previous move that we can access at any time because it's simple input output instead of x bus memory, you don't have to sync it, etc. etc. um...
- 35:16 there is a better way. i love this. i love this. we're gonna be geniuses, okay? we're actually gonna use our xbox memory here. and... what am i gonna write here? we can leave comments, by the way, but this takes valuable space. now, what are we gonna do here? basically, if this... if p0 is... no, we can't do that. i was like... basically, i was like, if p0's off, we should be on after this point in the loop. oh, god, what have i done?
- 35:57 couldn't have just gone with puzzle 3. you had to go to puzzle 4 where things actually get complicated. i mean that is the name of the game, but i'm frustrated with myself a little bit. we just have to believe. wait, what does this do? oh cool, that shows power usage. i actually had no idea. i usually want the profiler on so we can see the variables and the state of them while we're debugging. there's probably a much simpler way to do this.
- 36:33 because i'm thinking like how do we just start slightly the first cycle? we're just gonna okay, okay, okay, okay? i'm gonna make this super expensive and we're gonna store a variable in debt. we're gonna say move debt negative one or move negative one back basically this is like if that is negative one this is what you're gonna do and if that is one this is what you're gonna do i understand now, okay? so the first the first time we go through the cycle we're gonna test is
- 37:06 dad negative one if it is then here's our whole loop. we're gonna say oh, this is gonna be like also complicated i think we can just say go loop and then we can write a loop elsewhere but we could also just write it in conditionals here, which is gonna be even annoying and that'll be like okay, so if that's negative one then we're gonna say we're gonna take some valuable space at the expense of readability if that's negative one. we're gonna say oh
- 37:41 move away with it. yeah move 0 to p 0 and we're going to sleep for 7 and then we're going to move 100 p 0 and we're going to sleep for 2 and then we're going to sleep and then we're going to move well let's just try this for a second that that's good, and then we're going to move 0 to dad so what is this going to do?
- 38:13 if that is negative one... basically, let me put this in very simple layman's terms for myself. the first cycle, this should work. wonderful. we're geniuses. it doesn't work from that point onwards, but that's okay. now it should be... if that is zero, move zero to p zero, sleep for eight... we didn't write the conditionals properly here. one second. move zero to p zero, sleep for eight, move 100 to p zero,
- 38:51 sleep for two is that right and then we should we have to change it at the end, but i think it's fine. oh what? what? wait wait wait, maybe we just sleep for seven, but if we sleep for seven that doesn't fix i've just created exactly the same situation oh, you know why because it's moving negative one to dad to start with every time we go through the loop because i'm a dumb idiot how in the sam hill do we make it only go through a
- 39:28 this one time. i have just... i have mired us in hell. by the way, this is nothing like modern programming in like an ide, like xcode, or visual studio, or eclipse. if this is what you think computer programming is like, computer programmers will be flattered. for the most part, you just write, you know, it's almost written in plain english. for each, you know, string x in strings. you wouldn't use x, but you get the idea.
- 40:00 live debugging here with northernlion. of course this isn't gonna work. we're saying every time is gonna be negative one. but then like this one will also not work if we just delete that because it's just... first off both of these loops are exactly the same. but we need this to like i need to hard code the dat variable in it.
- 40:26 although this one works, it just needs to be moved one spot to the left. this is one of those things like pair programming. this error is probably crazy easy to spot and i'm an idiot. one thing i'm thinking is we can move this slightly down.
- 40:38 go like that, and then we can actually, you know, have this connect to this and we can be like, okay, on your first step, you should pass this over here. but then every single time it goes through, it's gonna pass it and i'm a moron. and now i'm going back to my previous one and i'm like, that's not that bad. this is where i ended up, by the way, and this is how every puzzle has gone for me in shenzhen i.o. i've been like, uh, oh, this is easy. five minutes, i got the solution. uh, but we need to implement one last thing.
- 41:04 a loop actually makes way more sense, like one loop that controls everything. am i gonna do that in this video? probably not, that seems a little ridiculous. but am i gonna do that in this video? yes i am because i'm a moron. we're gonna go through a simple for loop from 0 to 10.
- 41:27 scrap all of this if this doesn't work by the way we're going to end this episode and i'm going to end it with like a very strong recommendation of getting this game for yourself because i enjoy it a great deal despite its occasional frustrations, but okay, how are we going to do this one if acc equals 10 acc is actually going to equal 0 move 0 ac move ac 0 ok move 0 acc my bad
- 42:00 okay, so we're controlling drink one and drank two do we actually need one last microcontroller in here we might but i don't think so, but we might just okay. what's go like that? like this like that that doesn't make any damn sense what what in the fudge have i done? oh god? i'm i'm
- 42:32 you ever have this happen, you're like, oh, i'm gonna make a spice rack this weekend, and then sunday 1 p.m. rolls around and you're like, i don't even have nails. that's where we're at right now. get rid of this shit, we don't need this. just write this simply, we'll figure out what we need as we go. connect this, connect this. simple loop from 0 to 10. if acc is less than 6, then move 0, p0, move 0 to p1. very simple. if
- 43:06 acc is 7 or 9. so, let's do... if acc is 7, move 100, p0. if acc is 9, move 100, p0. if... we can gain a little extra space here, by the way. if acc is equal to 8, this is bad programming, by the way. it's actually 7 and 10, right? or 6... 6 and... 6 and 8.
- 43:44 6 and 9. there we go. 7 and 8, okay. if acc is equal to 7, then we're gonna move 100 p1. if acc is equal to 8, we're gonna move 100 to p1. let's sleep 1. but we're never gonna increment acc, so this is never gonna work. i give up. you know what? this is the reason it took me some time last night.
- 44:07 just revel in the fact that i have actually gotten this done even if the solution is terrible. by the way, when i turn off this video, i will probably figure out the solution for myself pretty easily. but for now, thanks for watching! this is shenzhen i.o. it's beguiling me, but i love it a great deal. this is the kind of game where every puzzle is gonna take you half an hour. every puzzle is gonna take you 45 minutes or even longer. and the one that i'm working on right now, which is not working at all, actually...
- 44:30 incorporates the use of a counting screen here and then some more logic that goes on but i'm a huge fan of this game. i think it has the potential to be considered for the people who like it they're gonna think it's one of the best games of the year and i may indeed be in that camp. there is also a gorgeous looking version of solitaire that i have not grokked the rules for because instead, by the way, it's not mahjong just because it's got the mahjong characters on it, but yeah, i haven't grokked this yet because i've been too busy working out the programming puzzles, but for now, thanks for watching. i highly highly recommend this.
- 44:59 you will have to refer to reference material. i can't make that clear enough. you're gonna have to refer to the reference material constantly and that's part of the enjoyment. papers please style. like, oh, do i let this guy in? oh, how do i compare two variables? i'm bad at it! i'm supposed to be bad at it. i love it though. i'm having a great time so far. highly recommended. you can find it on steam. $15.00, $13.50 american for its opening week sale. for now, thanks for watching. if you enjoyed the episode, click the like button. it helps out a great deal and of course subscribe if you want to see more in the future. for now, thanks for watching. subscribe if you want to see more like this in the future. and i'll see you next time.