It’s time for PART 2 of my logic tutorial. As with the previous part, I’ve written every thinking step down in order for you to be able to see how the thinking process goes and apply it yourself. As you may have read in the comments, this method is how most logicians create their own logic, so I believe that even for the visualizers it can be a very effective learning method. For everyone who is eager to learn this, I am asking you to read everything I write down very carefully and think about it for a moment. It is vital that you understand every single step in order for you to start thinking logically. It may sound obvious, but then again, that’s one of my two Golden Rules of Logic. In order for you to never forget them, I’ll happily write them down once more:
THE TWO GOLDEN RULES OF LOGIC
RULE #1: Things NEVER happen on their own. Every output needs an input.
RULE #2: Just because some things are obvious, it doesn’t mean they shouldn’t be taken into account.
Step 4: Debugging Your Logic
This step is of vital importance as this will truly test if you actually understand your own logic. This is what most visualizers find a hard thing to do, as it often requires a lot of insight and initiative. Despite what some people may think however, you can boost your insight by training it. Seeing a lot of problems and solutions will help you better understand logic overall. Try to find advanced logic tutorials and instead of mindlessly copying every single step, think about what you’re actually doing. Take a moment to write it down and try to thoroughly understand each step. Tweak it a little here and there and see what comes out. The more you do this, the more often and the more quickly you’ll see solutions to difficult problems. The more you know and realize what certain pieces of logic are used for, the more you’ll be able to link them into your own logical systems.
As for now, we’ll have yet to debug our custom jump for PART 1, because, as you may have noticed, it’s not yet possible to jump between layers. Logicians immediately know how to fix this, but we’re going to slow down and try fixing it by trial and error. First of all, let’s see what jumping between layers actually means in terms of logic. Sackboy can jump down layers by flicking the left control stick down AND pressing X. Okay, so we’ll definitely need to connect the left control stick and the X button to an AND gate. We also need to still be able to still jump upward and not just between layers. Okay, so here we’ll try to connect both the second Permanent Switch of the regular jump and the AND gate of the layer jump to an OR gate and we’ll wire that up to the Mover. Now, either regular jumping OR layer jumping should trigger the Mover.
Yes, we’re moving alright, but ehh… That’s not what we want
Nope, that doesn’t work, because now we’ll jump regularly if we press either X and the left stick OR just X. We actually DON’T want the Mover to be active when jumping down layers. In other words, we ONLY want the Mover to be active when jumping upward. We don’t want the regular jump and the layer jump to be active at the same time. So, let’s jot down an XOR button and connect it to the second Permanent Switch and the AND gate. Yes, now we can finally jump down.
So, now we’re finished?
But there’s still a problem, as we can now press X when in midair. This is because we didn’t connect an Impact Sensor to it. You don’t have to touch the floor in order to be able to press X. So, we’ll do that now. Connect the Impact Sensor to the AND gate and change the number of ports to 3. So now, we have 3 conditions in order to jump down layers. However, this third condition caused layer jumping to become impossible. So, we’ll have to remove the Impact Sensor again. This is all part of our trial and error process. When something fails, try something else.
Trial and error, that’s what this is called
Hmm, okay, we don’t want the Mover to be active when jumping down, so the XOR gate never gives a signal when jumping down. This is because the XOR gate gets two signals when jumping. After all, pressing X while on the ground also triggers the regular jump. The XOR gate will only be active when it receives one signal. So, in midair, the regular jump won’t be active, because we’re not standing on the ground, while the layer jump will be. This causes the XOR gate to receive only one signal and thus causes it to be active and so the Mover will be too as long as you press X and down on the left control stick. Now, this is one of those parts that you should study very carefully in order to understand it properly. Read it carefully, write it down, make flow charts of it, etc, etc. Just make sure you understand every single thing I just mentioned above.
Now, to fix this, we’ll need to make it so that, in order to press X again, you’ll have to stand on the ground. Connecting an Impact Sensor to the AND gate of the layer jump didn’t work, so we’ll have to think of something else. We’ll need to stop the XOR gate from sending a signal, even while in midair, so the solution has to be behind the XOR gate. Now, this the part where we should test out some things and see what works. Of course, it shouldn’t interfere with the regular jump. The logic item on the list is the AND gate. Hmm, okay. Let’s try that, shall we? Connect the XOR gate and the second Permanent Switch to the AND gate and the AND gate to the Mover. Now, even though the XOR gate should send a positive signal, the other condition, touching the ground, isn’t met and the AND gate will not send a signal to the Mover. Problem solved!
Step 5: Innovation
For this step it’s important not to be afraid to try stuff out, even though it doesn’t work. People learn from making mistakes and in case of logic that phrase still applies. Now we can focus on making the double jump and this may be the hardest part yet, as we’ll have to repeat the previous steps in order to collect the right logic. Okay, double jumping includes jumping while in the air. Of course, this requires another Mover, so we’ll make a copy of that and place it above our first Mover. (I placed it under my first Mover and placed the rest of my logic above, so that you will keep being able to see what’s going on without having the picture frame to be too large.)
Nice and tidy
Another thing that is required is an Impact Sensor. Of course, we’ll have to invert this to make it possible to jump in the air. Remember, not touching the ground means no impact, so to be able to get a signal from it, we need to invert it. Only once, so we also need to connect it to a Permanent Switch. Connect the Impact Sensor to the NOT gate and connect the X button to the Permanent Switch. Now, in order to jump again you have to be in the air AND you have to press X. Connect the NOT gate and the Permanent Switch to an AND gate and connect that to the Mover.
Still with me?
As you can see, as soon as you press X, you’ll soar into the air again. This is because the Permanent Switch shouldn’t become active when you press X after the first time, but after the second time and because it doesn’t reset after a certain amount of time. The latter we can fix pretty easily by putting a Timer in it. Copy the Timer from the first jump and connect it to the reset button of the Permanent Switch. The Timer works… once, so we’ll have to find a way to reset that too. This time, we could set the Timer to reset itself. This has a funny effect as we can now jump an infinite amount of times. But that’s not quite what we want.
Or is it?
We’ll have to make it so that can jump only two times. So, the second Mover should only be able to be activated two times. Times, times, hmmm…. I know! We could use a Counter for this. After it’s reached 2, the Mover should no longer be active. Connect a Counter (set it to 2) and the AND gate to another AND gate and the AND gate to the Mover. Next, we should reset the Counter when you hit the ground, so we connect the reset port to an Impact Sensor and we should connect the Start/Stop port to the X button, so it becomes active every time you press X. We should also connect it to a One Shot Counter that will reset itself. Because it resets itself, you can press X again. Connect the Counter and the X button with an OR gate to the 2 second Counter.
It’s only logical
When you try it out you’ll soon notice that you can press X way more than two times and still fly into the air. Hmm, so when the Counter is full, it’ll keep sending a signal. What if we try to turn it the other way around? The Counter won’t send a signal when it’s empty. Why not set the Counter so that it COUNTS DOWN every time you press X? Let’s try that, shall we? Invert the output of the Counter and set it to 3 (the last time you’ll press X no signal will be sent. Now, you can only jump two times. Our double jump is complete.
Step 6: Optimization
Or is it? As you’ll soon notice, it has once again become impossible to jump down layers, so we’ll have to find a way to fix it. Hmm, why not try to see if our layer jumping logic also works for double jumping? Unfortunately, it doesn’t. AND, OR and XOR gates just won’t work, as you see in my screenshots. An AND gate will enable the layer jump, but disable the double jump, because both the XOR gate and the previous AND gate will have to send a positive signal. An OR gate won’t work because it will detect both the double jump signal and the layer jump signal and thus activate the Mover and the XOR gate will keep letting you jump when holding down and pressing X. So how do we fix it? Well, in the exact same way as the previous problems; by trial and error.
First of all, we’ll need another AND gate to connect both the X button and the left control stick down direction. Then we’ll wire up an XOR gate to it (because that worked so well the first time) and we connect the last AND gate and the new layer jump AND gate to it. Then we wire up the last AND gate and the XOR gate to a new AND gate, which we’ll wire up to the Mover. Now, when holding down and pressing X for a little longer than just a tap, we will be able to jump down layers. Mission accomplished.
It’s not perfect, but it does the job
So, we’re done now? Well, if you’re satisfied with this double jump and don’t want to learn anymore, then yeah, you could sure call it a day. However, if you think that maybe you could do a better job, go ahead and try it. Try to optimize your creation. Clean up the logic a bit, so you can teach others how to make it. And of course, this double jump creation process was merely an example. I’ve deliberately made plenty of errors to make you see how a logician should be able to solve the problems. When faced with such problems you should always remember: the answer always lies within the tools in your tools and often doesn’t require more than a couple of logic gates. When creating logic you should always have a clear view of what you actually want to create and translate into terms of logic. Literally jot down a couple of sentences that you’d like to see your system do. Then think of how you get there and try out some stuff through trial and error. Don’t be afraid to spend of lot of time learning logic and at all times try to understand what you’re actually doing. That is without doubt THE most important thing of logic. Try to understand what other people are doing. Don’t just copy and paste the logic but take a careful look at it. Do this often enough and you’ll eventually become a true logician.
P.S. This double jump may not be perfect, but that’s because I’m a visualizer too. I picked up logic precisely via this method and intend to extensively apply it to my levels to make my own logic masterpieces. I suggest you do the same.
Results 1 to 8 of 8
How To Understand And Create Your Own Logic [PART 2]
- Join Date
- Oct 2009
- *points* ...there
- Blog Entries
I would ask if at the end of your post if you could summarize in a few sentences what all your logic does and does not allow to happen to help clarify things a little.
- Join Date
- Jul 2010
- ~Across Nowhere~
- Blog Entries
- Join Date
- Apr 2011
- Blog Entries
I spent the afternoon tracing back the evolution of a single chip that I built. It works at every stage I saved it so no real trial and error. But pretty interesting none the less. I'm putting labels on it and will post it shortly.
It follows pretty much the same thought process here, but it gets pretty hardcore toward the end. So I'm making sure that the process is clearly outlined. By going back and looking at it I actually learned alot about my create style. As there is an obvious change in design that after looking back I should have made sooner. But what I had worked, so I built on it, rather than building FROM it.
EDIT: Phew! Finally got the post done.
I put it in my existing Object showcase thread for any one who is interested I document the stages of wanting X to switch on hover mode, and how I got from here
- Join Date
- Apr 2011
- Blog Entries
I wouldn't be scared off by the length or the term 'hardcore' either. It's not as scary as discussions around storing analogue signals to input a JK flip-flop.
The most interesting thing to me is the use of toggle switches, and how I kept using them instead of a selector which was so much better suited to the job. The reason I used them is that they were so much easier to visualise the signal path when I started.
Did you jump in the car to marvel at the hover animation?
- Join Date
- Jun 2010
- New Zealand
- Blog Entries
Very cool. now i know how to do this? ! thanks. other than that. pretty much a noob at logic