Skip to main content

Report this content

We want the Dreams coMmunity to be a safe, diverse and tolerant place for everyone, no matter their age, gender, race, sexual orientation or otherwise. If you believe this content to contradict these principles, you can file a report for our coMmunity teams to investigate.

Note that misuse of the reporting tool will not be tolerated.

Item being reported:

A forum post by Alados5

I think it can be even simpler, but I’m writing this without the tools in hand so forgive me if something’s not right:
- Stamp a selector, output port A will be on by default.
- The idea is to go down a port letter every time a correct number is entered until everything’s correct, or go back to A if something’s wrong at any moment.
- If output A is on AND the first digit is entered correctly, turn on port B directly. This will turn off port A automatically, I think.
- If B is on AND the second digit is entered correctly, turn on port C.
- Repeat until you’ve entered all digits of the code.
- Last port’s output has to be connected to whatever you want to do when the code is entered correctly.
- Now you only need to reset to A if you enter a wrong number, so just power A on with all the conditions (this might be tedious): port B on AND any input except the second correct digit, port C on AND any input except the third correct digit, and so on.
- To reduce the number of gadgets, I would put a common “button pressed” signal for all digits and another one specific for each digit (“pressed 1”, “pressed 2”, etc). Now, if A is on AND “pressed” AND “pressed [first correct digit]”, power on B. If B is on AND “pressed” AND NOT “pressed [second correct digit]”, then go back to A. Maybe this is not optimal and it doesn’t help, so skip it if you’re not sure and you think it overcomplicates more than simplifies.
- This solution is super simple and doesn’t require a lot of components, but you’ll have cable loops everywhere, from output A to input B, from B to C… Be prepared.

Okay, so if it works, that’s it. But you might like to know this is a simplification of a “Finite State Machine”, a Sequential System very common in Electronics used for lots of stuff including this code application. Basically you have states, one corresponding to “nothing correctly guessed”, then “one number correct”, “two numbers correct”, etc., and you just go from one to the next if a correct digit is entered and go back to the first one if something’s wrong (like with the selector!). These states are usually represented with D latches and D flip-flops irl, which are totally doable here too, but in Dreams the simplest and fastest way to represent them is with counters (0-1). The selector simulates a way of representing these states that is, for me, the most clear one, with one and only one ON at a time, called “one-hot” (https://en.wikipedia.org/wiki/One-hot).

So basically, you can do anything that can be represented with states like that and several counters or a selector. I really like this stuff so I could go on, and maybe this is already too much, but I think you might appreciate this knowledge for future logic creations!

If the selector thing doesn’t work, try using counters simulating the expected behavior: the first one active (1) by default, if one is active and the next correct digit is entered power on the next one, and reset the previous one at the same time, and finally if an incorrect digit is entered, go back to the first state.

Oh dear! Your browser is either unsupported or there has been a problem loading the page.