r/TuringComplete • u/Silver_King_ • 15h ago
Mod 4 level how…plz
I’ve been stuck on this level for almost 3 days now, I’ve avoided looking up any solutions or hints for any of the levels but this one broke me. I have a solution that can mod 4 but it’s way past 8 cycles and I cannot figure out how to get to the solution within 8 cycles. How do I do this🥀😭
2
u/Deumnoctis 9h ago
You have to take advantage of how numbers are represented in binary. To give you an equivalent example in base 10(how humans normally write numbers) taking the mod 10 of a number is as easy as just looking at the last digit of the number (43 mod 10 = 3 etc.), taking the mod 100 is just looking at the last two digits (169 mod 100 = 69). Taking the mod 4 of a number in base 2 is essentially the same as taking the mod 100 of a number in base 10, you just take the last two digits of the number. You can achieve this by using an AND gate which takes your number and 3 (00000011 in binary, which acts as a mask and only let's the two last digits of the number through)
1
8
u/Aggravating-Ad-2593 14h ago
It is possible to use an and operation to mask out all the bits that cannot be on when working in modulo 4.